oliverdavies.uk/website/run

70 lines
1.2 KiB
Plaintext
Raw Normal View History

2021-10-24 01:00:23 +00:00
#!/bin/bash
set -eux
2021-10-24 01:00:23 +00:00
TTY=""
if [[ ! -t 1 ]]; then
TTY="-T"
fi
DC="${DC:-exec}"
2021-10-24 01:00:23 +00:00
function cmd {
# Run any command in the app container.
_dc app "${@}"
}
function composer {
DC=run
_dc --entrypoint composer app "${@}"
}
2021-10-24 01:00:23 +00:00
function help {
printf "%s <task> [args]\n\nTasks:\n" "${0}"
compgen -A function | grep -v "^_" | cat -n
printf "\nExtended help:\n Each task has comments for general usage\n"
}
function sh {
DC=run
_dc --entrypoint sh app
}
function test:quality {
DC=run
_dc --entrypoint phpstan app "${@}" analyze --memory-limit=-1
}
function test:unit {
DC=run
_dc --entrypoint phpunit app "${@}"
}
function yarn:build:css {
# Build CSS assets, this is meant to be run from within the assets container.
local args=()
if [ "${SCULPIN_ENV}" == "prod" ]; then
args=(--minify)
elif [ "${NODE_ENV}" == "development" ]; then
args=(--watch)
fi
tailwindcss --postcss \
-i css/tailwind.pcss \
2022-08-13 11:32:33 +00:00
-o /app/build/app.css "${args[@]}"
}
function yarn:build:js {
# Build JS assets, this is meant to be run from within the assets container.
node esbuild.config.js
}
2021-10-24 01:00:23 +00:00
function _dc {
docker-compose ${DC} ${TTY} "${@}"
2021-10-24 01:00:23 +00:00
}
eval "${@:-help}"