-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Watch-mode not rebuild dependent packages when package changes #8164
Comments
I think Nick beat you to it. 😄 cc @NicholasLYang to confirm |
Yep! I can do another canary to confirm |
@NicholasLYang That would be great! |
@NicholasLYang If you can create a canary build that I am happy to test it. I tried to build it myself but I can't seem to get it compiled. |
Thanks @chris-olszewski going to experiment with it 👯 |
I have been trying it out when I make a change it seems to partly work for me. If my structure is as follows:
If I now make a change to and having the following {
"$schema": "https://turborepo.org/schema.json",
// Environment variables included in globalEnv key will impact the hashes of all tasks.
"globalPassThroughEnv": [
// Turborepo
"TURBO_HASH",
"TURBO_INVOCATION_DIR",
"TURBO_EXPERIMENTAL_UI",
// Node.js
"NODE_TLS_REJECT_UNAUTHORIZED",
// removed 300 line for readability
],
"globalEnv": [
"NODE_ENV",
"NODE_OPTIONS",
// removed lines for readability
],
"pipeline": {
"clean": {
"cache": false,
"outputMode": "errors-only"
},
"build": {
"dependsOn": ["^build"],
"inputs": [
"src/**",
"public/**",
"test/**",
"migration/**",
"patches/**",
"mocks/**",
"__mocks__/**",
// Bundled package tarballs
"bundles/**",
// Include the typical microservice entrypoint files
"*.ts",
"init.ts",
"bootstrap.ts",
"app.ts",
// Include Dockerfiles in the cache invalidation
"Dockerfile*",
// Include tsconfig.json changes
"tsconfig*.json",
// Required to ignore .DS_Store files
"!dist/**",
"!lib/**",
"!coverages/**",
"!**/.DS_Store"
],
"outputs": ["dist/**/*", "build/**/*", "lib/**/*", "typings/**/*", ".next/**/*", "!.next/cache/**"],
"outputMode": "new-only"
},
"test": {
"cache": true,
"outputMode": "new-only",
"inputs": [
"src/**",
"test/**",
"migration/**",
"patches/**",
"setupTest.ts",
"setupTest.tsx",
"global-setup.ts",
"vitest.config.ts",
"jest.config.js",
"jest.config.cjs",
"jest.config.mjs",
// Required to ignore .DS_Store files
"!**/.DS_Store"
],
"outputs": ["coverage/**", "!coverage/code-climate.json"],
// ^build is generically set here, we haven't fully enumerated which workspaces
// actually need to build before running tests.
"dependsOn": ["^build"]
},
"lint": {
"dependsOn": ["^build"],
"outputs": ["coverage/code-climate.json"],
"cache": true,
"outputMode": "full"
},
"//start": {
"cache": false,
"persistent": true,
"dependsOn": ["^dev"]
},
"dev": {
"dependsOn": ["^build"],
"cache": false,
"persistent": true
},
"//#dev:backend": {},
"//#dev:frontend": {},
"//#lint": {},
"//#format:check": {}
}
} |
Do I misunderstand how watch-mode should work for changing dependent packages? Do I need to watch the Also looks like the |
With persistent tasks, we don't restart them unless the entire workspace graph is invalidated (i.e. a turbo.json is changed or new dependency is added). We generally assume that persistent tasks are self healing, so even if they fail in the first run, eventually the We don't restart persistent tasks because Turborepo can't tell if they've completed, so we don't know if we're restarting in the middle of a build. But perhaps we can adjust that logic if restarting persistent tasks turns out to be useful. |
Yeah, I am currently having a import-loader defined to accept Typescript code and then use I am wondering what would be the best approach is. What about Turborepo sends the Maybe opt-in flag to indicate it can restarted (debounced) when its dependencies/packages change? npx nx watch --all -- node your-script.js # Watch all packages named `-service` and run `node -r @swc-node/register ./bootstrap.ts` when a change has occurred in the project or its dependencies
pnpm exec turbo watch --filter={services\*-service} -- node -r @swc-node/register ./bootstrap.ts Maybe @gajus has ideas, the creator of I do wonder if I could listen to the changes of |
We've made the same assumptions in our Turbowatch setup. |
We opted not to use |
In this case I'd agree with @gajus and recommend that not using |
Yes, but Especially, because I will experiment a bit more on my end :) |
@NicholasLYang Is this IPC protocol for daemon documented somewhere? |
This is why in When |
I wished I wouldn't need to dependent on The problem I am having is that I then get all kind of issues when I try to watch my 15 persistent tasks at the same time; as I am running into the problem that I hit the maximum of allowed opened files in macOs. I already had to increase it to |
You should not run into max open file issues on latest Node.js versions. Any version v19.1. See notes |
There's a protobuf file, but no official documentation.
Ah, so to confirm, you can't strip out the |
Yes, I have 14 backend servers, one Rust service, and two ASP.net services, and 4 Next.js projects plus ton of packages adding up to around 80+ packages in total. I would like to be able to watch roughly 9 backend servers and have them be restarted/reloaded when I change its code or any of the dependencies. |
Checking back in here. Are we able to close this one out? Judging by the title and if memory serves me correctly, I think this was from a canary release that is now fixed? |
This issue was mentioned about regarding “interruptable” tasks but it might be better to create a new issue? |
#8434 might also be related |
Recently hop in the turborepo train and trying to improve the local dev DX, I can't believe it's not a thing. I've watch through all the links, and tried most of the possible config combination it still doesn't work. Shared lib are built and store in other services node_module, unless you have things like nodemon that explicitly watch the node_modele, the backend just never restart. I understand that restarting is slower, but it only hold true for the frontend land where you have heavy start like webpack, backend on the other hand we don't have these luxury build step. Usually only have tsup/tsc/nest-cli(if you use nestjs), that doens't watch for node_modeule. Not to mention turbo knows way better of what have changed compare to nodemon blindly restart every time. I think “interruptable” is the way to go to make persistent task auto restart-able |
You can still use turbowatch for this use case. We never migrated to turbo's native watch for the same reason. |
I'm trying to have turbo run a long lived dev php server outside of the project in watch mode
But yeah it doesn't restart the server when I change anything in src, I'm not sure it's even watching there (I do know it watches correctly in non watch mode) Any progress on this? |
### Description Adds the ability to annotate persistent tasks as interruptible. Fixes #8164. NOTE: This does create change in behavior for watch mode where new changes will *stop* the current executing and start a new one. Previously, we waited for runs to finish, but now that persistent tasks can be interrupted, we can't do that since persistent tasks don't finish. ### Testing Instructions Added tests for ensuring that `interruptible` requires `persistent`, but otherwise you'll have to try this out manually since it's watch mode.
Verify canary release
Link to code that reproduces this issue
n/a
What package manager are you using / does the bug impact?
pnpm
What operating system are you using?
Mac
Which canary version will you have in your reproduction?
1.13.4-canary.4
Describe the Bug
If you make a change to a package that an project is depending on the project does not get rebuild
Expected Behavior
I would expect that the project gets rebuild when the package this project depends on get changed
To Reproduce
If you have a
project1
that depends onpackage1
, andpackage2
.The
project1
has a script defined in itspackage.json
nameddev
and thepackage1
andpackage2
workspace packages have script defined namedbuild
.The
dev
inturbo.json
is defined as:If I run the command
turbo watch dev --filter=project1
all the packages get build and thedev
-script ofproject1
gets started. Now if I make a change topackage1
e.g.src/index.ts
. The Turborepo daemon detects the following:So it appears that Turborepo has picked up that the package has changed but it doesn't seem to trigger
build
on the package and then after that completes re-runs thedev
-script ofproject1
.Have I misconfigured my project?
Additional context
No response
The text was updated successfully, but these errors were encountered: