Skip to content

Commit 7af6da1

Browse files
authored
chore(nx-dev): declare sitemap on build and deploy-build outputs (#35402)
## Current Behavior `nx-dev:build` is a no-op aggregator over `sitemap` and `copy-redirects` but only declares `{projectRoot}/.next` as its output. Tasks that depend on `nx-dev:build` and use `dependentTasksOutputFiles` — e.g. `astro-docs:validate-links`, which reads `nx-dev/nx-dev/public/sitemap-0.xml` to cross-check links — never pick up the sitemap as a declared input. Under sandboxing this surfaces as an unexpected read, and it also means the sitemap doesn't participate in the consumer's input hash. Separately, `nx-dev:next:build` lists `public/sitemap*.xml` as an output even though `next build` never writes sitemaps (the `sitemap` target does). At best the glob captures nothing; at worst, on a re-run it snapshots stale files from a previous build into `next:build`'s cache. ## Expected Behavior `nx-dev:build` and `nx-dev:deploy-build` declare `{projectRoot}/public/sitemap*.xml` alongside `{projectRoot}/.next`, matching what their dependsOn chain actually produces. This mirrors the existing `nx:noop` atomizer pattern used by `@nx/playwright` and `@nx/cypress`, where the rollup target declares the superset of outputs its children produce. `nx:next:build` no longer claims an output it doesn't write. Verified: `nx show target inputs astro-docs:validate-links --check nx-dev/nx-dev/public/sitemap-0.xml nx-dev/nx-dev/public/sitemap.xml` now reports both as inputs.
1 parent 0ca6e3f commit 7af6da1

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

nx-dev/nx-dev/project.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@
1616
{ "externalDependencies": ["next"] },
1717
{ "dependentTasksOutputFiles": "**/*.d.ts", "transitive": true }
1818
],
19-
"outputs": [
20-
"{workspaceRoot}/nx-dev/nx-dev/.next",
21-
"{workspaceRoot}/nx-dev/nx-dev/public/sitemap*.xml"
22-
]
19+
"outputs": ["{workspaceRoot}/nx-dev/nx-dev/.next"]
2320
},
2421
"sitemap": {
2522
"dependsOn": ["nx-dev:next:build"],
@@ -44,11 +41,11 @@
4441
},
4542
"build": {
4643
"dependsOn": ["sitemap", "copy-redirects"],
47-
"outputs": ["{projectRoot}/.next"]
44+
"outputs": ["{projectRoot}/.next", "{projectRoot}/public/sitemap*.xml"]
4845
},
4946
"deploy-build": {
5047
"dependsOn": ["build"],
51-
"outputs": ["{projectRoot}/.next"]
48+
"outputs": ["{projectRoot}/.next", "{projectRoot}/public/sitemap*.xml"]
5249
},
5350
"serve": {
5451
"command": "nx dev nx-dev"

0 commit comments

Comments
 (0)