mirror of
https://github.com/pnpm/pnpm.git
synced 2026-01-15 02:18:31 -05:00
fix: setting requiredScripts in pnpm-workspace.yaml (#10404)
close #10261
This commit is contained in:
7
.changeset/red-months-bathe.md
Normal file
7
.changeset/red-months-bathe.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-script-runners": patch
|
||||
"@pnpm/config": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
It should be possible to declare the `requiredScripts` setting in `pnpm-workspace.yaml` [#10261](https://github.com/pnpm/pnpm/issues/10261).
|
||||
@@ -29,6 +29,7 @@ export type OptionsFromRootManifest = {
|
||||
peerDependencyRules?: PeerDependencyRules
|
||||
supportedArchitectures?: SupportedArchitectures
|
||||
allowBuilds?: Record<string, boolean | string>
|
||||
requiredScripts?: string[]
|
||||
} & Pick<PnpmSettings, 'configDependencies' | 'auditConfig' | 'executionEnv' | 'updateConfig'>
|
||||
|
||||
export function getOptionsFromRootManifest (manifestDir: string, manifest: ProjectManifest): OptionsFromRootManifest {
|
||||
@@ -54,6 +55,7 @@ export function getOptionsFromRootManifest (manifestDir: string, manifest: Proje
|
||||
'packageExtensions',
|
||||
'patchedDependencies',
|
||||
'peerDependencyRules',
|
||||
'requiredScripts',
|
||||
'supportedArchitectures',
|
||||
'updateConfig',
|
||||
], manifest.pnpm ?? {}),
|
||||
|
||||
@@ -26,6 +26,7 @@ export type RecursiveRunOpts = Pick<Config,
|
||||
| 'unsafePerm'
|
||||
| 'pnpmHomeDir'
|
||||
| 'rawConfig'
|
||||
| 'requiredScripts'
|
||||
| 'rootProjectManifest'
|
||||
| 'scriptsPrependNodePath'
|
||||
| 'scriptShell'
|
||||
@@ -74,7 +75,7 @@ export async function runRecursive (
|
||||
const existsPnp = existsInDir.bind(null, '.pnp.cjs')
|
||||
const workspacePnpPath = opts.workspaceDir && existsPnp(opts.workspaceDir)
|
||||
|
||||
const requiredScripts = opts.rootProjectManifest?.pnpm?.requiredScripts ?? []
|
||||
const requiredScripts = opts.requiredScripts ?? []
|
||||
if (requiredScripts.includes(scriptName)) {
|
||||
const missingScriptPackages: string[] = packageChunks
|
||||
.flat()
|
||||
|
||||
@@ -783,12 +783,10 @@ test('`pnpm recursive run` should fail when no script in package with requiredSc
|
||||
...await filterPackagesFromDir(process.cwd(), [{ namePattern: '*' }]),
|
||||
dir: process.cwd(),
|
||||
recursive: true,
|
||||
requiredScripts: ['build'],
|
||||
rootProjectManifest: {
|
||||
name: 'test-workspaces',
|
||||
private: true,
|
||||
pnpm: {
|
||||
requiredScripts: ['build'],
|
||||
},
|
||||
},
|
||||
workspaceDir: process.cwd(),
|
||||
}, ['build'])
|
||||
|
||||
Reference in New Issue
Block a user