Skip to content

Commit

Permalink
fix(@angular/cli): Bail out if output path is the root folder (angula…
Browse files Browse the repository at this point in the history
…r#4490)

`ng serve` --output-path=. would wipe out the entire root folder.
  • Loading branch information
catull authored and MRHarrison committed Feb 9, 2017
1 parent 976d9fd commit 66ce243
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/@angular/cli/tasks/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export default Task.extend({
const appConfig = projectConfig.apps[0];

const outputPath = serveTaskOptions.outputPath || appConfig.outDir;
if (this.project.root === outputPath) {
throw new SilentError ('Output path MUST not be project root directory!');
}
rimraf.sync(path.resolve(this.project.root, outputPath));

const serveDefaults = {
Expand Down

0 comments on commit 66ce243

Please sign in to comment.