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 committed Aug 22, 2024
1 parent 43a91ca commit 67af3db
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,65 @@ docs-serve *ARGS: devenv
docs-build *ARGS: devenv
"$BIN"/mkdocs build --clean {{ ARGS }}


# Remove built assets and node_modules
[group('assets')]
assets-clean:
rm -rf assets/dist/out
rm -rf node_modules


# Install the Node.js dependencies
[group('assets')]
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
[group('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/dist/out/.written; then
find assets/src -type f -newer assets/dist/out/.written | grep -q . || exit 0
fi

npm run build
touch assets/dist/out/.written


# Install npm toolchain, build and collect assets
[group('assets')]
assets: assets-install assets-build

# Rebuild all npm/static assets
[group('assets')]
assets-rebuild: assets-clean assets

# Run the npm development server and watch for changes
[group('assets')]
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 67af3db

Please sign in to comment.