(names: string | string[], from: string)
| 16 | import { WorkspaceNodeModulesArchitectHost } from '../node/index'; |
| 17 | |
| 18 | function findUp(names: string | string[], from: string) { |
| 19 | const filenames = Array.isArray(names) ? names : [names]; |
| 20 | |
| 21 | let currentDir = path.resolve(from); |
| 22 | while (true) { |
| 23 | for (const name of filenames) { |
| 24 | const p = path.join(currentDir, name); |
| 25 | if (existsSync(p)) { |
| 26 | return p; |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | const parentDir = path.dirname(currentDir); |
| 31 | if (parentDir === currentDir) { |
| 32 | break; |
| 33 | } |
| 34 | |
| 35 | currentDir = parentDir; |
| 36 | } |
| 37 | |
| 38 | return null; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Show usage of the CLI tool, and exit the process. |
no test coverage detected