Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(deploy): inject all types of deps (#5084)
close #5078
- Loading branch information
Showing
7 changed files
with
64 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@pnpm/plugin-commands-deploy": patch | ||
"pnpm": patch | ||
--- | ||
|
||
`pnpm deploy` should inject local dependencies of all types (dependencies, optionalDependencies, devDependencies) [#5078](https://github.com/pnpm/pnpm/issues/5078). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { DEPENDENCIES_FIELDS } from '@pnpm/types' | ||
|
||
export function deployHook (pkg: any) { // eslint-disable-line | ||
pkg.dependenciesMeta = pkg.dependenciesMeta || {} | ||
for (const depField of DEPENDENCIES_FIELDS) { | ||
for (const [depName, depVersion] of Object.entries(pkg[depField] ?? {})) { | ||
if ((depVersion as string).startsWith('workspace:')) { | ||
pkg.dependenciesMeta[depName] = { | ||
injected: true, | ||
} | ||
} | ||
} | ||
} | ||
return pkg | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { deployHook } from '../src/deployHook' | ||
|
||
test('deployHook()', () => { | ||
expect(deployHook({ | ||
dependencies: { | ||
a: 'workspace:1', | ||
}, | ||
devDependencies: { | ||
b: 'workspace:2', | ||
}, | ||
optionalDependencies: { | ||
c: 'workspace:3', | ||
}, | ||
})).toStrictEqual({ | ||
dependencies: { | ||
a: 'workspace:1', | ||
}, | ||
devDependencies: { | ||
b: 'workspace:2', | ||
}, | ||
optionalDependencies: { | ||
c: 'workspace:3', | ||
}, | ||
dependenciesMeta: { | ||
a: { | ||
injected: true, | ||
}, | ||
b: { | ||
injected: true, | ||
}, | ||
c: { | ||
injected: true, | ||
}, | ||
}, | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,9 @@ | |
}, | ||
{ | ||
"path": "../plugin-commands-installation" | ||
}, | ||
{ | ||
"path": "../types" | ||
} | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.