Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(link): change package version when exec link #4375

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/core/src/link/index.ts
Expand Up @@ -78,10 +78,13 @@ export default async function link (
throw new PnpmError('INVALID_PACKAGE_NAME', `Package in ${linkFromPath} must have a name field to be linked`)
}

// if the package already exists and lock version, its version should not be changed
const shouldModifyVersion = maybeOpts.linkToBin ?? !/^\d.*/.test((opts.manifest?.dependencies ?? {})[manifest.name])
BlackHole1 marked this conversation as resolved.
Show resolved Hide resolved

specsToUpsert.push({
alias: manifest.name,
pref: getPref(manifest.name, manifest.name, manifest.version, {
pinnedVersion: opts.pinnedVersion,
pinnedVersion: shouldModifyVersion ? opts.pinnedVersion : 'patch',
BlackHole1 marked this conversation as resolved.
Show resolved Hide resolved
}),
saveType: (opts.targetDependenciesField ?? (ctx.manifest && guessDependencyType(manifest.name, ctx.manifest))) as DependenciesField,
})
Expand Down