|
1 | | -import { resolve, dirname } from 'path'; |
2 | 1 | import Config from 'webpack-chain'; |
3 | 2 | import { existsSync } from 'fs'; |
4 | | -import get from 'lodash.get'; |
5 | 3 |
|
6 | | -import { getProjectFilePath, getProjectRootPath } from '../helpers/project'; |
7 | | -import { getEntryPath, getPlatformName } from '../helpers/platform'; |
| 4 | +import { getProjectFilePath } from '../helpers/project'; |
8 | 5 | import { env as _env, IWebpackEnv } from '../index'; |
| 6 | +import { getEntryPath } from '../helpers/platform'; |
9 | 7 | import base from './base'; |
10 | 8 |
|
11 | 9 | export default function (config: Config, env: IWebpackEnv = _env): Config { |
@@ -59,37 +57,3 @@ function getAngularCompilerPlugin() { |
59 | 57 | const { AngularCompilerPlugin } = require('@ngtools/webpack'); |
60 | 58 | return AngularCompilerPlugin; |
61 | 59 | } |
62 | | - |
63 | | -// todo: move into project helper if used elsewhere |
64 | | -// todo: write tests |
65 | | -function findFile(fileName, currentDir): string | null { |
66 | | - // console.log(`findFile(${fileName}, ${currentDir})`) |
67 | | - const path = resolve(currentDir, fileName); |
68 | | - |
69 | | - if (existsSync(path)) { |
70 | | - return path; |
71 | | - } |
72 | | - |
73 | | - // bail if we reached the root dir |
74 | | - if (currentDir === resolve('/')) { |
75 | | - return null; |
76 | | - } |
77 | | - |
78 | | - // traverse to the parent folder |
79 | | - return findFile(fileName, resolve(currentDir, '..')); |
80 | | -} |
81 | | - |
82 | | -function findWorkspaceConfig(): string { |
83 | | - const possibleConfigNames = ['angular.json', 'workspace.json']; |
84 | | - |
85 | | - for (const name of possibleConfigNames) { |
86 | | - const path = findFile(name, getProjectRootPath()); |
87 | | - |
88 | | - if (path) { |
89 | | - return path; |
90 | | - } |
91 | | - } |
92 | | - |
93 | | - // not found |
94 | | - return null; |
95 | | -} |
0 commit comments