Skip to content

Commit

Permalink
fix(@angular/cli): Bail out if output path is the root folder (#4490)
Browse files Browse the repository at this point in the history
`ng serve` --output-path=. would wipe out the entire root folder.
  • Loading branch information
catull authored and hansl committed Feb 7, 2017
1 parent 496e13a commit 22f4bea
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 22f4bea

Please sign in to comment.