Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(@angular/cli): Bail out if output path is the root folder pt2 #4518

Merged
merged 1 commit into from
Feb 9, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 (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