mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-24 23:58:07 -05:00
fix(deploy): ensure that the deploy target is generated in the same directory (#6859)
close #6858 --------- Co-authored-by: Zoltan Kochan <z@kochan.io>
This commit is contained in:
7
.changeset/moody-bobcats-yell.md
Normal file
7
.changeset/moody-bobcats-yell.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-installation": patch
|
||||
"@pnpm/plugin-commands-deploy": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Always set `dedupe-peer-dependents` to `false`, when running installation during deploy [#6858](https://github.com/pnpm/pnpm/issues/6858).
|
||||
@@ -250,6 +250,7 @@ export type InstallCommandOptions = Pick<Config,
|
||||
| 'bail'
|
||||
| 'bin'
|
||||
| 'cliOptions'
|
||||
| 'dedupePeerDependents'
|
||||
| 'deployAllFiles'
|
||||
| 'depth'
|
||||
| 'dev'
|
||||
|
||||
@@ -79,6 +79,11 @@ export async function handler (
|
||||
await install.handler({
|
||||
...opts,
|
||||
confirmModulesPurge: false,
|
||||
// Deploy doesn't work with dedupePeerDependents=true currently as for deploy
|
||||
// we need to select a single project for install, while dedupePeerDependents
|
||||
// doesn't work with filters right now.
|
||||
// Related issue: https://github.com/pnpm/pnpm/issues/6858
|
||||
dedupePeerDependents: false,
|
||||
depth: Infinity,
|
||||
hooks: {
|
||||
...opts.hooks,
|
||||
|
||||
@@ -74,3 +74,52 @@ test('deploy', async () => {
|
||||
expect(fs.existsSync('deploy/node_modules/.pnpm/file+project-3/node_modules/project-3/test.js')).toBeFalsy()
|
||||
expect(fs.existsSync('pnpm-lock.yaml')).toBeFalsy() // no changes to the lockfile are written
|
||||
})
|
||||
|
||||
test('deploy with dedupePeerDependents=true ignores the value of dedupePeerDependents', async () => {
|
||||
preparePackages([
|
||||
{
|
||||
name: 'project-1',
|
||||
version: '1.0.0',
|
||||
dependencies: {
|
||||
'is-positive': '1.0.0',
|
||||
},
|
||||
},
|
||||
{
|
||||
location: './sub-dir/project-2',
|
||||
package: {
|
||||
name: 'project-2',
|
||||
version: '2.0.0',
|
||||
dependencies: {
|
||||
'is-odd': '1.0.0',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'project-3',
|
||||
version: '2.0.0',
|
||||
dependencies: {
|
||||
'is-number': '1.0.0',
|
||||
},
|
||||
},
|
||||
])
|
||||
|
||||
const { allProjects, selectedProjectsGraph, allProjectsGraph } = await readProjects(process.cwd(), [{ namePattern: 'project-1' }])
|
||||
|
||||
await deploy.handler({
|
||||
...DEFAULT_OPTS,
|
||||
allProjects,
|
||||
allProjectsGraph,
|
||||
dir: process.cwd(),
|
||||
dev: false,
|
||||
production: true,
|
||||
recursive: true,
|
||||
selectedProjectsGraph,
|
||||
sharedWorkspaceLockfile: true,
|
||||
lockfileDir: process.cwd(),
|
||||
workspaceDir: process.cwd(),
|
||||
dedupePeerDependents: true, // This is ignored by deploy
|
||||
}, ['deploy'])
|
||||
const project = assertProject(path.resolve('deploy'))
|
||||
await project.has('is-positive')
|
||||
expect(fs.existsSync('sub-dir/deploy')).toBe(false)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user