mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-24 07:38:12 -05:00
fix: fixed extra-bin-paths not set if using ignore-script=true in a monorepo (#9522)
close #4858
This commit is contained in:
6
.changeset/shy-seas-lick.md
Normal file
6
.changeset/shy-seas-lick.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/config": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
`pnpm run` should be able to run commands from the workspace root, if `ignoreScripts` is set tot `true` [#4858](https://github.com/pnpm/pnpm/issues/4858).
|
||||
@@ -388,7 +388,7 @@ export async function getConfig (opts: {
|
||||
pnpmConfig.filterProd = (pnpmConfig.filterProd as string).split(' ')
|
||||
}
|
||||
|
||||
if (!pnpmConfig.ignoreScripts && pnpmConfig.workspaceDir) {
|
||||
if (pnpmConfig.workspaceDir) {
|
||||
pnpmConfig.extraBinPaths = [path.join(pnpmConfig.workspaceDir, 'node_modules', '.bin')]
|
||||
} else {
|
||||
pnpmConfig.extraBinPaths = []
|
||||
|
||||
@@ -331,6 +331,21 @@ test('extraBinPaths', async () => {
|
||||
expect(config.extraBinPaths).toStrictEqual([path.resolve('node_modules/.bin')])
|
||||
}
|
||||
|
||||
{
|
||||
const { config } = await getConfig({
|
||||
cliOptions: {
|
||||
'ignore-scripts': true,
|
||||
},
|
||||
packageManager: {
|
||||
name: 'pnpm',
|
||||
version: '1.0.0',
|
||||
},
|
||||
workspaceDir: process.cwd(),
|
||||
})
|
||||
// extraBinPaths has the node_modules/.bin folder from the root of the workspace if scripts are ignored
|
||||
expect(config.extraBinPaths).toStrictEqual([path.resolve('node_modules/.bin')])
|
||||
}
|
||||
|
||||
{
|
||||
const { config } = await getConfig({
|
||||
cliOptions: {
|
||||
|
||||
Reference in New Issue
Block a user