Skip to content

Commit

Permalink
fix(@angular/cli): delete only dist content
Browse files Browse the repository at this point in the history
  • Loading branch information
filipesilva committed May 4, 2017
1 parent 250d35d commit 3b0f657
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/@angular/cli/tasks/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default Task.extend({
if (config.project && config.project.ejected) {
throw new SilentError('An ejected project cannot use the build command anymore.');
}
rimraf.sync(path.resolve(project.root, outputPath));
rimraf.sync(`${path.resolve(project.root, outputPath)}/*`);

const webpackConfig = new NgCliWebpackConfig(runTaskOptions, app).buildConfig();
const webpackCompiler = webpack(webpackConfig);
Expand Down
2 changes: 1 addition & 1 deletion packages/@angular/cli/tasks/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default Task.extend({
if (projectConfig.project && projectConfig.project.ejected) {
throw new SilentError('An ejected project cannot use the build command anymore.');
}
rimraf.sync(path.resolve(this.project.root, outputPath));
rimraf.sync(`${path.resolve(this.project.root, outputPath)}/*`);

const serveDefaults = {
// default deployUrl to '' on serve to prevent the default from .angular-cli.json
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/tests/build/fail-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ export default function() {
return deleteFile('src/app/app.component.ts')
// This is supposed to fail since there's a missing file
.then(() => expectToFail(() => ng('build')))
// Failed builds don't leave behind dist/
.then(() => expectToFail(() => expectFileToExist('dist/')));
// Failed builds don't leave behind files inside dist/
.then(() => expectToFail(() => expectFileToExist('dist/main.bundle.js')));
}

0 comments on commit 3b0f657

Please sign in to comment.