mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-24 07:38:12 -05:00
6
.changeset/hungry-queens-invite.md
Normal file
6
.changeset/hungry-queens-invite.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/lifecycle": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Installation of a git-hosted dependency should not fail if the `pnpm-lock.yaml` file of the installed dependency is not up-to-date [#6865](https://github.com/pnpm/pnpm/issues/6865).
|
||||
@@ -61,7 +61,10 @@ export async function runLifecycleHook (
|
||||
? 'silent'
|
||||
: undefined
|
||||
await lifecycle(m, stage, opts.pkgRoot, {
|
||||
config: opts.rawConfig,
|
||||
config: {
|
||||
...opts.rawConfig,
|
||||
'frozen-lockfile': false,
|
||||
},
|
||||
dir: opts.rootModulesDir,
|
||||
extraBinPaths: opts.extraBinPaths ?? [],
|
||||
extraEnv: {
|
||||
|
||||
7
exec/lifecycle/test/fixtures/inspect-frozen-lockfile/package.json
vendored
Normal file
7
exec/lifecycle/test/fixtures/inspect-frozen-lockfile/package.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "inspect-frozen-lockfile",
|
||||
"version": "1.0.0",
|
||||
"scripts": {
|
||||
"postinstall": "rimraf output.json && node postinstall.js | json-append output.json"
|
||||
}
|
||||
}
|
||||
13
exec/lifecycle/test/fixtures/inspect-frozen-lockfile/postinstall.js
vendored
Normal file
13
exec/lifecycle/test/fixtures/inspect-frozen-lockfile/postinstall.js
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
const value = process.env['npm_config_frozen_lockfile']
|
||||
|
||||
switch(value) {
|
||||
case undefined:
|
||||
process.stdout.write('unset')
|
||||
break
|
||||
case '':
|
||||
process.stdout.write('empty string')
|
||||
break
|
||||
default:
|
||||
process.stdout.write('string: ' + value)
|
||||
break
|
||||
}
|
||||
@@ -39,6 +39,22 @@ test('runLifecycleHook() escapes the args passed to the script', async () => {
|
||||
expect((await import(path.join(pkgRoot, 'output.json'))).default).toStrictEqual(['Revert "feature (#1)"'])
|
||||
})
|
||||
|
||||
test('runLifecycleHook() sets frozen-lockfile to false', async () => {
|
||||
const pkgRoot = f.find('inspect-frozen-lockfile')
|
||||
const pkg = await import(path.join(pkgRoot, 'package.json'))
|
||||
await runLifecycleHook('postinstall', pkg, {
|
||||
depPath: '/inspect-frozen-lockfile/1.0.0',
|
||||
pkgRoot,
|
||||
rawConfig: {
|
||||
'frozen-lockfile': true,
|
||||
},
|
||||
rootModulesDir,
|
||||
unsafePerm: true,
|
||||
})
|
||||
|
||||
expect((await import(path.join(pkgRoot, 'output.json'))).default).toStrictEqual(['empty string'])
|
||||
})
|
||||
|
||||
test('runPostinstallHooks()', async () => {
|
||||
const pkgRoot = f.find('with-many-scripts')
|
||||
await rimraf(path.join(pkgRoot, 'output.json'))
|
||||
|
||||
Reference in New Issue
Block a user