Skip to content

Commit a1d5f5c

Browse files
committed
Merge branch 'develop' into 1.2
2 parents d563364 + b5ccea7 commit a1d5f5c

File tree

227 files changed

+7413
-2011
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

227 files changed

+7413
-2011
lines changed

.devcontainer/.vscode/launch.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Listen for Xdebug",
6+
"type": "php",
7+
"request": "launch",
8+
"port": 9003
9+
},
10+
]
11+
}

.devcontainer/Dockerfile

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM php:8.3-apache-bookworm
2+
3+
# Install PHP extensions
4+
ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
5+
6+
RUN install-php-extensions @composer gd intl zip xdebug
7+
8+
# Enable Apache2 rewrite module
9+
RUN a2enmod rewrite

.devcontainer/README.md

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Welcome to the Winter development environment
2+
3+
<p align="center">
4+
<img src="https://github.com/wintercms/winter/raw/develop/.github/assets/Github%20Banner.png?raw=true" alt="Winter CMS Logo" width="100%" style="max-width: 600px" />
5+
</p>
6+
7+
This development environment container sets up a fully-functional installation of Winter CMS, running on Apache 2 with PHP 8.3, and makes it simple to start working with Winter CMS in VSCode, PHPStorm and online code-editing suites such as GitHub Codespaces.
8+
9+
If you opted to use the `bootstrap-winter` feature, which is enabled by default, Winter CMS will be automatically configured and an administrator account will be generated with the credentials **admin / admin** for you to quickly sign in. It is recommended once you have done so that you change this password immediately.
10+
11+
The following plugins and themes will be installed automatically with this feature:
12+
13+
- Workshop theme (https://github.com/wintercms/wn-workshop-theme)
14+
- Pages plugin (https://github.com/wintercms/wn-pages-plugin)
15+
- Blog plugin (https://github.com/wintercms/wn-blog-plugin)
16+
- Test plugin (https://github.com/wintercms/wn-test-plugin)
17+
18+
## Using this environment
19+
20+
When this environment is built, the Apache 2 service is automatically started, with the root folder of the Winter project being used. A preview of the website will be opened immediately - if you do not see this, you can open the **Ports** tab in VSCode to view the URL generated for viewing the project.
21+
22+
XDebug is enabled by default, and allows you to quickly use step debugging. It will be available in the **Debug** tab of VSCode or similar screen in other IDEs.
23+
24+
By default, when using the `bootstrap-winter` feature, changes to certain folders and locations will be ignored by Git to keep the change list clean. This includes the `plugins` and `themes` folders, the `config/app.php` file and the `composer.json` file in the root folder. If you wish to use this environment for your own projects, it is recommended that you do not use this feature. Please see the **Using in your own projects** section below for using this environment outside of Winter development.
25+
26+
## Environment platform
27+
28+
The following software is installed in this environment.
29+
30+
- Apache 2.4
31+
- PHP 8.3 with the following extensions:
32+
- `intl`
33+
- `gd`
34+
- `xdebug`
35+
- Composer
36+
- NodeJS 22 (including `npm`)
37+
- Git
38+
39+
## Using in your own projects
40+
41+
You may use this development environment for your own projects, making it a great starting point to hit the ground running with Winter. It is recommended that you *disable* the `bootstrap-winter` feature when using this environment for your own projects.
42+
43+
You may disable this feature by modifying the `.devcontainer/devcontainer.json` file before running the container and commenting out the feature:
44+
45+
```json5
46+
"ghcr.io/devcontainers/features/git:1": {},
47+
"./local-features/apache-config": "latest",
48+
// Comment the following feature if you wish to bootstrap and configure Winter manually (ie. you wish to use this for your own project)
49+
//"./local-features/bootstrap-winter": "latest"
50+
},
51+
"overrideFeatureInstallOrder": [
52+
```
53+
54+
If this feature is disabled, you must bootstrap your project manually. This includes:
55+
56+
- Downloading the Composer dependencies.
57+
- Generating the configuration for the project, either as an `.env` file or in the `config` folder.
58+
- Finally, Running the database migrations.
59+
60+
You may view the `.devcontainer/local-features/bootstrap-winter/bootstrap.sh` file to see how we bootstrap Winter, and run these commands manually. You will only need to do this once per project container.
61+
62+
If you wish to mount your own volumes, use your own databases or any other complex usages, please review the [Docker documentation](https://docs.docker.com/) to set this up on the container.
63+
64+
## Troubleshooting
65+
66+
### Preview website missing styles / assets on Codespaces
67+
68+
By default, ports that are forwarded in Codespaces are private by default. While we have tried to fix this automatically in the Winter bootstrap process by making the port public through the GitHub CLI, it unfortunately is not consistently applied.
69+
70+
If you find that your preview website is missing assets or styling, open the **Ports** tab by opening the Action Palette in Codespaces (`F1`) and using the **View: Toggle Ports** action. Right click on the **Preview Winter installation** port, right click on it and choose **Port Visiblity -> Public**. This should resolve the issue.

.devcontainer/devcontainer.json

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
3+
{
4+
"name": "Winter on PHP 8.3",
5+
"build": {
6+
"dockerfile": "./Dockerfile",
7+
"context": "."
8+
},
9+
"features": {
10+
"ghcr.io/devcontainers/features/common-utils:2": {
11+
"installZsh": "true",
12+
"configureZshAsDefaultShell": true,
13+
"username": "vscode",
14+
"userUid": "1000",
15+
"userGid": "1000",
16+
"upgradePackages": "true"
17+
},
18+
"ghcr.io/devcontainers/features/node:1": {
19+
"version": "22"
20+
},
21+
"ghcr.io/devcontainers/features/git:1": {},
22+
"ghcr.io/devcontainers/features/github-cli:1": {},
23+
"./local-features/apache-config": "latest",
24+
// Comment the following feature if you wish to bootstrap and configure Winter manually (ie. you wish to use this for your own project)
25+
"./local-features/bootstrap-winter": "latest"
26+
},
27+
"overrideFeatureInstallOrder": [
28+
"ghcr.io/devcontainers/features/common-utils"
29+
],
30+
"containerEnv": {
31+
"DB_CONNECTION": "sqlite",
32+
"DB_DATABASE": "${containerWorkspaceFolder}/storage/database.sqlite"
33+
},
34+
"postStartCommand": "sudo rm -rf /var/www/html && sudo ln -s ${containerWorkspaceFolder} /var/www/html && service apache2 start",
35+
"forwardPorts": [8080],
36+
"portsAttributes": {
37+
"8080": {
38+
"label": "Preview Winter installation",
39+
"onAutoForward": "openPreview"
40+
},
41+
"9003": {
42+
"label": "Xdebug",
43+
"onAutoForward": "notify"
44+
}
45+
},
46+
"customizations": {
47+
"vscode": {
48+
"settings": {
49+
"php.validate.executablePath": "/usr/local/bin/php",
50+
"phpcs.executablePath": "${containerWorkspaceFolder}/vendor/bin/phpcs"
51+
},
52+
"extensions": [
53+
"xdebug.php-debug",
54+
"bmewburn.vscode-intelephense-client",
55+
"shevaua.phpcs",
56+
"swordev.phpstan",
57+
"wintercms.winter-cms"
58+
]
59+
},
60+
"codespaces": {
61+
"openFiles": [
62+
".devcontainer/README.md"
63+
]
64+
}
65+
},
66+
"remoteUser": "vscode"
67+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"id": "apache-config",
3+
"name": "Apache configuration changes"
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
#-------------------------------------------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
5+
#-------------------------------------------------------------------------------------------------------------
6+
7+
USERNAME="vscode"
8+
9+
set -e
10+
11+
if [ "$(id -u)" -ne 0 ]; then
12+
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
13+
exit 1
14+
fi
15+
16+
# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
17+
export DEBIAN_FRONTEND=noninteractive
18+
19+
apt-get update && apt-get -y install --no-install-recommends lynx
20+
usermod -aG www-data ${USERNAME}
21+
echo "Listen 8080" > /etc/apache2/ports.conf
22+
apt-get clean -y && rm -rf /var/lib/apt/lists/*
23+
24+
echo "Done!"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
echo "### Updating Composer dependencies"
6+
php ${PWD}/.devcontainer/local-features/bootstrap-winter/update-composer.php
7+
composer update --no-interaction --no-scripts --no-audit
8+
9+
if [ ! -f "${PWD}/.env" ]; then
10+
echo "### Generating .env file"
11+
php artisan winter:env -q
12+
php artisan key:generate -q
13+
fi
14+
15+
if [ "${DB_CONNECTION}" = "sqlite" ] && [ "${DB_DATABASE}" = "${PWD}/storage/database.sqlite" ] && [ ! -f "${PWD}/storage/database.sqlite" ]; then
16+
SETUP_ADMIN=true
17+
echo "### Creating SQLite database"
18+
touch storage/database.sqlite
19+
fi
20+
21+
echo "### Run migrations"
22+
php artisan migrate
23+
24+
if [ "${SETUP_ADMIN}" = true ]; then
25+
echo "### Setup admin"
26+
php artisan winter:passwd admin admin
27+
fi
28+
29+
echo "### Switch theme"
30+
php artisan theme:use workshop
31+
32+
echo "### Ignoring files in Git"
33+
echo "plugins/*" >> "${PWD}/.git/info/exclude"
34+
echo "themes/*" >> "${PWD}/.git/info/exclude"
35+
echo "composer.json" >> "${PWD}/.git/info/exclude"
36+
git update-index --assume-unchanged composer.json
37+
git restore config
38+
39+
cp ${PWD}/.devcontainer/.vscode/launch.json ${PWD}/.vscode/launch.json
40+
41+
if [ "${CODESPACES}" = "true" ]; then
42+
echo "### Configure for Codespaces"
43+
php ${PWD}/.devcontainer/local-features/bootstrap-winter/codespaces.php
44+
git update-index --assume-unchanged config/app.php
45+
gh codespace ports visibility 8080:public -c $CODESPACE_NAME
46+
fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
$root = dirname(__DIR__, 3);
4+
5+
require_once $root . '/vendor/autoload.php';
6+
7+
use Winter\LaravelConfigWriter\ArrayFile;
8+
use Winter\LaravelConfigWriter\EnvFile;
9+
10+
$config = ArrayFile::open($root . '/config/app.php');
11+
12+
$config->set('trustedHosts', [
13+
'localhost',
14+
'^(.+\.)?app.github.dev',
15+
]);
16+
$config->set('trustedProxies', '*');
17+
18+
$config->write();
19+
20+
$env = EnvFile::open($root . '/.env');
21+
22+
$env->set('APP_URL', 'https://' . $_ENV['CODESPACE_NAME'] . '.app.github.dev');
23+
$env->set('LINK_POLICY', 'force');
24+
25+
$env->write();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"id": "bootstrap-winter",
3+
"name": "Bootstrap Winter",
4+
"description": "Bootstrap and configure Winter CMS automatically for development on Winter itself",
5+
"postCreateCommand": "sh ./.devcontainer/local-features/bootstrap-winter/bootstrap.sh"
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
echo "Done"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
$composerPath = dirname(__DIR__, 3) . '/composer.json';
3+
$composer = json_decode(file_get_contents($composerPath), true);
4+
5+
$packages = [
6+
'winter/wn-test-plugin' => 'dev-main',
7+
'winter/wn-blog-plugin' => 'dev-main',
8+
'winter/wn-blog-plugin' => 'dev-main',
9+
'winter/wn-workshop-theme' => 'dev-main',
10+
];
11+
12+
// Install Winter packages
13+
foreach ($packages as $package => $version) {
14+
if (!in_array($package, array_keys($composer['require']))) {
15+
$composer['require'][$package] = $version;
16+
}
17+
}
18+
19+
file_put_contents(
20+
$composerPath,
21+
json_encode($composer, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)
22+
);

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ insert_final_newline = true
1111
indent_style = space
1212
indent_size = 4
1313

14-
[.github/workflows/**.{yml,yaml}]
14+
[**/.github/workflows/**.{yml,yaml}]
1515
indent_size = 2

.gitattributes

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
*.md diff=markdown
44
*.php diff=php
55

6+
/.devcontainer export-ignore
67
/.github export-ignore
7-
/.gitpod export-ignore
88
.gitattributes export-ignore
9-
.gitpod.yml export-ignore
109
CHANGELOG.md export-ignore
10+
/package.json export-ignore

.github/assets/sponsor-route4me.png

13.2 KB
Loading

.github/workflows/archive.yml

-31
This file was deleted.

.github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
max-parallel: 8
9797
matrix:
9898
operatingSystem: [ubuntu-latest, windows-latest]
99-
phpVersion: ['8.0', '8.1', '8.2']
99+
phpVersion: ['8.0', '8.1', '8.2', '8.3']
100100
fail-fast: false
101101
runs-on: ${{ matrix.operatingSystem }}
102102
name: ${{ matrix.operatingSystem }} / PHP ${{ matrix.phpVersion }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ sftp-config.json
2424
nbproject
2525
.idea
2626
.vscode
27+
!.devcontainer/.vscode
2728
_ide_helper.php
2829

2930
# Other ignores

0 commit comments

Comments
 (0)