mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-25 10:31:55 -04:00
fix: never preserve symlinks
This commit is contained in:
@@ -41,5 +41,6 @@ export default (opts?: PnpmOptions): StrictPnpmOptions => {
|
||||
if (extendedOpts.flatTree === true && !extendedOpts.preserveSymlinks) {
|
||||
throw new Error('`--preserve-symlinks` and so `--flat-tree` are not supported on your system, make sure you are running on Node ≽ 6.3.0')
|
||||
}
|
||||
extendedOpts.preserveSymlinks = false // TODO: remove preserve-symlinks related code
|
||||
return extendedOpts
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ export default async function linkAllBins (modules: string, binPath: string, pre
|
||||
*/
|
||||
export async function linkPkgBins (target: string, binPath: string, preserveSymlinks: boolean) {
|
||||
const pkg = await safeRequireJson(path.join(target, 'package.json'))
|
||||
const targetRealPath = await fs.realpath(target)
|
||||
const extraNodePath = [path.join(targetRealPath, 'node_modules'), path.join(targetRealPath, '..', 'node_modules')]
|
||||
|
||||
if (!pkg) {
|
||||
logger.warn(`There's a directory in node_modules without package.json: ${target}`)
|
||||
@@ -40,7 +42,7 @@ export async function linkPkgBins (target: string, binPath: string, preserveSyml
|
||||
const targetPath = path.join(target, actualBin)
|
||||
|
||||
if (!preserveSymlinks) {
|
||||
const nodePath = getNodePaths(targetPath).join(path.delimiter)
|
||||
const nodePath = extraNodePath.concat(getNodePaths(targetPath)).join(path.delimiter)
|
||||
return cmdShim(targetPath, externalBinPath, {preserveSymlinks, nodePath})
|
||||
}
|
||||
|
||||
|
||||
@@ -840,7 +840,7 @@ test('shrinkwrap locks npm dependencies', async function (t) {
|
||||
|
||||
await install(testDefaults({cacheTTL: 0}))
|
||||
|
||||
const pkg = project.requireModule('pkg-with-1-dep/node_modules/dep-of-pkg-with-1-dep/package.json')
|
||||
const pkg = project.requireModule('.resolutions/localhost+4873/pkg-with-1-dep/100.0.0/node_modules/dep-of-pkg-with-1-dep/package.json')
|
||||
|
||||
t.equal(pkg.version, '100.0.0', 'dependency specified in shrinkwrap.yaml is installed')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user