mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
### What? Eliminates the expensive temporary repo directory (`tmpRepoDir`) copy during isolated test setup by leveraging a Turborepo `pack` task with caching. ### Why? The previous test isolation flow copied the entire `packages/` directory to a temp location, mutated every `package.json` to rewrite workspace dependency references, and ran `pnpm pack` sequentially for each package. This added ~10s+ of overhead per test suite. With Turborepo caching, repeated runs are 500ms (and can still be improved). ### How? - Adds a `pack-for-isolated-tests` task to `turbo.json` (depends on `build`, outputs `packed.tgz`) - Adds a `pack-for-isolated-tests` script (`pnpm pack --out ./packed.tgz`) to every workspace package - Simplifies `linkPackages` in `repo-setup.js` to scan for pre-built tarballs instead of copying/rewriting/packing - Updates `create-next-install.js` to run `pnpm turbo run pack` (benefits from caching) and use package manager `overrides` (pnpm/npm/yarn) to resolve transitive workspace deps from local tarballs - Removes `tmpRepoDir` handling from `base.ts` and `run-tests.js` **Before:** `createNextInstall` ~16s (copy + sequential pack) **After:** `createNextInstall` ~5s (first run) / ~4s (cached) <!-- NEXT_JS_LLM_PR -->
36 lines
862 B
JSON
36 lines
862 B
JSON
{
|
|
"$schema": "https://turborepo.org/schema.json",
|
|
"globalEnv": ["CI", "NEXT_CI_RUNNER"],
|
|
"globalPassThroughEnv": ["RUSTC_WRAPPER", "SCCACHE_*"],
|
|
"tasks": {
|
|
"build": {
|
|
"dependsOn": ["^build"],
|
|
"outputs": ["dist/**"]
|
|
},
|
|
"dev": {
|
|
"dependsOn": ["^dev"],
|
|
"outputs": ["dist/**"]
|
|
},
|
|
"storybook": {},
|
|
"build-storybook": {
|
|
"dependsOn": ["^build-storybook"],
|
|
"outputs": ["storybook-static/**"]
|
|
},
|
|
"test-storybook": {
|
|
"dependsOn": ["^test-storybook"]
|
|
},
|
|
"pack-for-isolated-tests": {
|
|
"dependsOn": ["build"],
|
|
"outputs": ["packed.tgz"]
|
|
},
|
|
"typescript": {},
|
|
"//#typescript": {},
|
|
"//#get-test-timings": {
|
|
"inputs": ["run-tests.js"],
|
|
"outputs": ["test-timings.json"],
|
|
"env": ["KV_REST_API_URL", "KV_REST_API_TOKEN"]
|
|
}
|
|
},
|
|
"ui": "tui"
|
|
}
|