Skip to content

Commit

Permalink
feat(js): infer continuous for watch-deps task (#29976)
Browse files Browse the repository at this point in the history
## Current Behavior
The `@nx/js` plugin exposes a helper to generate `build-deps` and
`watch-deps` tasks for inference plugins.
It does not currently infer `continuous` for the `watch-deps` task.

## Expected Behavior
Ensure `watch-deps` is infered with `continuous: true`
  • Loading branch information
Coly010 authored and FrozenPandaz committed Feb 20, 2025
1 parent 38793d7 commit 0d9f4d2
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/js/src/plugins/typescript/plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2213,6 +2213,7 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
},
"watch-deps": {
"command": "npx nx watch --projects my-lib --includeDependentProjects -- npx nx build-deps my-lib",
"continuous": true,
"dependsOn": [
"build-deps",
],
Expand Down Expand Up @@ -2367,6 +2368,7 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
},
"watch-deps": {
"command": "npx nx watch --projects my-lib --includeDependentProjects -- npx nx build-deps my-lib",
"continuous": true,
"dependsOn": [
"build-deps",
],
Expand Down
1 change: 1 addition & 0 deletions packages/js/src/plugins/typescript/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export function addBuildAndWatchDepsTargets(
dependsOn: ['^build'],
};
targets[options.watchDepsTargetName ?? 'watch-deps'] = {
continuous: true,
dependsOn: [buildDepsTargetName],
command: `${pmc.exec} nx watch --projects ${projectName} --includeDependentProjects -- ${pmc.exec} nx ${buildDepsTargetName} ${projectName}`,
};
Expand Down
2 changes: 2 additions & 0 deletions packages/next/src/plugins/__snapshots__/plugin.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ exports[`@nx/next/plugin integrated projects should create nodes 1`] = `
},
"watch-deps": {
"command": "npx nx watch --projects my-app --includeDependentProjects -- npx nx build-deps my-app",
"continuous": true,
"dependsOn": [
"build-deps",
],
Expand Down Expand Up @@ -140,6 +141,7 @@ exports[`@nx/next/plugin root projects should create nodes 1`] = `
},
"watch-deps": {
"command": "npx nx watch --projects next --includeDependentProjects -- npx nx build-deps next",
"continuous": true,
"dependsOn": [
"build-deps",
],
Expand Down
2 changes: 2 additions & 0 deletions packages/nuxt/src/plugins/__snapshots__/plugin.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ exports[`@nx/nuxt/plugin not root project should create nodes 1`] = `
},
"watch-deps": {
"command": "npx nx watch --projects my-app --includeDependentProjects -- npx nx build-deps my-app",
"continuous": true,
"dependsOn": [
"build-deps",
],
Expand Down Expand Up @@ -158,6 +159,7 @@ exports[`@nx/nuxt/plugin root project should create nodes 1`] = `
},
"watch-deps": {
"command": "npx nx watch --projects nuxt --includeDependentProjects -- npx nx build-deps nuxt",
"continuous": true,
"dependsOn": [
"build-deps",
],
Expand Down
3 changes: 3 additions & 0 deletions packages/remix/src/plugins/__snapshots__/plugin.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ exports[`@nx/remix/plugin Remix Classic Compiler non-root project should create
},
"watch-deps": {
"command": "npx nx watch --projects my-app --includeDependentProjects -- npx nx build-deps my-app",
"continuous": true,
"dependsOn": [
"build-deps",
],
Expand Down Expand Up @@ -226,6 +227,7 @@ exports[`@nx/remix/plugin Remix Classic Compiler non-root project should infer w
},
"watch-deps": {
"command": "npx nx watch --projects my-app --includeDependentProjects -- npx nx build-deps my-app",
"continuous": true,
"dependsOn": [
"build-deps",
],
Expand Down Expand Up @@ -452,6 +454,7 @@ exports[`@nx/remix/plugin Remix Vite Compiler non-root project should create nod
},
"watch-deps": {
"command": "npx nx watch --projects my-app --includeDependentProjects -- npx nx build-deps my-app",
"continuous": true,
"dependsOn": [
"build-deps",
],
Expand Down
4 changes: 4 additions & 0 deletions packages/rollup/src/plugins/__snapshots__/plugin.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ exports[`@nx/rollup/plugin non-root project should create nodes 1`] = `
},
"watch-deps": {
"command": "npx nx watch --projects mylib --includeDependentProjects -- npx nx build-deps mylib",
"continuous": true,
"dependsOn": [
"build-deps",
],
Expand Down Expand Up @@ -120,6 +121,7 @@ exports[`@nx/rollup/plugin non-root project should create nodes 2`] = `
},
"watch-deps": {
"command": "npx nx watch --projects mylib --includeDependentProjects -- npx nx build-deps mylib",
"continuous": true,
"dependsOn": [
"build-deps",
],
Expand Down Expand Up @@ -185,6 +187,7 @@ exports[`@nx/rollup/plugin root project should create nodes 1`] = `
},
"watch-deps": {
"command": "npx nx watch --projects mylib --includeDependentProjects -- npx nx build-deps mylib",
"continuous": true,
"dependsOn": [
"build-deps",
],
Expand Down Expand Up @@ -250,6 +253,7 @@ exports[`@nx/rollup/plugin root project should create nodes 2`] = `
},
"watch-deps": {
"command": "npx nx watch --projects mylib --includeDependentProjects -- npx nx build-deps mylib",
"continuous": true,
"dependsOn": [
"build-deps",
],
Expand Down
1 change: 1 addition & 0 deletions packages/rsbuild/src/plugins/plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ describe('@nx/rsbuild', () => {
},
"watch-deps": {
"command": "npx nx watch --projects my-app --includeDependentProjects -- npx nx build-deps my-app",
"continuous": true,
"dependsOn": [
"build-deps",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ exports[`@nx/vite/plugin root project should create nodes 1`] = `
},
"watch-deps": {
"command": "npx nx watch --projects vite --includeDependentProjects -- npx nx build-deps vite",
"continuous": true,
"dependsOn": [
"build-deps",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ exports[`@nx/vite/plugin with test node root project should create nodes - with
},
"watch-deps": {
"command": "npx nx watch --projects vite --includeDependentProjects -- npx nx build-deps vite",
"continuous": true,
"dependsOn": [
"build-deps",
],
Expand Down
2 changes: 2 additions & 0 deletions packages/vite/src/plugins/__snapshots__/plugin.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ exports[`@nx/vite/plugin Library mode should exclude serve and preview targets w
},
"watch-deps": {
"command": "npx nx watch --projects my-lib --includeDependentProjects -- npx nx build-deps my-lib",
"continuous": true,
"dependsOn": [
"build-deps",
],
Expand Down Expand Up @@ -193,6 +194,7 @@ exports[`@nx/vite/plugin not root project should create nodes 1`] = `
},
"watch-deps": {
"command": "npx nx watch --projects my-app --includeDependentProjects -- npx nx build-deps my-app",
"continuous": true,
"dependsOn": [
"build-deps",
],
Expand Down
1 change: 1 addition & 0 deletions packages/vite/src/plugins/plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ describe('@nx/vite/plugin', () => {
},
"watch-deps": {
"command": "npx nx watch --projects my-lib --includeDependentProjects -- npx nx build-deps my-lib",
"continuous": true,
"dependsOn": [
"build-deps",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ exports[`@nx/webpack/plugin should create nodes 1`] = `
},
"watch-deps": {
"command": "npx nx watch --projects my-app --includeDependentProjects -- npx nx build-deps my-app",
"continuous": true,
"dependsOn": [
"build-deps",
],
Expand Down

0 comments on commit 0d9f4d2

Please sign in to comment.