-
Notifications
You must be signed in to change notification settings - Fork 0
Extend dev command with turbo watch mode #189
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Context
CellixJS is a Turborepo monorepo with several apps in the apps/ directory, each with distinct dev server requirements, and multiple TypeScript libraries compiled to dist/. The current root dev script starts all app servers but does not watch or rebuild libraries on code changes, requiring manual restarts for affected apps.
Goal
Extend the root dev script to leverage turbo watch so that app servers stay running and rebuild/restart correctly when libraries or codegen outputs change:
- All dev servers start and stay running
- Library source changes trigger affected rebuilds and restart dependent servers
genre-runs only when.graphqlor codegen plugin source changes- Vite/Docusaurus rely on native HMR and are not restarted by turbo
portless proxy startruns before any turbo-managed dev processes, but outside of turbo
Tasks
- Update root
package.jsondevscript:"dev": "portless proxy start && turbo watch dev gen build"
- Update root
turbo.json:- Add
futureFlags.watchUsingTaskInputs: true - Add a
devtask withcache: false,persistent: true,dependsOn: ["^build"] - Make task input filters explicit:
geninputs MUST include the negated pattern to exclude generated outputs from triggering itself: include"!src/generated/**"ingen.inputs(i.e., excludesrc/generated/so generated files don't re-triggergen).buildinputs SHOULD be scoped to package source files only, for example:"src/**/*.ts","tsconfig*.json", and"rolldown.config.ts". This prevents rebuilds on unrelated files and limits watch churn.
- Add
- Update/adjust app turbo.json files:
apps/api: setinterruptible: trueanddependsOn: ["^build", "gen"]- Important:
genhere is the same-packagegen(no caret). That ensures static SDL arrays and resolver manifests exist beforefunc startloads the bundle.
- Important:
apps/server-oauth2-mock: CREATE package-levelturbo.jsonwithinterruptible: trueanddependsOn: ["^build", "build"]so turbo waits for both cross-package builds and the app's own build before startingnode dist/index.js.apps/server-mongodb-memory-mock: adddependsOn: ["^build", "build"]but DO NOT setinterruptible: true(the in-memory replica must persist for the session to avoid dropping dev data).apps/docs:devtask should bepersistent: true, nointerruptible, and nodependsOn: ["^build"](Docusaurus handles content changes natively).apps/ui-community:devtask should bepersistent: true,dependsOn: ["^build"], nointerruptible(Vite will HMR linked packages without a full restart).
Acceptance criteria
pnpm run devlaunches the portless proxy and all five app dev servers in the intended order- Editing library source rebuilds the library and restarts
apps/api; Vite hot-reloads without a full restart - Editing a
.graphqlfile triggersgen(which does not self-trigger), thenbuild, thenapps/apirestarts - Editing source in
@cellix/server-oauth2-mock-seedworkrebuilds it and restartsapps/server-oauth2-mock - Editing source in
@cellix/server-mongodb-memory-mock-seedworkrebuilds it but does NOT restartapps/server-mongodb-memory-mock - Editing
.mdfiles inapps/docstriggers Docusaurus's native reload with no turbo involvement - No tasks re-run spuriously during an idle watch session
References
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Type
Projects
Status
Todo