Skip to content

Commit

Permalink
fix(@angular/cli): Bail out if output path is the root folder pt2
Browse files Browse the repository at this point in the history
Followup from angular#4490
  • Loading branch information
filipesilva committed Feb 9, 2017
1 parent 59029c3 commit f33c473
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/@angular/cli/tasks/build.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as rimraf from 'rimraf';
import * as path from 'path';
const Task = require('../ember-cli/lib/models/task');
const SilentError = require('silent-error');
import * as webpack from 'webpack';
import { BuildTaskOptions } from '../commands/build';
import { NgCliWebpackConfig } from '../models/webpack-config';
Expand All @@ -14,6 +15,9 @@ export default Task.extend({
const project = this.cliProject;

const outputPath = runTaskOptions.outputPath || CliConfig.fromProject().config.apps[0].outDir;
if (this.project.root === outputPath) {
throw new SilentError ('Output path MUST not be project root directory!');
}
rimraf.sync(path.resolve(project.root, outputPath));

const webpackConfig = new NgCliWebpackConfig(runTaskOptions).config;
Expand Down

0 comments on commit f33c473

Please sign in to comment.