Skip to content

Commit

Permalink
Add just commands from job-server
Browse files Browse the repository at this point in the history
Some minor modifications made to fit Airlock folder structure
  • Loading branch information
tomodwyer authored and evansd committed Aug 23, 2024
1 parent 98e160e commit a7b10a8
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,59 @@ docs-serve *ARGS: devenv
docs-build *ARGS: devenv
"$BIN"/mkdocs build --clean {{ ARGS }}


# Remove built assets and node_modules
assets-clean:
rm -rf assets/out
rm -rf node_modules


# Install the Node.js dependencies
assets-install *args="":
#!/usr/bin/env bash
set -euo pipefail

# exit if lock file has not changed since we installed them. -nt == "newer than",
# but we negate with || to avoid error exit code
test package-lock.json -nt node_modules/.written || exit 0

npm ci {{ args }}
touch node_modules/.written


# Build the Node.js assets
assets-build:
#!/usr/bin/env bash
set -euo pipefail
# find files which are newer than dist/.written in the src directory. grep
# will exit with 1 if there are no files in the result. We negate this
# with || to avoid error exit code
# we wrap the find in an if in case dist/.written is missing so we don't
# trigger a failure prematurely
if test -f assets/out/.written; then
find assets/src -type f -newer assets/out/.written | grep -q . || exit 0
fi

npm run build
touch assets/out/.written


# Install npm toolchain, build and collect assets
assets: assets-install assets-build

# Rebuild all npm/static assets
assets-rebuild: assets-clean assets

# Run the npm development server and watch for changes
assets-run: assets-install
#!/usr/bin/env bash
set -euo pipefail
if [ "$ASSETS_DEV_MODE" == "False" ]; then
echo "Set ASSETS_DEV_MODE to a truthy value to run this command"
exit 1
fi

npm run dev

0 comments on commit a7b10a8

Please sign in to comment.