build-configs/templates/justfile.twig

110 lines
2.2 KiB
Twig

# {{ managedText | raw }}
default:
@just --list
# Start the project
start:
cp -v --no-clobber .env.example .env
docker compose up -d
# Stop the project
stop:
docker compose down
{% if "php" is same as language %}
composer *args:
{{ "just _exec php composer {{ args }}" | raw }}
alias phpunit := test
test *args:
{% if "drupal-project" is same as type %}
{{ "just _exec php phpunit --colors=always {{ args }}" | raw }}
{% else %}
{{ "just _run php phpunit --colors=always {{ args }}" | raw }}
{% endif %}
{% endif %}
{% if "drupal-project" is same as type %}
drush *args:
{{ "just _exec php drush {{ args }}" | raw }}
install *args:
{{ "just _exec php drush site:install -y {{ args }}" | raw }}
{% endif %}
{% if "node" is same as language %}
yarn *args:
{{ "just _exec node yarn {{ args }}" | raw }}
{% endif %}
{% if "fractal" is same as type %}
fractal *args:
{{ "just yarn fractal {{ args }}" | raw }}
clean:
rm -fr build
build *args:
just fractal build {{ args }}
sync: clean build
#!/usr/bin/env bash
set -eux
aws s3 sync "build/." s3://"${BUCKET_NAME}" \
--acl "public-read" \
--cache-control max-age=3600
{% endif %}
{% if "laravel" is same as type %}
artisan *args:
{{ "just _run artisan {{ args }}" | raw }}
{% endif %}
{% if experimental.runGitHooksBeforePush %}
# Enable or disable Git hooks
git-hooks command:
#!/usr/bin/env bash
set -euo pipefail
case "{{ '{{ command }}'|raw }}" in
"on")
echo "Enabling Git hooks..."
git config core.hooksPath .githooks
;;
"off")
echo "Disabling Git hooks..."
git config --unset core.hooksPath
;;
*)
echo "Error: Invalid argument. Must be either 'on' or 'off'"
;;
esac
test-commit:
{% if "phpcs" in php|keys -%}
just _run php phpcs
{%- endif %}
{% if "phpstan" in php|keys -%}
just _run php phpstan analyze --no-progress --memory-limit=512M
{%- endif %}
just test --testdox --testsuite unit
just test --testdox --testsuite kernel
{% endif %}
_exec +args:
{{ "docker compose exec {{ args }}" | raw }}
_run service command *args:
docker compose run \
--entrypoint {{ "{{ command }}"|raw }} \
--no-deps \
--rm \
-T \
{{ "{{ service }} {{ args }}"|raw }}
# vim: ft=just