fix(core): restore top-level schemas/ in published nx package#35427
Conversation
Editors resolve $schema as a filesystem path, bypassing Node subpath exports. The 22.7 files allowlist dropped the top-level schemas/ directory, breaking $schema references in every nx.json and project.json.
✅ Deploy Preview for nx-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
View your CI Pipeline Execution ↗ for commit 0eb79ac
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Important
At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.
Nx Cloud has identified a possible root cause for your failed CI:
We determined this failure is unrelated to the PR's changes, which are limited to npm packaging configuration for schema paths in the nx package. The e2e-gradle tests failed due to a missing Java 21 installation on the CI runner and a transient Foojay toolchain API outage — both external infrastructure issues. No fix is needed on our end; re-running once the environment recovers should resolve it.
No code changes were suggested for this issue.
Trigger a rerun:
🔔 Heads up, your workspace has pending recommendations ↗ to auto-apply fixes for similar failures.
🎓 Learn more about Self-Healing CI on nx.dev
|
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
Current Behavior
In 22.7.0-rc.1,
$schemareferences innx.jsonandproject.jsonno longer resolve in VS Code / JetBrains / any editor that reads$schemaas a filesystem path.Root cause — two commits combined:
packages/nx/schemas/topackages/nx/dist/schemas/.filesallowlist that shipped onlydist/, dropping the legacy top-levelschemas/from the published npm tarball.Node subpath
exports("./schemas/*": "./dist/schemas/*.json") do not redirect filesystem paths — editors bypass Node resolution entirely. So the regression affected both existing workspaces upgrading from 22.6.x (with$schemaalready in their configs) and fresh installs (sincenx init,create-nx-workspace, and the project-configuration generator all write./node_modules/nx/schemas/...).Expected Behavior
schemas/*.jsonship at the root of the publishednxpackage again, so./node_modules/nx/schemas/nx-schema.json(and the project/workspace variants) resolve on disk — no migration required, no changes to the paths generators write.Schemas are static JSON assets, not build artifacts — they're now published from source, not copied through
dist/:packages/nx/package.jsonfiles:"dist/schemas"→"schemas".packages/nx/package.jsonexports:./schemas/*and./schemas/*.jsonboth map to./schemas/*.json.packages/nx/assets.json: dropped theschemas/*.json→dist/copy step.Verified via
npm pack --dry-run— tarball now containsschemas/nx-schema.json,schemas/project-schema.json,schemas/workspace-schema.jsonat root, with nodist/schemas/entries.Related Issue(s)
Fixes #35411