Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .changeset/long-spiders-smoke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
"@pnpm/resolve-dependencies": minor
"@pnpm/package-requester": minor
"@pnpm/store-controller-types": minor
"@pnpm/lockfile.settings-checker": minor
"@pnpm/resolver-base": minor
"@pnpm/npm-resolver": minor
"@pnpm/core": minor
"@pnpm/lockfile.types": minor
"@pnpm/config": minor
"@pnpm/deps.status": minor
"pnpm": minor
---

A new setting, `inject-workspace-packages`, has been added to allow hard-linking all local workspace dependencies instead of symlinking them. Previously, this behavior was achievable via the [`dependenciesMeta[].injected`](https://pnpm.io/package_json#dependenciesmetainjected) setting, which remains supported [#8836](https://github.com/pnpm/pnpm/pull/8836).
1 change: 1 addition & 0 deletions config/config/src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export interface Config {
reporter?: string
aggregateOutput: boolean
linkWorkspacePackages: boolean | 'deep'
injectWorkspacePackages?: boolean
preferWorkspacePackages: boolean
reverse: boolean
sort: boolean
Expand Down
1 change: 1 addition & 0 deletions config/config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export async function getConfig (opts: {
'hoist-workspace-packages': true,
'ignore-workspace-cycles': false,
'ignore-workspace-root-check': false,
'inject-workspace-packages': false,
'link-workspace-packages': false,
'lockfile-include-tarball-url': false,
'manage-package-manager-versions': true,
Expand Down
1 change: 1 addition & 0 deletions config/config/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const types = Object.assign({
'ignore-workspace-cycles': Boolean,
'ignore-workspace-root-check': Boolean,
'include-workspace-root': Boolean,
'inject-workspace-packages': Boolean,
'legacy-dir-filtering': Boolean,
'link-workspace-packages': [Boolean, 'deep'],
lockfile: Boolean,
Expand Down
6 changes: 6 additions & 0 deletions deps/status/src/checkDepsStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export type CheckDepsStatusOptions = Pick<Config,
| 'autoInstallPeers'
| 'catalogs'
| 'excludeLinksFromLockfile'
| 'injectWorkspacePackages'
| 'linkWorkspacePackages'
| 'hooks'
| 'peersSuffixMaxLength'
Expand Down Expand Up @@ -74,6 +75,7 @@ async function _checkDepsStatus (opts: CheckDepsStatusOptions): Promise<{ upToDa
const {
allProjects,
autoInstallPeers,
injectWorkspacePackages,
catalogs,
excludeLinksFromLockfile,
linkWorkspacePackages,
Expand Down Expand Up @@ -192,6 +194,7 @@ async function _checkDepsStatus (opts: CheckDepsStatusOptions): Promise<{ upToDa

const assertCtx: AssertWantedLockfileUpToDateContext = {
autoInstallPeers,
injectWorkspacePackages,
config: opts,
excludeLinksFromLockfile,
linkWorkspacePackages,
Expand Down Expand Up @@ -272,6 +275,7 @@ async function _checkDepsStatus (opts: CheckDepsStatusOptions): Promise<{ upToDa
logger.debug({ msg: 'The manifest is newer than the lockfile. Continuing check.' })
await assertWantedLockfileUpToDate({
autoInstallPeers,
injectWorkspacePackages,
config: opts,
excludeLinksFromLockfile,
linkWorkspacePackages,
Expand Down Expand Up @@ -311,6 +315,7 @@ interface AssertWantedLockfileUpToDateContext {
autoInstallPeers?: boolean
config: CheckDepsStatusOptions
excludeLinksFromLockfile?: boolean
injectWorkspacePackages?: boolean
linkWorkspacePackages: boolean | 'deep'
getManifestsByDir: () => Record<string, DependencyManifest>
getWorkspacePackages: () => WorkspacePackages | undefined
Expand Down Expand Up @@ -359,6 +364,7 @@ async function assertWantedLockfileUpToDate (

const outdatedLockfileSettingName = getOutdatedLockfileSetting(wantedLockfile, {
autoInstallPeers: config.autoInstallPeers,
injectWorkspacePackages: config.injectWorkspacePackages,
excludeLinksFromLockfile: config.excludeLinksFromLockfile,
peersSuffixMaxLength: config.peersSuffixMaxLength,
overrides: createOverridesMapFromParsed(parseOverrides(rootManifestOptions?.overrides ?? {}, config.catalogs)),
Expand Down
3 changes: 3 additions & 0 deletions lockfile/fs/src/lockfileFormatConverters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ export function convertToLockfileFile (lockfile: Lockfile, opts: NormalizeLockfi
if (newLockfile.settings?.peersSuffixMaxLength === 1000) {
newLockfile.settings = omit(['peersSuffixMaxLength'], newLockfile.settings)
}
if (newLockfile.settings?.injectWorkspacePackages === false) {
delete newLockfile.settings.injectWorkspacePackages
}
return normalizeLockfile(newLockfile, opts)
}

Expand Down
6 changes: 6 additions & 0 deletions lockfile/settings-checker/src/getOutdatedLockfileSetting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type ChangedField =
| 'settings.autoInstallPeers'
| 'settings.excludeLinksFromLockfile'
| 'settings.peersSuffixMaxLength'
| 'settings.injectWorkspacePackages'
| 'pnpmfileChecksum'

export function getOutdatedLockfileSetting (
Expand All @@ -22,6 +23,7 @@ export function getOutdatedLockfileSetting (
excludeLinksFromLockfile,
peersSuffixMaxLength,
pnpmfileChecksum,
injectWorkspacePackages,
}: {
overrides?: Record<string, string>
packageExtensionsChecksum?: string
Expand All @@ -31,6 +33,7 @@ export function getOutdatedLockfileSetting (
excludeLinksFromLockfile?: boolean
peersSuffixMaxLength?: number
pnpmfileChecksum?: string
injectWorkspacePackages?: boolean
}
): ChangedField | null {
if (!equals(lockfile.overrides ?? {}, overrides ?? {})) {
Expand Down Expand Up @@ -60,5 +63,8 @@ export function getOutdatedLockfileSetting (
if (lockfile.pnpmfileChecksum !== pnpmfileChecksum) {
return 'pnpmfileChecksum'
}
if (Boolean(lockfile.settings?.injectWorkspacePackages) !== Boolean(injectWorkspacePackages)) {
return 'settings.injectWorkspacePackages'
}
return null
}
1 change: 1 addition & 0 deletions lockfile/types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface LockfileSettings {
autoInstallPeers?: boolean
excludeLinksFromLockfile?: boolean
peersSuffixMaxLength?: number
injectWorkspacePackages?: boolean
}

export interface Lockfile {
Expand Down
2 changes: 1 addition & 1 deletion pkg-manager/core/src/getPeerDependencyIssues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export async function getPeerDependencyIssues (
const projectsToResolve = Object.values(ctx.projects).map((project) => ({
...project,
updatePackageManifest: false,
wantedDependencies: getWantedDependencies(project.manifest),
wantedDependencies: getWantedDependencies(project.manifest, opts),
}))
const preferredVersions = getPreferredVersionsFromLockfileAndManifests(
ctx.wantedLockfile.packages,
Expand Down
1 change: 1 addition & 0 deletions pkg-manager/core/src/install/extendInstallOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ export interface StrictInstallOptions {
peersSuffixMaxLength: number
prepareExecutionEnv?: PrepareExecutionEnv
returnListOfDepsRequiringBuild?: boolean
injectWorkspacePackages?: boolean
}

export type InstallOptions =
Expand Down
5 changes: 5 additions & 0 deletions pkg-manager/core/src/install/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ export async function mutateModules (
if (!opts.ignorePackageManifest) {
const outdatedLockfileSettingName = getOutdatedLockfileSetting(ctx.wantedLockfile, {
autoInstallPeers: opts.autoInstallPeers,
injectWorkspacePackages: opts.injectWorkspacePackages,
excludeLinksFromLockfile: opts.excludeLinksFromLockfile,
peersSuffixMaxLength: opts.peersSuffixMaxLength,
overrides: overridesMap,
Expand All @@ -384,6 +385,7 @@ export async function mutateModules (
autoInstallPeers: opts.autoInstallPeers,
excludeLinksFromLockfile: opts.excludeLinksFromLockfile,
peersSuffixMaxLength: opts.peersSuffixMaxLength,
injectWorkspacePackages: opts.injectWorkspacePackages,
}
ctx.wantedLockfile.overrides = overridesMap
ctx.wantedLockfile.packageExtensionsChecksum = packageExtensionsChecksum
Expand All @@ -395,6 +397,7 @@ export async function mutateModules (
autoInstallPeers: opts.autoInstallPeers,
excludeLinksFromLockfile: opts.excludeLinksFromLockfile,
peersSuffixMaxLength: opts.peersSuffixMaxLength,
injectWorkspacePackages: opts.injectWorkspacePackages,
}
}
if (
Expand Down Expand Up @@ -976,6 +979,7 @@ const _installInContext: InstallFunction = async (projects, ctx, opts) => {
resolvePeersFromWorkspaceRoot: opts.resolvePeersFromWorkspaceRoot,
supportedArchitectures: opts.supportedArchitectures,
peersSuffixMaxLength: opts.peersSuffixMaxLength,
injectWorkspacePackages: opts.injectWorkspacePackages,
}
)
if (!opts.include.optionalDependencies || !opts.include.devDependencies || !opts.include.dependencies) {
Expand Down Expand Up @@ -1355,6 +1359,7 @@ const installInContext: InstallFunction = async (projects, ctx, opts) => {
includeDirect: opts.includeDirect,
updateWorkspaceDependencies: false,
nodeExecPath: opts.nodeExecPath,
injectWorkspacePackages: opts.injectWorkspacePackages,
}
for (const project of allProjectsLocatedInsideWorkspace) {
if (!newProjects.some(({ rootDir }) => rootDir === project.rootDir)) {
Expand Down
Loading
Loading