@adamhl8/configs 2.6.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.
@@ -1,20 +1,26 @@
1
1
  # user-defined functions are unstable as of just 1.52
2
2
  set unstable
3
- set default-list
4
3
  set allow-duplicate-recipes
5
4
 
5
+ print-command(cmd) := f"echo {{ quote(style("command", cmd)) }}"
6
6
  # runs cmd if the condition command succeeds, echoing cmd only when it runs
7
- 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'
8
14
 
9
15
  # run if not in CI, the repo has a root module, and the aws profile exists on this machine
10
- 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'
11
17
 
12
18
  # public recipes are thin wrappers over private _recipes so an override can still call the original
13
19
  # e.g. `prepare: _prepare` + extra lines
14
20
 
15
21
  prepare: _prepare
16
22
  _prepare:
17
- @{{ run-when("lefthook install", '[ -z "${CI:-}" ]') }}
23
+ @{{ run-when("lefthook install", not-in-ci) }}
18
24
  bun adamhl8-gitignore
19
25
  bun adamhl8-bunfig
20
26
  bun oxfmt bunfig.toml
@@ -36,12 +42,25 @@ _lint:
36
42
  bun markdown-toc -i --bullets '-' --maxdepth 3 ./README.md
37
43
  bun oxlint --fix --fix-suggestions --fix-dangerously
38
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
+
39
54
  bun knip-bun
55
+ @{{ run-when("actionlint", "[ -d .github/workflows ]") }}
40
56
  @just test
41
57
 
42
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
43
61
  _build: lint && tofu-check
44
62
  @{{ run-when("bun tsdown", "[ -f tsdown.config.ts ]") }}
63
+ @{{ run-when("git add --intent-to-add --all && git diff --exit-code", in-ci) }}
45
64
 
46
65
  test: _test
47
66
  _test:
@@ -56,3 +75,13 @@ release-run: _release-run
56
75
 
57
76
  _release-run:
58
77
  bun release-it -VV --ci
78
+
79
+ commit-types: _commit-types
80
+ _commit-types:
81
+ @bun commitlint --print-config json | bun -e 'console.log("Commit types:\n " + (await Bun.stdin.json()).rules["type-enum"][2].join("\n "))'
82
+
83
+ [default]
84
+ _default:
85
+ @{{ just_executable() }} --list
86
+ @echo
87
+ @{{ just_executable() }} commit-types
@@ -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.6.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
  },