ci: run nuxt prepare as its own turbo task - #2629
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR addresses intermittent CI/typecheck failures in the Nuxt template inheritance chain by ensuring .nuxt is generated even when Turbo returns cached build outputs, preventing missing ../vue-starter-template/.nuxt/tsconfig.app.json lookups during .vue transforms.
Changes:
- Adds a dedicated
nuxt-prepareTurbo task withcache: falsesonuxt preparealways executes. - Wires
build,generate, andtypecheckto depend onnuxt-prepare(local and dependency scopes via^nuxt-prepare). - Adds a
nuxt-preparenpm script totemplates/vue-starter-templateto enable the Turbo task.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| turbo.json | Introduces an uncacheable nuxt-prepare task and adds it as a dependency for build/generate/typecheck/dev flows. |
| templates/vue-starter-template/package.json | Adds a nuxt-prepare script so Turbo can invoke nuxt prepare as a standalone task. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Patryk Tomczyk (patzick)
left a comment
There was a problem hiding this comment.
Approving — diagnosis and fix match: cache: false is the only way to make nuxt prepare survive a build cache hit, and keeping .nuxt out of outputs is right given the absolute paths in it. CI is green on all required checks.
Two non-blocking notes inline (redundant ^nuxt-prepare entries, and dev now pulling a full ^build).
Description
templates/vue-starter-template/tsconfig.jsonuses the Nuxt 4 layout from #2606:files: []plusreferencesinto./.nuxt. Vite loads the nearesttsconfig.jsonwhen it transforms a.vuefile, so anything compiling this template needs.nuxtfirst.lumora-demo-storeextends it, so it compiles those files too..nuxtis created bynuxt prepare, which only lives inside the template'sbuildscript. A turbo cache hit does not run the script. It restores the files listed inoutputsand replays the logs..nuxtis not inoutputs, so it is neither generated nor restored:This PR moves
nuxt prepareinto its own uncacheable turbo task, so it always runs.When it fails
Three things have to line up:
.nuxton disk. It is gitignored, so every fresh checkout starts this way.vue-starter-template#buildis a cache hit, sonuxt prepareis skipped.lumora-demo-storeis a cache miss, so it still has to compile the template's.vuefiles.The third point is why this is not a corner case. A change touching only the extended template splits the hashes:
When both hit or both miss, nothing breaks. Hence the intermittency. Remote caching is on in every workflow, so the hit can come from another machine.
Changes
vue-starter-templategets anuxt-preparescript.turbo.jsongets anuxt-preparetask withcache: false, so it always runs.buildandgeneratedepend onnuxt-prepareand^nuxt-prepare, covering both the template being built and the one being extended.typecheckdepends on^nuxt-prepare.No package names are hardcoded. Turbo skips the task where the script is not defined. Only
vue-starter-templateneeds it today: it is the one package that is both extended by another and usesreferencesinto its own.nuxt.Why not cache
.nuxtListing
.nuxt/**as a build output also hides the error, and was the first attempt on the #2609 branch. It is the wrong tool:.nuxtis anuxt prepareartifact, not a build output.shopware.d.ts,uno.config.mjs,app.config.mjs,types/layouts.d.ts,types/nitro-imports.d.ts), and remote cache would carry one machine's paths onto another.That workaround has since been reverted, so neither fix is on
maintoday. Thanks Patryk Tomczyk (@patzick) for catching it in review.Type of change
Bug fix (non-breaking change which fixes an issue)
ToDo's
Additional context
Reproduced against current
mainconfig:turbo run build --filter=vue-starter-templateto populate the cache.rm -rf templates/vue-starter-template/.nuxt.6 cached, 6 totalin 46ms,>>> FULL TURBO, and.nuxtis not recreated.turbo run typecheck --filter=lumora-demo-storefails with the error above.After the fix, both paths are covered and caching is preserved (7 of 8 tasks still cached in 1.9s, only
nuxt-preparebypassing). A repo-wide run on the #2609 branch was clean:pnpm build35/35,pnpm typecheck69/69,pnpm lint31/31.Not related to #2632. That was a client bundle resolve error for
@oxc-parser/binding-wasm32-wasi. This is a tsconfig lookup during transform.