Skip to content

Commit

Permalink
refactor(@angular-devkit/build-angular): remove unused findUp method
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-agius4 committed Feb 2, 2021
1 parent 52d14d7 commit 2cf374a
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions packages/angular_devkit/build_angular/src/utils/find-up.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [];

Expand Down

0 comments on commit 2cf374a

Please sign in to comment.