@adamhl8/configs 2.7.0 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,18 +2,25 @@
2
2
  set unstable
3
3
  set allow-duplicate-recipes
4
4
 
5
+ print-command(cmd) := f"echo {{ quote(style("command", cmd)) }}"
5
6
  # runs cmd if the condition command succeeds, echoing cmd only when it runs
6
- run-when(cmd, condition) := f"if {{ condition }}; then echo {{ style("command", cmd) }}; {{ cmd }}; fi"
7
+ run-when(cmd, condition) := f"if {{ condition }}; then {{ print-command(cmd) }}; {{ cmd }}; fi"
8
+
9
+ in-ci := '[ -n "${CI:-}" ]'
10
+ not-in-ci := '[ -z "${CI:-}" ]'
11
+
12
+ # lists tracked and untracked files as NUL-separated paths, skipping gitignored ones
13
+ ls-files := 'git ls-files -z --cached --others --exclude-standard'
7
14
 
8
15
  # run if not in CI, the repo has a root module, and the aws profile exists on this machine
9
- tofu-run-condition := '[ -z "${CI:-}" ] && ls *.tofu >/dev/null 2>&1 && aws configure list-profiles 2>/dev/null | grep -qx adamhl8'
16
+ tofu-run-condition := not-in-ci + ' && ls *.tofu >/dev/null 2>&1 && aws configure list-profiles 2>/dev/null | grep -qx adamhl8'
10
17
 
11
18
  # public recipes are thin wrappers over private _recipes so an override can still call the original
12
19
  # e.g. `prepare: _prepare` + extra lines
13
20
 
14
21
  prepare: _prepare
15
22
  _prepare:
16
- @{{ run-when("lefthook install", '[ -z "${CI:-}" ]') }}
23
+ @{{ run-when("lefthook install", not-in-ci) }}
17
24
  bun adamhl8-gitignore
18
25
  bun adamhl8-bunfig
19
26
  bun oxfmt bunfig.toml
@@ -35,12 +42,25 @@ _lint:
35
42
  bun markdown-toc -i --bullets '-' --maxdepth 3 ./README.md
36
43
  bun oxlint --fix --fix-suggestions --fix-dangerously
37
44
  bun oxfmt
45
+
46
+ @# format all justfiles, excluding ones that are gitignored
47
+ @{{ ls-files }} ':(glob)**/[Jj]ustfile' ':(glob)**/.justfile' ':(glob)**/*.just' | xargs -0 -r -n1 just --fmt --justfile
48
+ @{{ print-command("just --fmt") }}
49
+
50
+ @# format all tofu files, excluding ones that are gitignored
51
+ @{{ ls-files }} ':(glob)**/*.tf' ':(glob)**/*.tofu' ':(glob)**/*.tfvars' ':(glob)**/*.tftest.hcl' ':(glob)**/*.tofutest.hcl' | xargs -0 -r tofu fmt
52
+ @{{ print-command("tofu fmt") }}
53
+
38
54
  bun knip-bun
55
+ @{{ run-when("actionlint", "[ -d .github/workflows ]") }}
39
56
  @just test
40
57
 
41
58
  build: _build
59
+ # lint fixes and formatting are applied in place, so in CI fail if the build changed or created any files
60
+ # --intent-to-add makes untracked files show up in the diff
42
61
  _build: lint && tofu-check
43
62
  @{{ run-when("bun tsdown", "[ -f tsdown.config.ts ]") }}
63
+ @{{ run-when("git add --intent-to-add --all && git diff --exit-code", in-ci) }}
44
64
 
45
65
  test: _test
46
66
  _test:
@@ -1,4 +1,5 @@
1
1
  pre-commit:
2
+ fail_on_changes: always
2
3
  commands:
3
4
  build:
4
5
  run: just build
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamhl8/configs",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
4
4
  "description": "My shared configs for TS projects",
5
5
  "homepage": "https://github.com/adamhl8/configs",
6
6
  "bugs": {
@@ -66,7 +66,7 @@
66
66
  "oxlint-tsgolint": "^7.0.2003",
67
67
  "publint": "^0.3.24",
68
68
  "release-it": "^21.1.0",
69
- "release-it-git-cliff": "^0.1.0",
69
+ "release-it-git-cliff": "^0.2.0",
70
70
  "tsdown": "^0.23.0",
71
71
  "typescript": "^7.0.2"
72
72
  },
@@ -86,6 +86,9 @@
86
86
  "typescript": "^7.0.0"
87
87
  },
88
88
  "peerDependenciesMeta": {
89
+ "@arethetypeswrong/core": {
90
+ "optional": true
91
+ },
89
92
  "publint": {
90
93
  "optional": true
91
94
  },