Skip to content

Commit bb12707

Browse files
committed
feat: migrate to gunsmith, lazy-load commands, modernize dependencies
Changes: - switch CLI framework to gunsmith 0.6.0: short aliases (-a), shell completions, -h/-v, json feature disabled, color handled end-to-end - defer repository resolution, loader child spawn, and script imports into command handlers so bare/help/version invocations run instantly - adopt gunsmith soft exit: serve() exit code via process.exitCode, child exit mirrored without process.exit, run errors use exitCode idiom - await script.run and REPL lifetime in handlers; widen Script.run return type to void | Promise<void> - migrate globals and examples/shell.ts to execa 9 (verbose "short", pipe API); REPL history via getGlobalCachePath (env-paths 4 rejects scoped names) - repair examples/tsconfig.json (stale absolute paths, missing target/moduleResolution) and switch root tsconfig to moduleResolution bundler - upgrade deps: glob 13, @inquirer/prompts 8, ava 8, TypeScript 6, husky 9 (new hook format, pnpm in pre-commit), commitlint 21, lint-staged 17, sinon 22, semantic-release 25, pkgroll 2.27; audit 13 vulns -> 0 - raise engines to node >=22 and build target to node22
1 parent 0c7a59f commit bb12707

14 files changed

Lines changed: 2904 additions & 2856 deletions

File tree

.husky/commit-msg

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#!/usr/bin/env sh
2-
. "$(dirname -- "$0")/_/husky.sh"
3-
41
NODE_OPTIONS='--import=tsx --no-warnings' npx --no-install commitlint --edit "$1"

.husky/pre-commit

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
#!/usr/bin/env sh
2-
. "$(dirname -- "$0")/_/husky.sh"
3-
4-
yarn test
1+
pnpm test
52
npx lint-staged

examples/shell.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
11
import "auto";
2-
import { ExecaChildProcess } from "execa";
32

43
export default auto({
54
id: "shell",
65
title: "Shell-like usage",
76
run: async ({ project }) => {
87
cd(project.rootDirectory);
98

10-
console.log((await execa("cat", ["package.json"]).pipeStdout?.(execa("grep", ["license"])))?.stdout);
9+
console.log((await execa("cat", ["package.json"]).pipe("grep", ["license"])).stdout);
1110

1211
const whoami = await $`whoami`;
13-
await $`echo "Hello, ${whoami}"`.pipeStdout?.(process.stdout);
12+
await $({ stdout: ["pipe", "inherit"] })`echo "Hello, ${whoami}"`;
1413

1514
console.log(
1615
(
1716
await Promise.all(
1817
[
1918
async () => {
2019
await sleep(100);
21-
return $`echo "1"`.pipeStdout?.(process.stdout);
20+
return $({ stdout: ["pipe", "inherit"] })`echo "1"`;
2221
},
2322
async () => {
2423
await sleep(200);
25-
return $`echo "2"`.pipeStdout?.(process.stdout);
24+
return $({ stdout: ["pipe", "inherit"] })`echo "2"`;
2625
},
2726
].map((f) => f())
2827
)

examples/tsconfig.json

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
/* This file should be auto-generated, don't copy-paste this. */
21
{
32
"compilerOptions": {
43
"strict": true,
5-
"lib": [],
4+
"target": "es2022",
5+
"lib": ["es2022"],
6+
"module": "esnext",
7+
"moduleResolution": "bundler",
68
"jsx": "react-jsx",
7-
"baseUrl": ".",
8-
"typeRoots": [
9-
"/home/user/.npm/.../globals" /* auto-generated */
10-
],
9+
"types": ["node"],
1110
"paths": {
12-
"auto": [
13-
"/home/user/.npm/.../globals" /* auto-generated */
14-
]
11+
"auto": ["../dist/globals/index.d.ts"]
1512
}
16-
}
13+
},
14+
"exclude": ["generate-react-component"]
1715
}

package.json

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -34,32 +34,31 @@
3434
"auto": "./dist/main.js"
3535
},
3636
"engines": {
37-
"node": ">= 18.0.0"
37+
"node": ">=22"
3838
},
3939
"scripts": {
4040
"dev": "pnpm test:watch",
4141
"build:watch": "pkgroll --watch",
42-
"build": "pnpm run clean && pkgroll --target=node18",
42+
"build": "pnpm run clean && pkgroll --target=node22",
4343
"test": "NODE_OPTIONS='--import=tsx --no-warnings' ava",
4444
"test:watch": "NODE_OPTIONS='--import=tsx --no-warnings' ava --watch",
4545
"e2e": "docker run --rm -it $(docker build -f src/e2e/Dockerfile -q .)",
4646
"tsc": "tsc",
47-
"prepare": "husky install",
47+
"prepare": "husky",
4848
"prepublishOnly": "pnpm run build && pnpm run tsc && pnpm run test",
4949
"clean": "rm -rf dist"
5050
},
5151
"ava": {
52-
"extensions": {
53-
"ts": "commonjs"
54-
}
52+
"extensions": [
53+
"ts"
54+
]
5555
},
5656
"lint-staged": {
5757
"*": "prettier --ignore-unknown --write"
5858
},
5959
"prettier": {
6060
"arrowParens": "always",
6161
"bracketSpacing": true,
62-
"jsxBracketSameLine": false,
6362
"printWidth": 120,
6463
"quoteProps": "as-needed",
6564
"semi": true,
@@ -69,37 +68,38 @@
6968
"useTabs": false
7069
},
7170
"devDependencies": {
72-
"@commitlint/cli": "^18.4.4",
73-
"@commitlint/config-conventional": "^18.4.4",
71+
"@commitlint/cli": "^21.2.0",
72+
"@commitlint/config-conventional": "^21.2.0",
7473
"@semantic-release/changelog": "^6.0.3",
7574
"@semantic-release/git": "^10.0.1",
76-
"@types/node": "^20.11.5",
77-
"@types/sinon": "^17.0.3",
78-
"ava": "^6.0.1",
79-
"husky": "^8.0.3",
80-
"lint-staged": "^15.2.0",
81-
"pkgroll": "^2.0.1",
82-
"prettier": "^3.2.4",
83-
"semantic-release": "^23.0.0",
84-
"sinon": "^17.0.1",
85-
"typescript": "^5.3.3"
75+
"@types/node": "^22.20.0",
76+
"@types/sinon": "^22.0.0",
77+
"ava": "^8.0.1",
78+
"husky": "^9.1.7",
79+
"lint-staged": "^17.0.8",
80+
"pkgroll": "^2.27.1",
81+
"prettier": "^3.9.4",
82+
"semantic-release": "^25.0.5",
83+
"sinon": "^22.0.0",
84+
"typescript": "^6.0.3"
8685
},
8786
"dependencies": {
88-
"@inquirer/prompts": "^3.3.0",
87+
"@inquirer/prompts": "^8.5.2",
8988
"@types/cross-spawn": "^6.0.6",
9089
"@types/fs-extra": "^11.0.4",
91-
"@types/lodash": "^4.14.202",
92-
"@types/which": "^3.0.3",
93-
"chalk": "^5.3.0",
94-
"cleye": "^1.3.2",
95-
"cross-spawn": "^7.0.3",
96-
"env-paths": "^3.0.0",
97-
"execa": "^8.0.1",
98-
"find-up": "^7.0.0",
99-
"fs-extra": "^11.2.0",
100-
"glob": "^10.3.10",
101-
"lodash": "^4.17.21",
102-
"tsx": "^4.7.0",
103-
"which": "^4.0.0"
90+
"@types/lodash": "^4.17.24",
91+
"@types/which": "^3.0.4",
92+
"chalk": "^5.6.2",
93+
"cross-spawn": "^7.0.6",
94+
"env-paths": "^4.0.0",
95+
"execa": "^9.6.1",
96+
"find-up": "^8.0.0",
97+
"fs-extra": "^11.3.6",
98+
"glob": "^13.0.6",
99+
"gunsmith": "^0.6.0",
100+
"lodash": "^4.18.1",
101+
"tsx": "^4.23.0",
102+
"which": "^4.0.0",
103+
"zod": "^4.4.3"
104104
}
105105
}

0 commit comments

Comments
 (0)