mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-30 04:52:04 -04:00
fix: use the right pkg manager for building git-hosted deps (#7852)
close #7850
This commit is contained in:
6
.changeset/friendly-tips-search.md
Normal file
6
.changeset/friendly-tips-search.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/prepare-package": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
When building git-hosted dependencies, use the package manager required by the project [#7850](https://github.com/pnpm/pnpm/issues/7850).
|
||||
@@ -46,8 +46,15 @@ export async function preparePackage (opts: PreparePackageOptions, gitRootDir: s
|
||||
await runLifecycleHook(installScriptName, manifest, execOpts)
|
||||
for (const scriptName of PREPUBLISH_SCRIPTS) {
|
||||
if (manifest.scripts[scriptName] == null || manifest.scripts[scriptName] === '') continue
|
||||
let newScriptName
|
||||
if (pm !== 'pnpm') {
|
||||
newScriptName = `${pm}-run-${scriptName}`
|
||||
manifest.scripts[newScriptName] = `${pm} run ${scriptName}`
|
||||
} else {
|
||||
newScriptName = scriptName
|
||||
}
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await runLifecycleHook(scriptName, manifest, execOpts)
|
||||
await runLifecycleHook(newScriptName, manifest, execOpts)
|
||||
}
|
||||
} catch (err: unknown) {
|
||||
assert(util.types.isNativeError(err))
|
||||
|
||||
Reference in New Issue
Block a user