chore: clean up unused code

This commit is contained in:
Igor Randjelovic
2021-03-29 01:20:43 +02:00
parent 7594d00ed9
commit c55782bfaf
3 changed files with 23 additions and 42 deletions

View File

@ -1,11 +1,9 @@
import { resolve, dirname } from 'path';
import Config from 'webpack-chain';
import { existsSync } from 'fs';
import get from 'lodash.get';
import { getProjectFilePath, getProjectRootPath } from '../helpers/project';
import { getEntryPath, getPlatformName } from '../helpers/platform';
import { getProjectFilePath } from '../helpers/project';
import { env as _env, IWebpackEnv } from '../index';
import { getEntryPath } from '../helpers/platform';
import base from './base';
export default function (config: Config, env: IWebpackEnv = _env): Config {
@ -59,37 +57,3 @@ function getAngularCompilerPlugin() {
const { AngularCompilerPlugin } = require('@ngtools/webpack');
return AngularCompilerPlugin;
}
// todo: move into project helper if used elsewhere
// todo: write tests
function findFile(fileName, currentDir): string | null {
// console.log(`findFile(${fileName}, ${currentDir})`)
const path = resolve(currentDir, fileName);
if (existsSync(path)) {
return path;
}
// bail if we reached the root dir
if (currentDir === resolve('/')) {
return null;
}
// traverse to the parent folder
return findFile(fileName, resolve(currentDir, '..'));
}
function findWorkspaceConfig(): string {
const possibleConfigNames = ['angular.json', 'workspace.json'];
for (const name of possibleConfigNames) {
const path = findFile(name, getProjectRootPath());
if (path) {
return path;
}
}
// not found
return null;
}