mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-24 07:38:12 -05:00
fix(deploy): don't modify the lockfile and fail in CI (#5074)
close #5071
This commit is contained in:
6
.changeset/clever-guests-heal.md
Normal file
6
.changeset/clever-guests-heal.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-deploy": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
`pnpm deploy` should not modify the lockfile [#5071](https://github.com/pnpm/pnpm/issues/5071)
|
||||
6
.changeset/clever-guests-heal2.md
Normal file
6
.changeset/clever-guests-heal2.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-deploy": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
`pnpm deploy` should not fail in CI [#5071](https://github.com/pnpm/pnpm/issues/5071)
|
||||
6
.changeset/wise-guests-turn.md
Normal file
6
.changeset/wise-guests-turn.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/core": minor
|
||||
"@pnpm/plugin-commands-installation": minor
|
||||
---
|
||||
|
||||
When `saveLockfile` is set to `false`, no changes to `pnpm-lock.yaml` are written to the filesystem.
|
||||
@@ -25,6 +25,7 @@ export interface StrictInstallOptions {
|
||||
extraBinPaths: string[]
|
||||
hoistingLimits?: HoistingLimits
|
||||
useLockfile: boolean
|
||||
saveLockfile: boolean
|
||||
useGitBranchLockfile: boolean
|
||||
mergeGitBranchLockfiles: boolean
|
||||
linkWorkspacePackagesDepth: number
|
||||
@@ -173,6 +174,7 @@ const defaults = async (opts: InstallOptions) => {
|
||||
process.getuid() !== 0,
|
||||
update: false,
|
||||
useLockfile: true,
|
||||
saveLockfile: true,
|
||||
useGitBranchLockfile: false,
|
||||
mergeGitBranchLockfiles: false,
|
||||
userAgent: `${packageManager.name}/${packageManager.version} npm/? node/${process.version} ${process.platform} ${process.arch}`,
|
||||
|
||||
@@ -1030,7 +1030,7 @@ const _installInContext: InstallFunction = async (projects, ctx, opts) => {
|
||||
|
||||
const projectsWithTargetDirs = extendProjectsWithTargetDirs(projects, newLockfile, ctx)
|
||||
await Promise.all([
|
||||
opts.useLockfile
|
||||
opts.useLockfile && opts.saveLockfile
|
||||
? writeLockfiles({
|
||||
currentLockfile: result.currentLockfile,
|
||||
currentLockfileDir: ctx.virtualStoreDir,
|
||||
|
||||
@@ -83,8 +83,14 @@ export async function handler (
|
||||
},
|
||||
frozenLockfile: false,
|
||||
preferFrozenLockfile: false,
|
||||
saveLockfile: false,
|
||||
virtualStoreDir: path.join(deployDir, 'node_modules/.pnpm'),
|
||||
modulesDir: path.relative(deployedDir, path.join(deployDir, 'node_modules')),
|
||||
rawLocalConfig: {
|
||||
...opts.rawLocalConfig,
|
||||
// This is a workaround to prevent frozen install in CI envs.
|
||||
'frozen-lockfile': false,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,8 @@ test('deploy', async () => {
|
||||
production: true,
|
||||
recursive: true,
|
||||
selectedProjectsGraph,
|
||||
sharedWorkspaceLockfile: true,
|
||||
lockfileDir: process.cwd(),
|
||||
workspaceDir: process.cwd(),
|
||||
}, ['deploy'])
|
||||
|
||||
@@ -62,4 +64,5 @@ test('deploy', async () => {
|
||||
await project.hasNot('is-negative')
|
||||
expect(fs.existsSync('deploy/index.js')).toBeTruthy()
|
||||
expect(fs.existsSync('deploy/test.js')).toBeFalsy()
|
||||
expect(fs.existsSync('pnpm-lock.yaml')).toBeFalsy() // no changes to the lockfile are written
|
||||
})
|
||||
|
||||
@@ -288,6 +288,7 @@ export type InstallCommandOptions = Pick<Config,
|
||||
pruneDirectDependencies?: boolean
|
||||
pruneStore?: boolean
|
||||
recursive?: boolean
|
||||
saveLockfile?: boolean
|
||||
workspace?: boolean
|
||||
} & Partial<Pick<Config, 'modulesCacheMaxAge' | 'pnpmHomeDir' | 'preferWorkspacePackages'>>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user