Skip to content

Commit aaadc57

Browse files
committed
feat(create): enable task cache by default in monorepo template (#1230)
New monorepos created via `vp create vite:monorepo` now have `run: { cache: true }` in vite.config.ts, enabling caching for both built-in commands and package.json scripts out of the box.
1 parent 5df0b36 commit aaadc57

5 files changed

Lines changed: 25 additions & 3 deletions

File tree

packages/cli/snap-tests-global/create-missing-typecheck/snap.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ export default defineConfig({
2020
},
2121
fmt: {},
2222
lint: { options: { typeAware: true, typeCheck: true } },
23+
run: {
24+
cache: true,
25+
},
2326
});
2427

2528
> test ! -f vite-plus-monorepo/apps/website/vite.config.ts # sub-app should NOT have typeAware/typeCheck

packages/cli/snap-tests-global/create-missing-typecheck/steps.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"ignoredPlatforms": ["darwin", "win32", { "os": "linux", "libc": "musl" }],
2+
"ignoredPlatforms": ["win32", { "os": "linux", "libc": "musl" }],
33
"commands": [
44
{
55
"command": "vp create vite:application --no-interactive # create standalone app",

packages/cli/snap-tests-global/new-vite-monorepo/snap.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,20 @@ vite.config.ts
2929
"packageManager": "pnpm@<semver>"
3030
}
3131

32+
> cat vite-plus-monorepo/vite.config.ts # check vite config has cache enabled
33+
import { defineConfig } from "vite-plus";
34+
35+
export default defineConfig({
36+
staged: {
37+
"*": "vp check --fix",
38+
},
39+
fmt: {},
40+
lint: { options: { typeAware: true, typeCheck: true } },
41+
run: {
42+
cache: true,
43+
},
44+
});
45+
3246
> cat vite-plus-monorepo/pnpm-workspace.yaml # check workspace config
3347
packages:
3448
- apps/*

packages/cli/snap-tests-global/new-vite-monorepo/steps.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
},
88
"ls vite-plus-monorepo | LC_ALL=C sort # check files created",
99
"cat vite-plus-monorepo/package.json # check package.json",
10+
"cat vite-plus-monorepo/vite.config.ts # check vite config has cache enabled",
1011
"cat vite-plus-monorepo/pnpm-workspace.yaml # check workspace config",
1112
"test -d vite-plus-monorepo/.git && echo 'Git initialized' || echo 'No git' # check git init",
1213
"ls vite-plus-monorepo/apps # check apps directory created",
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
import { defineConfig } from 'vite';
1+
import { defineConfig } from 'vite-plus';
22

3-
export default defineConfig({});
3+
export default defineConfig({
4+
run: {
5+
cache: true,
6+
},
7+
});

0 commit comments

Comments
 (0)