Skip to content
This repository was archived by the owner on Aug 20, 2026. It is now read-only.

Commit 2b17d68

Browse files
committed
feat: cache typecheck/lint/test/build tasks with turbo
document-cli is a single-package repo -- turbo.json declares only leaf tasks (_typecheck, _lint, _test, _test:coverage, _test:smoke, _test:workers, _build), none with a dependsOn, since there is no other package to depend on. Each task declares its own real inputs/outputs so turbo skips a re-run when nothing relevant has changed. The bare script names now route through turbo run _<name>; the underscore-prefixed names are the real leaf commands, unchanged from what the bare names used to run directly, and stay directly invocable to bypass the cache.
1 parent 1e3b468 commit 2b17d68

4 files changed

Lines changed: 114 additions & 7 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ dist/
44
.DS_Store
55
coverage/
66
.eslintcache
7+
.turbo/

package.json

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,22 @@
4949
"node": ">=20"
5050
},
5151
"scripts": {
52-
"build": "tsdown",
52+
"build": "turbo run _build",
53+
"_build": "tsdown",
5354
"prepublishOnly": "pnpm run lint && pnpm run typecheck && tsdown && publint && attw --pack",
54-
"lint": "eslint . --fix --cache --max-warnings 0",
55-
"typecheck": "tsc --noEmit",
56-
"test": "vitest run --project unit",
55+
"lint": "turbo run _lint",
56+
"_lint": "eslint . --fix --cache --max-warnings 0",
57+
"typecheck": "turbo run _typecheck",
58+
"_typecheck": "tsc --noEmit",
59+
"test": "turbo run _test",
60+
"_test": "vitest run --project unit",
5761
"test:watch": "vitest --project unit",
58-
"test:coverage": "vitest run --project unit --coverage",
59-
"test:smoke": "tsdown && vitest run --project smoke",
60-
"test:workers": "vitest run --config vitest.workers.config.ts",
62+
"test:coverage": "turbo run _test:coverage",
63+
"_test:coverage": "vitest run --project unit --coverage",
64+
"test:smoke": "turbo run _test:smoke",
65+
"_test:smoke": "tsdown && vitest run --project smoke",
66+
"test:workers": "turbo run _test:workers",
67+
"_test:workers": "vitest run --config vitest.workers.config.ts",
6168
"prepare": "husky",
6269
"release": "semantic-release"
6370
},
@@ -108,6 +115,7 @@
108115
"publint": "^0.3.22",
109116
"semantic-release": "^25.0.8",
110117
"tsdown": "^0.22.14",
118+
"turbo": "^2.10.8",
111119
"typescript": "^6.0.3",
112120
"typescript-eslint": "^8.65.0",
113121
"vitest": "^4.1.10"

pnpm-lock.yaml

Lines changed: 64 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

turbo.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"$schema": "https://turborepo.com/schema.json",
3+
"globalDependencies": ["pnpm-lock.yaml"],
4+
"tasks": {
5+
"_typecheck": {
6+
"inputs": ["$TURBO_DEFAULT$", "tsconfig.json"],
7+
"outputs": []
8+
},
9+
"_lint": {
10+
"inputs": ["$TURBO_DEFAULT$", "eslint.config.ts"],
11+
"outputs": [".eslintcache"]
12+
},
13+
"_test": {
14+
"inputs": ["src/**", "vitest.config.ts"],
15+
"outputs": []
16+
},
17+
"_test:coverage": {
18+
"inputs": ["src/**", "vitest.config.ts"],
19+
"outputs": ["coverage/**"]
20+
},
21+
"_test:smoke": {
22+
"inputs": ["src/**", "test/smoke.test.mjs", "vitest.config.ts", "tsdown.config.ts", "package.json"],
23+
"outputs": ["dist/**"]
24+
},
25+
"_test:workers": {
26+
"inputs": ["src/**", "test/workers/**", "vitest.workers.config.ts", "wrangler.jsonc"],
27+
"outputs": []
28+
},
29+
"_build": {
30+
"inputs": ["src/**", "tsdown.config.ts"],
31+
"outputs": ["dist/**"]
32+
}
33+
}
34+
}

0 commit comments

Comments
 (0)