-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
100 lines (82 loc) · 2.63 KB
/
Copy pathjustfile
File metadata and controls
100 lines (82 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
@_default:
just --list --unsorted
@_formats: format-md format-r
@_checks: check-spelling check-urls check-commits
@_builds: build-contributors build-readme build-website
@_updates: update-from-template update-quarto-theme
# Run all recipes
run-all: install-deps _formats _checks _builds
# List all TODOs in the repository.
list-todos:
grep -R TODO . \
--exclude-dir=.vscode \
--exclude-dir=_book \
--exclude-dir=.quarto \
--exclude=justfile
# Install or update the pre-commit hooks
install-precommit:
# Install pre-commit hooks
uvx pre-commit install
# Run pre-commit hooks on all files
uvx pre-commit run --all-files
# Update versions of pre-commit hooks
uvx pre-commit autoupdate
# Install workshop's package dependencies
install-deps:
#!/usr/bin/Rscript
pak::pak(ask = FALSE)
# Update the Quarto rostools-theme extension
update-quarto-theme:
# Will also add if it isn't already installed.
quarto update rostools/rostools-theme --no-prompt
# Soft link so Revealjs slides can use the extension.
ln -s _extensions/ slides/
# Check spelling with typos
check-spelling:
uvx typos
# Check the commit messages on the current branch that are not on the main branch
check-commits:
#!/usr/bin/env bash
branch_name=$(git rev-parse --abbrev-ref HEAD)
number_of_commits=$(git rev-list --count HEAD ^main)
if [[ ${branch_name} != "main" && ${number_of_commits} -gt 0 ]]
then
# If issue happens, try `uv tool update-shell`
uvx --from commitizen cz check --rev-range main..HEAD
else
echo "On 'main' or current branch doesn't have any commits."
fi
# Install lychee from https://lychee.cli.rs/guides/getting-started/
# Check that URLs work with lychee
check-urls:
lychee . \
--verbose \
--extensions md,qmd \
--exclude-path "_badges.qmd"
# Format all R code
format-r: _format-r-styler _format-r-air
# Air is better, but doesn't style Qmd files yet.
@_format-r-air:
uvx --from air-formatter air format .
# Styler formats Quarto files
@_format-r-styler:
#!/usr/bin/Rscript
styler::style_dir()
# Format Markdown files
format-md:
uvx rumdl fmt --silent
# Build Quarto website
build-website:
quarto render
# Re-build the README file from the Quarto version
build-readme:
uvx --from quarto quarto render README.qmd --to gfm
# Generate a Quarto include file with the contributors
build-contributors:
sh ./tools/get-contributors.sh rostools/data-viz-intro > includes/_contributors.qmd
# Check for and apply updates from the template
update-from-template:
uvx copier update --trust --defaults
# Reset repo changes to match the template
reset-from-template:
uvx copier recopy --trust --defaults