-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(prj): add justfile with maintenance helpers
Copied and pasted from another project. Mainly because I don't remember how to do a proper GitHub release! So when I figure it out again, I can save it.
- Loading branch information
Showing
5 changed files
with
107 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# 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 | ||
|
||
[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) |
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