mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-16 18:43:42 +08:00
refactor(@angular-devkit/build-angular): remove unused findUp
method
This commit is contained in:
parent
52d14d7261
commit
2cf374a0fc
@ -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[] = [];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user