mirror of
https://github.com/opdavies/build-configs.git
synced 2025-01-23 18:37:32 +00:00
125 lines
2.6 KiB
Twig
125 lines
2.6 KiB
Twig
# {{ managedText | raw }}
|
|
|
|
{% set isFlake = flake is defined %}
|
|
|
|
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 %}
|
|
|
|
test-watch *args:
|
|
nodemon --ext "*" --watch "." --exec "just test {{ args }} || exit 1" --ignore */sites/simpletest
|
|
{% 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:
|
|
{% if isFlake %}
|
|
{{ "just _exec yarn {{ args }}" | raw }}
|
|
{% else %}
|
|
{{ "just _exec node yarn {{ args }}" | raw }}
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
{% if "fractal" is same as type %}
|
|
fractal *args:
|
|
{{ "just yarn fractal {{ args }}" | raw }}
|
|
|
|
clean:
|
|
rm -fr build
|
|
|
|
build *args:
|
|
{{ "just fractal build {{ args }}" | raw }}
|
|
|
|
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:
|
|
{% if flake is defined %}
|
|
{{ "nix develop --command {{ args }}" | raw }}
|
|
{% else %}
|
|
{{ "docker compose exec -T {{ args }}" | raw }}
|
|
{% endif %}
|
|
|
|
{% if flake is not defined %}
|
|
_run service command *args:
|
|
docker compose run \
|
|
--entrypoint {{ "{{ command }}"|raw }} \
|
|
--no-deps \
|
|
--rm \
|
|
-T \
|
|
{{ "{{ service }} {{ args }}"|raw }}
|
|
{% endif %}
|
|
|
|
# vim: ft=just
|