mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-24 07:38:12 -05:00
5
.changeset/good-gifts-teach.md
Normal file
5
.changeset/good-gifts-teach.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/config": patch
|
||||
---
|
||||
|
||||
Always resolve the target directory to its real path.
|
||||
5
.changeset/short-glasses-grab.md
Normal file
5
.changeset/short-glasses-grab.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-installation": patch
|
||||
---
|
||||
|
||||
The real path of linked package should be used when installing its dependencies.
|
||||
@@ -39,6 +39,7 @@
|
||||
"camelcase": "^6.2.0",
|
||||
"is-subdir": "^1.1.1",
|
||||
"ramda": "^0.27.1",
|
||||
"realpath-missing": "^1.0.0",
|
||||
"which": "^2.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -48,6 +49,7 @@
|
||||
"@types/ramda": "^0.27.34",
|
||||
"@types/which": "^1.3.2",
|
||||
"mz": "^2.7.0",
|
||||
"symlink-dir": "^4.1.0",
|
||||
"tempy": "^1.0.0"
|
||||
},
|
||||
"funding": "https://opencollective.com/pnpm"
|
||||
|
||||
@@ -13,6 +13,7 @@ import path = require('path')
|
||||
import loadNpmConf = require('@zkochan/npm-conf')
|
||||
import npmTypes = require('@zkochan/npm-conf/lib/types')
|
||||
import R = require('ramda')
|
||||
import realpathMissing = require('realpath-missing')
|
||||
import whichcb = require('which')
|
||||
|
||||
export { Config, UniversalOptions }
|
||||
@@ -138,6 +139,7 @@ export default async (
|
||||
} catch (err) {} // eslint-disable-line:no-empty
|
||||
|
||||
if (cliOptions.dir) {
|
||||
cliOptions.dir = await realpathMissing(cliOptions.dir)
|
||||
cliOptions['prefix'] = cliOptions.dir // the npm config system still expects `prefix`
|
||||
}
|
||||
const rcOptionsTypes = { ...types, ...opts.rcOptionsTypes }
|
||||
@@ -190,7 +192,7 @@ export default async (
|
||||
...Object.keys(rcOptionsTypes).map((configKey) => [camelcase(configKey), npmConfig.get(configKey)]) as any, // eslint-disable-line
|
||||
...Object.entries(cliOptions).filter(([name, value]) => typeof value !== 'undefined').map(([name, value]) => [camelcase(name), value]),
|
||||
]) as unknown as ConfigWithDeprecatedSettings
|
||||
const cwd = (cliOptions['dir'] && path.resolve(cliOptions['dir'])) ?? npmConfig.localPrefix // eslint-disable-line
|
||||
const cwd = (cliOptions.dir && path.resolve(cliOptions.dir)) ?? npmConfig.localPrefix
|
||||
pnpmConfig.workspaceDir = opts.workspaceDir
|
||||
pnpmConfig.rawLocalConfig = Object.assign.apply(Object, [
|
||||
{},
|
||||
@@ -243,7 +245,7 @@ export default async (
|
||||
if (cliOptions['global']) {
|
||||
pnpmConfig.save = true
|
||||
pnpmConfig.dir = path.join(pnpmConfig.globalDir, LAYOUT_VERSION.toString())
|
||||
pnpmConfig.bin = cliOptions['dir']
|
||||
pnpmConfig.bin = cliOptions.dir
|
||||
? (
|
||||
process.platform === 'win32'
|
||||
? cliOptions.dir : path.resolve(cliOptions.dir, 'bin')
|
||||
|
||||
@@ -6,6 +6,7 @@ import prepare from '@pnpm/prepare'
|
||||
import './findBestGlobalPrefixOnWindows'
|
||||
import fs = require('mz/fs')
|
||||
import path = require('path')
|
||||
import symlinkDir = require('symlink-dir')
|
||||
import tempy = require('tempy')
|
||||
|
||||
// To override any local settings,
|
||||
@@ -182,7 +183,6 @@ test('when using --global, link-workspace-packages, shared-workspace-shrinwrap a
|
||||
test('registries of scoped packages are read', async () => {
|
||||
const { config } = await getConfig({
|
||||
cliOptions: {
|
||||
dir: 'workspace',
|
||||
userconfig: path.join(__dirname, 'scoped-registries.ini'),
|
||||
},
|
||||
packageManager: {
|
||||
@@ -611,3 +611,19 @@ test('respects test-pattern', async () => {
|
||||
expect(config.testPattern).toEqual(['*.spec.js', '*.spec.ts'])
|
||||
}
|
||||
})
|
||||
|
||||
test('dir is resolved to real path', async () => {
|
||||
const tmpDir = tempy.directory()
|
||||
const realDir = path.join(tmpDir, 'real-path')
|
||||
await fs.mkdir(realDir)
|
||||
const symlink = path.join(tmpDir, 'symlink')
|
||||
await symlinkDir(realDir, symlink)
|
||||
const { config } = await getConfig({
|
||||
cliOptions: { dir: symlink },
|
||||
packageManager: {
|
||||
name: 'pnpm',
|
||||
version: '1.0.0',
|
||||
},
|
||||
})
|
||||
expect(config.dir).toBe(realDir)
|
||||
})
|
||||
|
||||
4
pnpm-lock.yaml
generated
4
pnpm-lock.yaml
generated
@@ -224,6 +224,7 @@ importers:
|
||||
camelcase: 6.2.0
|
||||
is-subdir: 1.1.1
|
||||
ramda: 0.27.1
|
||||
realpath-missing: 1.0.0
|
||||
which: 2.0.2
|
||||
devDependencies:
|
||||
'@pnpm/config': 'link:'
|
||||
@@ -232,6 +233,7 @@ importers:
|
||||
'@types/ramda': 0.27.34
|
||||
'@types/which': 1.3.2
|
||||
mz: 2.7.0
|
||||
symlink-dir: 4.1.0
|
||||
tempy: 1.0.0
|
||||
specifiers:
|
||||
'@pnpm/config': 'link:'
|
||||
@@ -248,6 +250,8 @@ importers:
|
||||
is-subdir: ^1.1.1
|
||||
mz: ^2.7.0
|
||||
ramda: ^0.27.1
|
||||
realpath-missing: ^1.0.0
|
||||
symlink-dir: ^4.1.0
|
||||
tempy: ^1.0.0
|
||||
which: ^2.0.2
|
||||
packages/constants:
|
||||
|
||||
Reference in New Issue
Block a user