pnpm install --shamefully-hoist works

This commit is contained in:
Empathic Qubit 2020-09-05 01:03:40 -04:00
parent f2c83c1bc3
commit ed4c3aaaec
2 changed files with 3 additions and 7 deletions

View file

@ -1,7 +1,6 @@
import * as path from 'path';
import * as fs from 'fs';
import * as cp from 'child_process';
import * as denodeify from 'denodeify';
import * as parseSemver from 'parse-semver';
import * as _ from 'lodash';
import { CancellationToken } from './util';
@ -113,16 +112,13 @@ async function asPnpmDependency(prefix: string, tree: PnpmTreeNode, prune: boole
}
let name = tree.name || tree.from;
let s = path.sep;
const dependencyPath = await denodeify(fs.realpath)(`${prefix}${s}${name}`);
const dependencyPath = path.join(prefix, name);
const children: YarnDependency[] = [];
console.log(dependencyPath);
const deps = await Promise.all(
_.values(tree.dependencies || {})
.map(child => asPnpmDependency(`${dependencyPath}${s}..`, child, prune))
.map(child => asPnpmDependency(prefix, child, prune))
);
for(const dep of deps) {
if (dep) {

View file

@ -923,7 +923,7 @@ const defaultIgnore = [
function collectAllFiles(cwd: string, useYarn = false, usePackageManager: "yarn" | "npm" | "pnpm" = "npm", dependencyEntryPoints?: string[]): Promise<string[]> {
return getDependencies(cwd, useYarn, usePackageManager, dependencyEntryPoints).then(deps => {
const promises: Promise<string[]>[] = deps.map(dep => {
return glob('**', { cwd: dep, nodir: true, dot: true, ignore: 'node_modules/**' })
return glob('**', { cwd: dep, nodir: true, dot: true, follow: usePackageManager == "pnpm", ignore: 'node_modules/**' })
.then(files => files
.map(f => path.relative(cwd, path.join(dep, f)))
.map(f => f.replace(/\\/g, '/')));