mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-22 15:02:11 +08:00
fix(@angular/cli): Bail out if output path is the root folder pt2 (#4518)
Followup from #4490
This commit is contained in:
parent
59029c38eb
commit
488185b4a8
@ -1,6 +1,7 @@
|
|||||||
import * as rimraf from 'rimraf';
|
import * as rimraf from 'rimraf';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
const Task = require('../ember-cli/lib/models/task');
|
const Task = require('../ember-cli/lib/models/task');
|
||||||
|
const SilentError = require('silent-error');
|
||||||
import * as webpack from 'webpack';
|
import * as webpack from 'webpack';
|
||||||
import { BuildTaskOptions } from '../commands/build';
|
import { BuildTaskOptions } from '../commands/build';
|
||||||
import { NgCliWebpackConfig } from '../models/webpack-config';
|
import { NgCliWebpackConfig } from '../models/webpack-config';
|
||||||
@ -14,6 +15,9 @@ export default Task.extend({
|
|||||||
const project = this.cliProject;
|
const project = this.cliProject;
|
||||||
|
|
||||||
const outputPath = runTaskOptions.outputPath || CliConfig.fromProject().config.apps[0].outDir;
|
const outputPath = runTaskOptions.outputPath || CliConfig.fromProject().config.apps[0].outDir;
|
||||||
|
if (project.root === outputPath) {
|
||||||
|
throw new SilentError ('Output path MUST not be project root directory!');
|
||||||
|
}
|
||||||
rimraf.sync(path.resolve(project.root, outputPath));
|
rimraf.sync(path.resolve(project.root, outputPath));
|
||||||
|
|
||||||
const webpackConfig = new NgCliWebpackConfig(runTaskOptions).config;
|
const webpackConfig = new NgCliWebpackConfig(runTaskOptions).config;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user