From 968fe404472636d099b9bbfc0df05723b761b4f2 Mon Sep 17 00:00:00 2001 From: Jalen Davenport Date: Fri, 26 Jul 2024 11:42:05 -0400 Subject: [PATCH 1/6] =?UTF-8?q?Tweak=20composer=20scripts;=20prevent=20que?= =?UTF-8?q?ue=20container=20from=20crashing=20if=20mysql=20container=20isn?= =?UTF-8?q?=E2=80=99t=20ready=20or=20Craft=20isn=E2=80=99t=20installed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 7 ++++--- config/docker/queue/Dockerfile | 6 ++++++ config/docker/queue/run_queue.sh | 28 ++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 config/docker/queue/run_queue.sh diff --git a/composer.json b/composer.json index ae58114..1bb86a1 100644 --- a/composer.json +++ b/composer.json @@ -58,9 +58,10 @@ }, "scripts": { "post-create-project-cmd": [ - "@php -r \"file_exists('.env') || copy('.example.env', '.env');\"", - "@php -r \"unlink('composer.json');\"", - "@php -r \"rename('composer.json.project', 'composer.json');\"", + "@php -r \"file_exists('.env') || rename('.env.example', '.env');\"", + "@php craft setup/keys", + "@php -r \"file_exists('composer.json.project') && unlink('composer.json');\"", + "@php -r \"file_exists('composer.json.project') && rename('composer.json.project', 'composer.json');\"", "@composer dump-autoload -o" ] } diff --git a/config/docker/queue/Dockerfile b/config/docker/queue/Dockerfile index ea065b7..aadbd18 100644 --- a/config/docker/queue/Dockerfile +++ b/config/docker/queue/Dockerfile @@ -1,5 +1,8 @@ FROM jalendport/spark-php:8.3-cli +COPY ./run_queue.sh /app-tmp/run_queue.sh +RUN chmod a+x /app-tmp/run_queue.sh + ARG UID ARG GID @@ -16,4 +19,7 @@ RUN adduser -G spark --system -D -s /bin/sh -u ${UID} spark USER spark +# Prevents the queue from running until the database is ready +ENTRYPOINT [ "/app-tmp/run_queue.sh" ] + CMD ["php", "craft", "queue/listen", "--verbose"] diff --git a/config/docker/queue/run_queue.sh b/config/docker/queue/run_queue.sh new file mode 100644 index 0000000..c33ff4b --- /dev/null +++ b/config/docker/queue/run_queue.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +# Source the .env file +if [ -f .env ]; then + export $(grep -v '^#' .env | xargs) +fi + +echo "Waiting for the MySQL container to respond" +until eval "mysql -h $CRAFT_DB_SERVER -u $CRAFT_DB_USER -p$CRAFT_DB_PASSWORD $CRAFT_DB_DATABASE -e 'select 1' > /dev/null 2>&1" +do + sleep 1 +done + +echo "Waiting for vendor/autoload.php" +while [ ! -f "vendor/autoload.php" ] || [ ! -f "composer.lock" ] +do + sleep 1 +done + +echo "Waiting for Craft to be installed" +until eval "php craft install/check" +do + sleep 30 +done + +exec "$@" From 2c8a48375d713e97eff99abb865192cded98acbb Mon Sep 17 00:00:00 2001 From: Jalen Davenport Date: Fri, 26 Jul 2024 12:04:48 -0400 Subject: [PATCH 2/6] Rename config/build to config/frontend --- config/{build => frontend}/postcss.config.js | 2 +- config/{build => frontend}/tailwind-plugins/_helpers.js | 0 config/{build => frontend}/tailwind-plugins/fontSize.js | 0 config/{build => frontend}/tailwind-plugins/screens.js | 0 config/{build => frontend}/tailwind.config.js | 0 config/{build => frontend}/vite.config.js | 2 +- package.json | 6 +++--- 7 files changed, 5 insertions(+), 5 deletions(-) rename config/{build => frontend}/postcss.config.js (85%) rename config/{build => frontend}/tailwind-plugins/_helpers.js (100%) rename config/{build => frontend}/tailwind-plugins/fontSize.js (100%) rename config/{build => frontend}/tailwind-plugins/screens.js (100%) rename config/{build => frontend}/tailwind.config.js (100%) rename config/{build => frontend}/vite.config.js (97%) diff --git a/config/build/postcss.config.js b/config/frontend/postcss.config.js similarity index 85% rename from config/build/postcss.config.js rename to config/frontend/postcss.config.js index bf876b8..3df2206 100644 --- a/config/build/postcss.config.js +++ b/config/frontend/postcss.config.js @@ -9,7 +9,7 @@ export default { postcssImport(), postcssCustomSelectors(), tailwindcssNesting(), - tailwindcss({ config: "config/build/tailwind.config.js" }), + tailwindcss({ config: "config/frontend/tailwind.config.js" }), autoprefixer(), ], }; diff --git a/config/build/tailwind-plugins/_helpers.js b/config/frontend/tailwind-plugins/_helpers.js similarity index 100% rename from config/build/tailwind-plugins/_helpers.js rename to config/frontend/tailwind-plugins/_helpers.js diff --git a/config/build/tailwind-plugins/fontSize.js b/config/frontend/tailwind-plugins/fontSize.js similarity index 100% rename from config/build/tailwind-plugins/fontSize.js rename to config/frontend/tailwind-plugins/fontSize.js diff --git a/config/build/tailwind-plugins/screens.js b/config/frontend/tailwind-plugins/screens.js similarity index 100% rename from config/build/tailwind-plugins/screens.js rename to config/frontend/tailwind-plugins/screens.js diff --git a/config/build/tailwind.config.js b/config/frontend/tailwind.config.js similarity index 100% rename from config/build/tailwind.config.js rename to config/frontend/tailwind.config.js diff --git a/config/build/vite.config.js b/config/frontend/vite.config.js similarity index 97% rename from config/build/vite.config.js rename to config/frontend/vite.config.js index cf5bd5d..5e5577b 100644 --- a/config/build/vite.config.js +++ b/config/frontend/vite.config.js @@ -19,7 +19,7 @@ export default defineConfig(({ command, mode }) => { sourcemap: true, }, css: { - postcss: "config/build", + postcss: "config/frontend", }, plugins: [ compression({ diff --git a/package.json b/package.json index 35e15a0..efc7616 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,9 @@ "version": "0.0.0", "type": "module", "scripts": { - "dev": "vite --config ./config/build/vite.config.js", - "build": "vite build --config ./config/build/vite.config.js", - "preview": "vite preview --config ./config/build/vite.config.js" + "dev": "vite --config ./config/frontend/vite.config.js", + "build": "vite build --config ./config/frontend/vite.config.js", + "preview": "vite preview --config ./config/frontend/vite.config.js" }, "dependencies": { "vue": "^3.4.0" From b3915ee2307cd797181bf83f93da30f87aa0de4c Mon Sep 17 00:00:00 2001 From: Jalen Davenport Date: Fri, 26 Jul 2024 12:05:28 -0400 Subject: [PATCH 3/6] Move bootstrap.php to config/craft --- bootstrap.php => config/craft/bootstrap.php | 0 craft | 2 +- web/index.php | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename bootstrap.php => config/craft/bootstrap.php (100%) diff --git a/bootstrap.php b/config/craft/bootstrap.php similarity index 100% rename from bootstrap.php rename to config/craft/bootstrap.php diff --git a/craft b/craft index 547e508..846fca3 100644 --- a/craft +++ b/craft @@ -5,7 +5,7 @@ */ // Load shared bootstrap -require __DIR__ . '/bootstrap.php'; +require __DIR__ . '/config/craft/bootstrap.php'; // Load and run Craft /** @var craft\console\Application $app */ diff --git a/web/index.php b/web/index.php index 774c24f..816d132 100644 --- a/web/index.php +++ b/web/index.php @@ -4,7 +4,7 @@ */ // Load shared bootstrap -require dirname(__DIR__) . '/bootstrap.php'; +require dirname(__DIR__) . '/config/craft/bootstrap.php'; // Load and run Craft /** @var craft\web\Application $app */ From 79dfb3f9a167e7a8e900b3735e05f37b74a3e4da Mon Sep 17 00:00:00 2001 From: Jalen Davenport Date: Fri, 26 Jul 2024 12:07:17 -0400 Subject: [PATCH 4/6] Update fluid-tailwind to ^1.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index efc7616..64afc89 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "@vitejs/plugin-legacy": "^5.4.0", "@vitejs/plugin-vue": "^5.0.0", "autoprefixer": "^10.4.0", - "fluid-tailwind": "^0.3.0", + "fluid-tailwind": "^1.0.0", "postcss": "^8.4.0", "postcss-custom-selectors": "^7.1.0", "postcss-import": "^16.1.0", From 5897cab996b249b78f27eca1dcf786376f9707a3 Mon Sep 17 00:00:00 2001 From: Jalen Davenport Date: Mon, 29 Jul 2024 16:12:11 -0400 Subject: [PATCH 5/6] =?UTF-8?q?Add=20.prettierignore=20to=20prevent=20pret?= =?UTF-8?q?tier=20from=20breaking=20the=20changelog=20file=20formatting=20?= =?UTF-8?q?=F0=9F=99=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .prettierignore | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .prettierignore diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..81e1243 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,3 @@ +# Until https://github.com/prettier/prettier/pull/15526 is merged + +*.md From fae4e983b21255829260d6ff1deca0ac2da7c6d2 Mon Sep 17 00:00:00 2001 From: Jalen Davenport Date: Mon, 29 Jul 2024 16:12:25 -0400 Subject: [PATCH 6/6] Prepare 1.0.0-alpha.2 release --- CHANGELOG.md | 13 +++++++++++++ composer.json | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8e0162..45a2db5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,21 @@ [![Common Changelog](https://common-changelog.org/badge.svg)](https://common-changelog.org) +## [1.0.0-alpha.2] - 2024-07-29 + +### Changed + +- Update composer `post-create-project-cmd` script ([`968fe40`](https://github.com/jalendport/spark-craft/commit/968fe404472636d099b9bbfc0df05723b761b4f2)) +- Reorganize some folders and files ([`2c8a483`](https://github.com/jalendport/spark-craft/commit/2c8a48375d713e97eff99abb865192cded98acbb), [`b3915ee`](https://github.com/jalendport/spark-craft/commit/b3915ee2307cd797181bf83f93da30f87aa0de4c)) +- Bump fluid-tailwind to ^1.0.0 ([`79dfb3f`](https://github.com/jalendport/spark-craft/commit/79dfb3f9a167e7a8e900b3735e05f37b74a3e4da)) + +### Fixed + +- Prevent queue container from crashing if mysql container isn’t ready or Craft isn’t installed ([`968fe40`](https://github.com/jalendport/spark-craft/commit/968fe404472636d099b9bbfc0df05723b761b4f2)) + ## [1.0.0-alpha.1] - 2024-07-25 _Initial release_ +[1.0.0-alpha.2]: https://github.com/jalendport/spark-craft/releases/tag/1.0.0-alpha.2 [1.0.0-alpha.1]: https://github.com/jalendport/spark-craft/releases/tag/1.0.0-alpha.1 diff --git a/composer.json b/composer.json index 1bb86a1..642202f 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "jalendport/spark-craft", "description": "Craft CMS starter project", - "version": "1.0.0-alpha.1", + "version": "1.0.0-alpha.2", "type": "project", "keywords": [ "craft",