Skip to content

Renaming onlyBuiltDependencies and ignoredBuiltDependencies in pnpm v11 #10235

@zkochan

Description

@zkochan

Contribution

Describe the user story

We currently have 3 settings related to dependency build script rules. Initially we had only "neverBuiltDependencies", which was an array of dependency names that are prohibited from running build scripts. Later we have decided to add an allowlist instead thus "onlyBuiltDependencies" was introduced. These two settings cannot be used together. A project should either use an allowlist or a disallow list. A third setting is also available called ignoredBuiltDependencies, which is used together with onlyBuiltDependencies.

So, a project either uses onlyBuiltDependencies and ignoredBuiltDependencies, or it uses neverBuiltDependencies.

Describe the solution you'd like

I think we should deprecate all the 3 settings in pnpm v11 and have one setting instead: allowBuilds (or allowScripts). This new setting would be a dictionary, where the name is the package descriptor and the value is a boolean or "warn". E.g.:

allowBuilds:
  esbuild: true
  core-js: false
  ghooks: 'warn'

This would allow us to prepopulate this setting during installation. E.g.:

allowBuilds:
  esbuild: 'warn'
  core-js: 'warn'
  ghooks: 'warn'

The user will then have a choice to either manually change the values or to run pnpm approve-builds

Describe the drawbacks of your solution

No response

Describe alternatives you've considered

No response

Prior art

https://www.npmjs.com/package/@lavamoat/allow-scripts

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions