mirror of
https://github.com/pnpm/pnpm.git
synced 2026-02-02 19:22:52 -05:00
fix: add nodeLinker field to node_modules/.modules.yaml
This commit is contained in:
7
.changeset/weak-clouds-train.md
Normal file
7
.changeset/weak-clouds-train.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
"@pnpm/core": patch
|
||||
"@pnpm/headless": patch
|
||||
"@pnpm/modules-yaml": patch
|
||||
---
|
||||
|
||||
Save the value of the active `nodeLinker` to `node_modules/.modules.yaml`.
|
||||
@@ -897,6 +897,7 @@ const _installInContext: InstallFunction = async (projects, ctx, opts) => {
|
||||
hoistPattern: ctx.hoistPattern,
|
||||
included: ctx.include,
|
||||
layoutVersion: LAYOUT_VERSION,
|
||||
nodeLinker: opts.nodeLinker,
|
||||
packageManager: `${opts.packageManager.name}@${opts.packageManager.version}`,
|
||||
pendingBuilds: ctx.pendingBuilds,
|
||||
publicHoistPattern: ctx.publicHoistPattern,
|
||||
|
||||
@@ -3,6 +3,7 @@ import path from 'path'
|
||||
import { addDependenciesToPackage, install, mutateModules } from '@pnpm/core'
|
||||
import { prepareEmpty } from '@pnpm/prepare'
|
||||
import { sync as loadJsonFile } from 'load-json-file'
|
||||
import { sync as readYamlFile } from 'read-yaml-file'
|
||||
import { addDistTag, testDefaults } from '../utils'
|
||||
|
||||
test('installing with hoisted node-linker', async () => {
|
||||
@@ -22,6 +23,8 @@ test('installing with hoisted node-linker', async () => {
|
||||
expect(fs.realpathSync('node_modules/has-flag')).toEqual(path.resolve('node_modules/has-flag'))
|
||||
expect(fs.realpathSync('node_modules/ms')).toEqual(path.resolve('node_modules/ms'))
|
||||
expect(fs.existsSync('node_modules/send/node_modules/ms')).toBeTruthy()
|
||||
|
||||
expect(readYamlFile<{ nodeLinker: string }>('node_modules/.modules.yaml').nodeLinker).toBe('hoisted')
|
||||
})
|
||||
|
||||
test('installing with hoisted node-linker and no lockfile', async () => {
|
||||
|
||||
@@ -448,6 +448,7 @@ export default async (opts: HeadlessOptions) => {
|
||||
hoistPattern: opts.hoistPattern,
|
||||
included: opts.include,
|
||||
layoutVersion: LAYOUT_VERSION,
|
||||
nodeLinker: opts.nodeLinker,
|
||||
packageManager: `${opts.packageManager.name}@${opts.packageManager.version}`,
|
||||
pendingBuilds: opts.pendingBuilds,
|
||||
publicHoistPattern: opts.publicHoistPattern,
|
||||
|
||||
@@ -18,6 +18,7 @@ export interface Modules {
|
||||
hoistPattern?: string[]
|
||||
included: IncludedDependencies
|
||||
layoutVersion: number
|
||||
nodeLinker?: 'hoisted' | 'isolated' | 'pnp'
|
||||
packageManager: string
|
||||
pendingBuilds: string[]
|
||||
prunedAt: string
|
||||
|
||||
Reference in New Issue
Block a user