@@ -121,6 +121,11 @@ export interface IPnpmOptionsJson extends IPackageManagerOptionsJsonBase {
121121 */
122122 globalPackageExtensions ?: Record < string , IPnpmPackageExtension > ;
123123 /**
124+ * {@inheritDoc PnpmOptionsConfiguration.globalAllowBuilds }
125+ */
126+ globalAllowBuilds ?: Record < string , boolean > ;
127+ /**
128+ * @deprecated Use {@link IPnpmOptionsJson.globalAllowBuilds} instead.
124129 * {@inheritDoc PnpmOptionsConfiguration.globalNeverBuiltDependencies}
125130 */
126131 globalNeverBuiltDependencies ?: string [ ] ;
@@ -425,6 +430,23 @@ export class PnpmOptionsConfiguration extends PackageManagerOptionsConfiguration
425430 */
426431 public readonly globalPackageExtensions : Record < string , IPnpmPackageExtension > | undefined ;
427432
433+ /**
434+ * The `globalAllowBuilds` setting is a map of package names to booleans that controls which
435+ * dependencies are permitted to run build scripts (`preinstall`, `install`, `postinstall`
436+ * lifecycle events). A value of `true` explicitly permits a package to run build scripts;
437+ * a value of `false` explicitly blocks it. Packages not listed inherit the default behavior.
438+ *
439+ * This is the replacement for `globalNeverBuiltDependencies` and `globalOnlyBuiltDependencies`,
440+ * and is the only way to control build permissions in pnpm 11+. The settings are written to the
441+ * `allowBuilds` field of the `pnpm-workspace.yaml` file that is generated by Rush during
442+ * installation.
443+ *
444+ * (SUPPORTED ONLY IN PNPM 11.0.0 AND NEWER)
445+ *
446+ * PNPM documentation: https://pnpm.io/settings#allowbuilds
447+ */
448+ public readonly globalAllowBuilds : Record < string , boolean > | undefined ;
449+
428450 /**
429451 * The `globalNeverBuiltDependencies` setting suppresses the `preinstall`, `install`, and `postinstall`
430452 * lifecycle events for the specified NPM dependencies. This is useful for scripts with poor practices
@@ -434,6 +456,8 @@ export class PnpmOptionsConfiguration extends PackageManagerOptionsConfiguration
434456 * The settings are copied into the `pnpm.neverBuiltDependencies` field of the `common/temp/package.json`
435457 * file that is generated by Rush during installation.
436458 *
459+ * @deprecated Use {@link PnpmOptionsConfiguration.globalAllowBuilds} instead.
460+ *
437461 * PNPM documentation: https://pnpm.io/package_json#pnpmneverbuiltdependencies
438462 */
439463 public readonly globalNeverBuiltDependencies : string [ ] | undefined ;
@@ -554,6 +578,14 @@ export class PnpmOptionsConfiguration extends PackageManagerOptionsConfiguration
554578 this . globalOverrides = json . globalOverrides ;
555579 this . globalPeerDependencyRules = json . globalPeerDependencyRules ;
556580 this . globalPackageExtensions = json . globalPackageExtensions ;
581+
582+ if ( json . globalNeverBuiltDependencies !== undefined && json . globalAllowBuilds !== undefined ) {
583+ throw new Error (
584+ 'The "globalNeverBuiltDependencies" setting is deprecated. Use "globalAllowBuilds" instead.' +
585+ ' Both settings cannot be specified together in pnpm-config.json.'
586+ ) ;
587+ }
588+ this . globalAllowBuilds = json . globalAllowBuilds ;
557589 this . globalNeverBuiltDependencies = json . globalNeverBuiltDependencies ;
558590 this . globalOnlyBuiltDependencies = json . globalOnlyBuiltDependencies ;
559591 this . globalIgnoredOptionalDependencies = json . globalIgnoredOptionalDependencies ;
0 commit comments