fix(core): allow nx build scripts in generated pnpm-workspace.yaml#35564
fix(core): allow nx build scripts in generated pnpm-workspace.yaml#35564cogwirrel wants to merge 2 commits intonrwl:masterfrom
Conversation
pnpm 11 defaults strictDepBuilds to true. When create-nx-workspace runs a third-party preset (anything that hits the createEmptyWorkspace + createPreset code path), the initial `pnpm install --no-frozen-lockfile` fires ERR_PNPM_IGNORED_BUILDS for nx's postinstall script and the workspace-creation step fails before the preset can run. Extend addPnpmSettings to emit an allowBuilds entry for nx in the generated pnpm-workspace.yaml, so the initial install succeeds. Include the pnpm 10-compatible onlyBuiltDependencies form as well — pnpm silently ignores the key it doesn't recognize.
👷 Deploy request for nx-dev pending review.Visit the deploys page to approve it
|
👷 Deploy request for nx-docs pending review.Visit the deploys page to approve it
|
AgentEnder
left a comment
There was a problem hiding this comment.
Hey, thanks for the PR - I left a comment that I think we can get this past the line after solving
|
Ah, github has issues - the comment was meant to be:
|
|
View your CI Pipeline Execution ↗ for commit c7cbfa8
☁️ Nx Cloud last updated this comment at |
|
Thanks for the feedback! Updated to use
Will push shortly. |
Thanks @AgentEnder! Good call, have updated the PR to switch on pnpm >=11 :) |
…ace.yaml Use getPackageManagerVersion to emit only the correct key: - pnpm 11+: allowBuilds (the new pnpm 11 setting) - pnpm 10.6.0-10.x: onlyBuiltDependencies (the pnpm 10 setting)
Current Behavior
When creating a new workspace with
create-nx-workspaceusing the preset flow and pnpm 11, the workspace creation fails at thenx newstep with:pnpm 11 defaults
strictDepBuildstotrue, which turns the warning for ignored build scripts into a hard error.addPnpmSettingswrites a minimalpnpm-workspace.yamlcontaining onlyautoInstallPeers: true— it does not includeallowBuilds, so wheninstallPackagesTaskrunspnpm install --no-frozen-lockfile, pnpm sees thatnxhas a postinstall script and errors out because it is not in the allowlist.Expected Behavior
Workspace creation should succeed under pnpm 11 without requiring the user to manually configure
allowBuildsor downgrade pnpm. The generatedpnpm-workspace.yamlshould include the correct build allowlist key for the detected pnpm version.This PR uses
getPackageManagerVersion(already available ingenerateWorkspaceFiles) to emit only the correct key:allowBuilds: { nx: true }— the new pnpm 11 settingonlyBuiltDependencies: [nx]— the pnpm 10 settingpnpm 11 removed
onlyBuiltDependenciesentirely in favor ofallowBuilds, so we version-gate rather than emitting both.Related Issue(s)
Fixes #35563