fix: global install with save set to false

close #2261
PR #2815
This commit is contained in:
Zoltan Kochan
2020-08-31 17:20:24 +03:00
committed by GitHub
parent da578df55b
commit 9f1a29ff9e
3 changed files with 21 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
"@pnpm/config": patch
---
During global install, changes should always be saved to the global package.json, even when save is set to false.

View File

@@ -224,6 +224,7 @@ export default async (
: pnpmConfig['sharedWorkspaceLockfile']
if (cliOptions['global']) {
pnpmConfig.save = true
pnpmConfig.dir = path.join(pnpmConfig.globalDir, LAYOUT_VERSION.toString())
pnpmConfig.bin = cliOptions['dir']
? (

View File

@@ -51,6 +51,21 @@ test('throw error if --link-workspace-packages is used with --global', async (t)
}
})
test('"save" should always be true during global installation', async (t) => {
const { config } = await getConfig({
cliOptions: {
global: true,
save: false,
},
packageManager: {
name: 'pnpm',
version: '1.0.0',
},
})
t.ok(config.save)
t.end()
})
test('throw error if --shared-workspace-lockfile is used with --global', async (t) => {
try {
await getConfig({