From ca4422e86a8b3039d6b6168fee09b6345d43a504 Mon Sep 17 00:00:00 2001 From: Alan Agius <17563226+alan-agius4@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:09:02 +0000 Subject: [PATCH 1/2] fix(@schematics/angular): generate pnpm-workspace.yaml with allowBuilds for pnpm projects Starting in pnpm 11, `strictDepBuilds` is enabled by default and pnpm fails with `ERR_PNPM_IGNORED_BUILDS` when any dependency in the graph declares lifecycle build scripts that are not listed in `allowBuilds` in `pnpm-workspace.yaml`. Generate a `pnpm-workspace.yaml` file when scaffolding a new workspace with `pnpm` that configures `allowBuilds` to `false` for the transitive build dependencies (`@parcel/watcher`, `esbuild`, `lmdb`, and `msgpackr-extract`), which already ship prebuilt native binaries via `optionalDependencies` and do not need their fallback install scripts to execute. Fixes #34622 --- .../files/pnpm-workspace.yaml.template | 8 ++++++++ packages/schematics/angular/workspace/index.ts | 5 ++++- .../schematics/angular/workspace/index_spec.ts | 17 ++++++++++++++++- 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 packages/schematics/angular/workspace/files/pnpm-workspace.yaml.template diff --git a/packages/schematics/angular/workspace/files/pnpm-workspace.yaml.template b/packages/schematics/angular/workspace/files/pnpm-workspace.yaml.template new file mode 100644 index 000000000000..90a89a59b109 --- /dev/null +++ b/packages/schematics/angular/workspace/files/pnpm-workspace.yaml.template @@ -0,0 +1,8 @@ +packages: + - '.' + +allowBuilds: + '@parcel/watcher': false + esbuild: false + lmdb: false + msgpackr-extract: false diff --git a/packages/schematics/angular/workspace/index.ts b/packages/schematics/angular/workspace/index.ts index 85205042f3e3..60dd9ac7d0a6 100644 --- a/packages/schematics/angular/workspace/index.ts +++ b/packages/schematics/angular/workspace/index.ts @@ -18,7 +18,7 @@ import { } from '@angular-devkit/schematics'; import { execSync } from 'node:child_process'; import { latestVersions } from '../utility/latest-versions'; -import { Schema as WorkspaceOptions } from './schema'; +import { PackageManager, Schema as WorkspaceOptions } from './schema'; export default function (options: WorkspaceOptions): Rule { return () => { @@ -48,6 +48,9 @@ export default function (options: WorkspaceOptions): Rule { return mergeWith( apply(url('./files'), [ options.minimal ? filter((path) => !path.endsWith('editorconfig.template')) : noop(), + packageManager !== PackageManager.Pnpm + ? filter((path) => !path.endsWith('pnpm-workspace.yaml.template')) + : noop(), applyTemplates({ utils: strings, ...options, diff --git a/packages/schematics/angular/workspace/index_spec.ts b/packages/schematics/angular/workspace/index_spec.ts index a13a7d3e1bb7..371efa99d470 100644 --- a/packages/schematics/angular/workspace/index_spec.ts +++ b/packages/schematics/angular/workspace/index_spec.ts @@ -9,7 +9,7 @@ import { SchematicTestRunner } from '@angular-devkit/schematics/testing'; import { parse as parseJson } from 'jsonc-parser'; import { latestVersions } from '../utility/latest-versions'; -import { Schema as WorkspaceOptions } from './schema'; +import { PackageManager, Schema as WorkspaceOptions } from './schema'; describe('Workspace Schematic', () => { const schematicRunner = new SchematicTestRunner( @@ -38,6 +38,21 @@ describe('Workspace Schematic', () => { '/tsconfig.json', ]), ); + expect(files).not.toContain('/pnpm-workspace.yaml'); + }); + + it('should create pnpm-workspace.yaml with allowBuilds when packageManager is pnpm', async () => { + const tree = await schematicRunner.runSchematic('workspace', { + ...defaultOptions, + packageManager: PackageManager.Pnpm, + }); + expect(tree.exists('/pnpm-workspace.yaml')).toBeTrue(); + const content = tree.readContent('/pnpm-workspace.yaml'); + expect(content).toContain('allowBuilds:'); + expect(content).toContain("'@parcel/watcher': false"); + expect(content).toContain('esbuild: false'); + expect(content).toContain('lmdb: false'); + expect(content).toContain('msgpackr-extract: false'); }); it('should set the name in package.json', async () => { From bc870b8c9b4dd156e1a0e3547c59beec6f7bfb9d Mon Sep 17 00:00:00 2001 From: Alan Agius <17563226+alan-agius4@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:05:00 +0000 Subject: [PATCH 2/2] fixup! fix(@schematics/angular): generate pnpm-workspace.yaml with allowBuilds for pnpm projects --- packages/schematics/angular/workspace/index_spec.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/schematics/angular/workspace/index_spec.ts b/packages/schematics/angular/workspace/index_spec.ts index 371efa99d470..fbd2643b4052 100644 --- a/packages/schematics/angular/workspace/index_spec.ts +++ b/packages/schematics/angular/workspace/index_spec.ts @@ -49,10 +49,6 @@ describe('Workspace Schematic', () => { expect(tree.exists('/pnpm-workspace.yaml')).toBeTrue(); const content = tree.readContent('/pnpm-workspace.yaml'); expect(content).toContain('allowBuilds:'); - expect(content).toContain("'@parcel/watcher': false"); - expect(content).toContain('esbuild: false'); - expect(content).toContain('lmdb: false'); - expect(content).toContain('msgpackr-extract: false'); }); it('should set the name in package.json', async () => {