|
1 | 1 | @_default: |
2 | | - just --list --unsorted |
3 | | - |
4 | | -@_checks: check-spelling check-urls check-commits |
5 | | - |
6 | | -# Test Seedcase and non-Seedcase projects |
7 | | -@_tests: (test "true" "netlify") (test "false" "netlify") (test "true" "gh-pages") (test "false" "gh-pages") |
8 | | - |
9 | | -@_builds: build-contributors build-website build-readme |
| 2 | + just --list --unsorted |
10 | 3 |
|
11 | 4 | # Run all build-related recipes in the justfile |
12 | | -run-all: update-quarto-theme update-template _checks format-md _tests _builds |
| 5 | +run-all: update-quarto-theme sync-template-files check-all format-md test-all build-all |
| 6 | + |
| 7 | +# List all TODO items in the repository |
| 8 | +list-todos: |
| 9 | + grep -R -n \ |
| 10 | + --exclude-dir=.quarto \ |
| 11 | + --exclude-dir=template \ |
| 12 | + --exclude-dir=_temp \ |
| 13 | + --exclude-dir=_site \ |
| 14 | + --exclude=justfile \ |
| 15 | + --exclude=copier.yaml \ |
| 16 | + "TODO" * |
13 | 17 |
|
14 | 18 | # Install the pre-commit hooks |
15 | 19 | install-precommit: |
16 | | - # Install pre-commit hooks |
17 | | - uvx pre-commit install |
18 | | - # Run pre-commit hooks on all files |
19 | | - uvx pre-commit run --all-files |
20 | | - # Update versions of pre-commit hooks |
21 | | - uvx pre-commit autoupdate |
22 | | - |
23 | | -# Update the Quarto seedcase-theme extension |
| 20 | + uvx pre-commit install |
| 21 | + uvx pre-commit autoupdate |
| 22 | + uvx pre-commit run --all-files |
| 23 | + |
| 24 | +# Update (or add if not present) the Quarto seedcase-theme extension |
24 | 25 | update-quarto-theme: |
25 | | - # Add theme if it doesn't exist, update if it does |
26 | | - quarto update seedcase-project/seedcase-theme --no-prompt |
27 | | - |
28 | | -# Update files in the template from the copier parent folder |
29 | | -update-template: |
30 | | - cp CODE_OF_CONDUCT.md .pre-commit-config.yaml .typos.toml .editorconfig .rumdl.toml template/ |
31 | | - mkdir -p template/tools |
32 | | - cp tools/get-contributors.sh template/tools/ |
33 | | - cp .github/pull_request_template.md template/.github/ |
34 | | - cp .github/workflows/dependency-review.yml template/.github/workflows/ |
35 | | - |
36 | | -# Check the commit messages on the current branch that are not on the main branch |
37 | | -check-commits: |
38 | | - #!/usr/bin/env bash |
39 | | - branch_name=$(git rev-parse --abbrev-ref HEAD) |
40 | | - number_of_commits=$(git rev-list --count HEAD ^main) |
41 | | - if [[ ${branch_name} != "main" && ${number_of_commits} -gt 0 ]] |
42 | | - then |
43 | | - # If issue happens, try `uv tool update-shell` |
44 | | - uvx --from commitizen cz check --rev-range main..HEAD |
45 | | - else |
46 | | - echo "On 'main' or current branch doesn't have any commits." |
47 | | - fi |
48 | | -
|
49 | | -# Install lychee from https://lychee.cli.rs/guides/getting-started/ |
| 26 | + quarto update seedcase-project/seedcase-theme --no-prompt |
50 | 27 |
|
51 | | -# Check that URLs work |
52 | | -check-urls: |
53 | | - lychee . \ |
54 | | - --verbose \ |
55 | | - --extensions md,qmd,jinja \ |
56 | | - --exclude-path "_badges.qmd" |
| 28 | +# Update files in the template from the Copier parent folder |
| 29 | +sync-template-files: |
| 30 | + cp CODE_OF_CONDUCT.md .pre-commit-config.yaml .typos.toml .editorconfig .rumdl.toml template/ |
| 31 | + mkdir -p template/tools |
| 32 | + cp tools/get-contributors.sh template/tools/ |
| 33 | + cp .github/pull_request_template.md template/.github/ |
57 | 34 |
|
58 | 35 | # Check for spelling errors in files |
59 | 36 | check-spelling: |
60 | | - uvx typos |
| 37 | + uvx typos |
| 38 | + |
| 39 | +# Check that URLs work |
| 40 | +check-urls: |
| 41 | + lychee . \ |
| 42 | + --verbose \ |
| 43 | + --extensions md,qmd,jinja \ |
| 44 | + --exclude-path "_badges.qmd" |
| 45 | + |
| 46 | +# Run all check-related recipes |
| 47 | +check-all: check-spelling check-urls |
61 | 48 |
|
62 | 49 | # Format Markdown files |
63 | 50 | format-md: |
64 | | - uvx rumdl fmt --silent |
| 51 | + uvx rumdl fmt --silent |
| 52 | + # includes option doesn't work with Jinja files, so do manually |
| 53 | + uvx rumdl fmt --silent **/*.qmd.jinja **/*.md.jinja |
65 | 54 |
|
66 | | -# Test that a Python package can be created from the template, with parameters for: `is_seedcase_project` (true or false) and `hosting_provider` (either "gh-pages" or "netlify") |
| 55 | +# Test template creation with specific parameters: LIST |
67 | 56 | test is_seedcase_project="true" hosting_provider="netlify": |
68 | 57 | sh ./test-template.sh {{ is_seedcase_project }} {{ hosting_provider }} |
69 | 58 |
|
70 | | -# Test template with the manual questionnaire answers |
| 59 | +# Test template creation through use of the question approach |
71 | 60 | test-manual: |
72 | | - mkdir -p _temp/manual |
73 | | - uvx copier copy --trust -r HEAD . _temp/manual/test-template |
| 61 | + mkdir -p _temp/manual |
| 62 | + rm -rf _temp/manual/test-template |
| 63 | + uvx copier copy -r HEAD . _temp/manual/test-template |
| 64 | + |
| 65 | +# Run all test-related recipes |
| 66 | +test-all: (test "true" "netlify") (test "false" "netlify") (test "true" "gh-pages") (test "false" "gh-pages") |
74 | 67 |
|
75 | 68 | # Clean up any leftover and temporary build files |
76 | 69 | cleanup: |
77 | | - rm -rf _temp |
78 | | - |
79 | | -# Build the website using Quarto |
80 | | -build-website: |
81 | | - uvx --from quarto quarto render |
| 70 | + rm -rf _temp |
82 | 71 |
|
83 | 72 | # Re-build the README file from the Quarto version |
84 | 73 | build-readme: |
85 | | - uvx --from quarto quarto render README.qmd --to gfm |
| 74 | + uvx --from quarto quarto render README.qmd --to gfm |
86 | 75 |
|
87 | 76 | # Generate a Quarto include file with the contributors |
88 | 77 | build-contributors: |
89 | | - sh ./tools/get-contributors.sh seedcase-project/template-python-project > docs/includes/_contributors.qmd |
| 78 | + sh ./tools/get-contributors.sh seedcase-project/template-python-package > docs/includes/_contributors.qmd |
| 79 | + |
| 80 | +# Build the website using Quarto |
| 81 | +build-website: |
| 82 | + uvx --from quarto quarto render |
| 83 | + |
| 84 | +# Preview the website with automatic reload on changes |
| 85 | +preview-website: |
| 86 | + quarto preview |
| 87 | + |
| 88 | +# Run all build-related recipes |
| 89 | +build-all: build-contributors build-website build-readme |
| 90 | + |
| 91 | +# Check for and apply updates from the template |
| 92 | +update-from-template: |
| 93 | + uvx copier update --defaults |
| 94 | + |
| 95 | +# Reset repo changes to match the template |
| 96 | +reset-from-template: |
| 97 | + uvx copier recopy --defaults |
0 commit comments