-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathjustfile
More file actions
68 lines (52 loc) · 1.27 KB
/
justfile
File metadata and controls
68 lines (52 loc) · 1.27 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
git_temp_patch := ".precommit.patch"
_default:
just -l
# run this first to setup local development
setup:
#!/usr/bin/env bash
set -euo pipefail
npm install
create_hook() {
echo "#!/usr/bin/env bash" > ".git/hooks/${1}"
echo "${2}" >> ".git/hooks/${1}"
chmod +x ".git/hooks/${1}"
}
if [ -z "${CI:-}" ]; then
echo "setting up git hooks..."
create_hook "pre-commit" "just _git-pre-commit"
fi
# run the local dev server
dev *args:
npm run dev -- {{args}}
# run the tests in watch mode
test *args:
npm run tests -- --watch {{args}}
# run all checks once
checks:
npm run checks
bump +type: checks
npm version "{{ type }}" --message "v%s" --force
renderer:
cd renderer && npm start
_pre_commit_start:
#!/usr/bin/env bash
set -uo pipefail
git diff --exit-code >/dev/null
needs_save=$?
set -e
if [ $needs_save -ne 0 ]; then
# FIXME: do not clobber existing patch file!
git diff > "{{git_temp_patch}}"
git apply --reverse "{{git_temp_patch}}"
fi
npm run format
git add --update .
_pre_commit_clean:
#!/usr/bin/env bash
set -euo pipefail
if [ -f "{{git_temp_patch}}" ]; then
git apply "{{git_temp_patch}}"
rm "{{git_temp_patch}}"
fi
_git-pre-commit: _pre_commit_start && _pre_commit_clean
npm run checks