refactor(@angular-devkit/build-angular): remove unused findUp method

This commit is contained in:
Alan Agius 2021-02-02 11:14:12 +01:00
parent 52d14d7261
commit 2cf374a0fc

View File

@ -9,34 +9,6 @@ import { existsSync } from 'fs';
import * as path from 'path';
import { isDirectory } from './is-directory';
export function findUp(names: string | string[], from: string, stopOnNodeModules = false): string | null {
if (!Array.isArray(names)) {
names = [names];
}
const root = path.parse(from).root;
let currentDir = from;
while (currentDir && currentDir !== root) {
for (const name of names) {
const p = path.join(currentDir, name);
if (existsSync(p)) {
return p;
}
}
if (stopOnNodeModules) {
const nodeModuleP = path.join(currentDir, 'node_modules');
if (existsSync(nodeModuleP)) {
return null;
}
}
currentDir = path.dirname(currentDir);
}
return null;
}
export function findAllNodeModules(from: string, root?: string): string[] {
const nodeModules: string[] = [];