-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve local dev DX by using
just
(#501)
* Replace the `Makefile` with a `justfile` * Update CI jobs to use it * Update `CONTRIBUTING.md` * Bump `pip` deps
- Loading branch information
1 parent
178fc15
commit 8c7e9ac
Showing
7 changed files
with
173 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# Configuration | ||
|
||
OUTPUT_DIR := './site' | ||
|
||
# Binaries | ||
# Scoped to the justfile so do not need to be exported | ||
|
||
MKDOCS := './.venv/bin/mkdocs' | ||
PIP := './.venv/bin/pip3' | ||
PIP_COMPILE := './.venv/bin/pip-compile' | ||
|
||
# Needs to be exported so that the `spec` component can pick up on the customized $CRYSTAL env var. | ||
|
||
export CRYSTAL := 'crystal' | ||
|
||
# Ensure when MkDocs is generating the docs for each component it's able to find their shard dependencies | ||
# via the monorepo's `lib/` dir versus `src/components/<name>/lib` which doesn't exist. | ||
|
||
export CRYSTAL_PATH := (invocation_directory_native() / ('lib' + if os() == 'windows' { ';' } else { ':' })) + shell('$1 env CRYSTAL_PATH', CRYSTAL) | ||
|
||
_default: | ||
@just --list --unsorted | ||
|
||
# Installs dev dependencies | ||
[group('dev')] | ||
install: | ||
SHARDS_OVERRIDE=shard.dev.yml shards update | ||
|
||
# Runs and watches for changes to the main entrypoint file of the provided `component` | ||
[group('dev')] | ||
watch component: | ||
watchexec --restart --watch=src/ --emit-events-to=none --clear -- {{ CRYSTAL }} run src/components/{{ component }}/src/{{ if component == 'framework' { 'athena' } else { 'athena-' + component } }}.cr | ||
|
||
# Runs the test suite of the provided `component`, or `all` for all components, and watches for changes | ||
[group('dev')] | ||
watch-test component: | ||
watchexec --restart --watch=src/ --emit-events-to=none --clear -- {{ CRYSTAL }} spec src/components/{{ component }}/ | ||
|
||
# Runs the test suite of the provided `component`, defaulting to `all` components | ||
[group('dev')] | ||
test component='all': | ||
./scripts/test.sh {{ component }} | ||
|
||
# Runs the unit test suite of the provided `component`, defaulting to `all` components | ||
[group('dev')] | ||
test-unit component='all': | ||
./scripts/test.sh {{ component }} unit | ||
|
||
# Runs the compiled test suite of the provided `component`, defaulting to `all` components | ||
[group('dev')] | ||
test-compiled component='all': | ||
./scripts/test.sh {{ component }} compiled | ||
|
||
# Runs all check related tasks | ||
[group('check')] | ||
lint: spellcheck format ameba | ||
|
||
# Runs the Crystal formatter | ||
[group('check')] | ||
format: | ||
{{ CRYSTAL }} tool format | ||
|
||
# Runs the Crystal formatter, fixing any issues | ||
[group('check')] | ||
format-fix: | ||
{{ CRYSTAL }} tool format --fix | ||
|
||
# Runs `Ameba` static analysis | ||
[group('check')] | ||
ameba: | ||
./bin/ameba | ||
|
||
# Runs `typos` spellchecker | ||
[group('check')] | ||
spellcheck: | ||
typos | ||
|
||
# Build the docs | ||
[group('docs')] | ||
build-docs: _mkdocs | ||
{{ MKDOCS }} build -d {{ OUTPUT_DIR }} | ||
|
||
# Serve live-preview of the docs | ||
[group('docs')] | ||
serve-docs: _mkdocs | ||
{{ MKDOCS }} serve --open | ||
|
||
# Clean MKDocs build artifacts | ||
[group('docs')] | ||
clean-docs: | ||
rm -rf {{ OUTPUT_DIR }} | ||
find src/components -type d -name "site" -exec rm -rf {} + | ||
|
||
# Upgrade python deps | ||
[group('administrative')] | ||
upgrade: _pip | ||
{{ PIP_COMPILE }} -U requirements.in | ||
|
||
# Clean build artifacts (.venv), and docs | ||
[group('administrative')] | ||
clean: clean-docs | ||
rm -rf .venv | ||
|
||
_pip: | ||
python3 -m venv .venv | ||
{{ PIP }} install -q pip-tools | ||
|
||
_mkdocs: _pip | ||
{{ PIP }} install -q -r requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters