-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.justfile
118 lines (90 loc) · 3.13 KB
/
.justfile
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# SPDX-FileCopyrightText: 2022-2024 Temple University <[email protected]>
# SPDX-License-Identifier: GPL-3.0-or-later
###: <https://just.systems/man/en/>
## Global constants
prj-root := justfile_directory()
# FIXME: not yet released -- probably will be v1.30.0
# today := datetime('%F')
## OS commands
open := if os_family() == "linux" { "xdg-open" } else { "open" }
## Project owner metadata
owner-name := 'Temple University'
owner-email := '[email protected]'
owner-attr := owner-name + ' <' + owner-email + '>'
## Project metadata
prj-slug := env('KWG_PROJECT_SLUG')
prj-title := env('KWG_PROJECT_TITLE')
# Display a list of available tasks as the default command
default:
@just --choose
# {{{ Release Management:
[group: "releases"]
[doc: "Release a release"]
release *ARGS='--auto':
cog bump {{ARGS}}
[group: "releases"]
test-release *ARGS='--auto':
cog bump --dry-run {{ARGS}}
# }}}
# {{{ Checkers, Fixers, Formatters, and Linters
[group: "qa"]
[doc: "Check for any lint or formatting issues on project files"]
check:
-biome check {{prj-root}}
-composer lint
[group: "qa"]
[doc: "Check for (non-stylistic) linting issues on project files"]
lint:
-biome lint {{prj-root}}
-composer lint
[group: "qa"]
[doc: "Write *all* formatter+fixer changes to project files"]
fix:
biome check --apply {{prj-root}}
composer fix
[group: "qa"]
[doc: "Write _safe_ formatter changes to project files"]
fmt:
biome format --write {{prj-root}}
composer ecs -- --fix
# }}}
[group: "php"]
[doc: "Rebuild the Phpactor project index"]
reindex:
phpactor index:build --reset
_stub-add path base target:
jq --arg stub {{join(base, path)}} \
'."indexer.stub_paths" += [$stub]' \
{{target}} \
| sponge {{target}}
[group: "php"]
[doc: "Generate PHP stubs for files in the given directory"]
stubify src:
nix run .\#php-stubs-generator -- \
--out={{ join(prj-root, "packages", file_stem(src) + "-stubs", file_stem(src) + ".stubs.php") }} \
{{src}}
[group: "php"]
[doc: "Add the specified PHP stub paths to config files"]
stub-add path: (_stub-add path prj-root ".phpactor.json") (_stub-add path "/path/to/project" ".phpactor.json.example")
###: LICENSING =====================================================================================
alias l-default := l-gpl
[group: "licensing"]
[doc: "Annotate all plaintext note files with the documentation license"]
l-docs:
fd --glob '**/*.{md,mdx,markdown,org}' -X \
just l-cc {}
[group: "licensing"]
_annotate license +FILES:
reuse annotate -l '{{license}}' -c '{{owner-attr}}' --template=compact --skip-existing {{FILES}}
[group: "licensing"]
[doc: "License the specified files as GPL-3.0-or-later"]
l-gpl +FILES: (_annotate 'GPL-3.0-or-later' FILES)
[group: "licensing"]
[doc: "Dual-license the specified files as GPL/MIT"]
l-dual colicensor +FILES: (_annotate 'GPL-3.0-or-later AND MIT' ('-c ' + quote(colicensor) + ' ' + FILES))
[group: "licensing"]
[doc: "License the specified files as non-commercial docs"]
l-cc +FILES: (_annotate 'CC-BY-NC-SA-4.0' FILES)
[group: "licensing"]
[doc: "Release the specified files into the public domain"]
l-public-domain +FILES: (_annotate 'CC0-1.0' FILES)