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 diff --git a/CHANGELOG.md b/CHANGELOG.md index d8e0162..45a2db5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,21 @@ [](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 ae58114..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", @@ -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/bootstrap.php b/config/craft/bootstrap.php similarity index 100% rename from bootstrap.php rename to config/craft/bootstrap.php 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 "$@" 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/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/package.json b/package.json index 35e15a0..64afc89 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" @@ -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", 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 */