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

(gulpfile): Delete .tmp folder now works correctly after failed build. #261

Merged
merged 1 commit into from
Jan 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion generators/app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"core-js": "^2.4.1",
"del": "^2.2.2",
"fs-extra": "^5.0.0",
"gulp": "^3.9.1",
"gulp-rename": "^1.2.2",
"gulp-rollup": "^2.11.0",
Expand Down
16 changes: 9 additions & 7 deletions generators/app/templates/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var gulp = require('gulp'),
ngc = require('@angular/compiler-cli/src/main').main,
rollup = require('gulp-rollup'),
rename = require('gulp-rename'),
del = require('del'),
fs = require('fs-extra'),
runSequence = require('run-sequence'),
inlineResources = require('./tools/gulp/inline-resources');

Expand All @@ -21,7 +21,7 @@ gulp.task('clean:dist', function () {

// Delete contents but not dist folder to avoid broken npm links
// when dist directory is removed while npm link references it.
return deleteFolders([distFolder + '/**', '!' + distFolder]);
return fs.emptyDirSync(distFolder);
});

/**
Expand Down Expand Up @@ -173,14 +173,14 @@ gulp.task('copy:readme', function () {
* 10. Delete /.tmp folder
*/
gulp.task('clean:tmp', function () {
return deleteFolders([tmpFolder]);
return deleteFolder(tmpFolder);
});

/**
* 11. Delete /build folder
*/
gulp.task('clean:build', function () {
return deleteFolders([buildFolder]);
return deleteFolder(buildFolder);
});

gulp.task('compile', function () {
Expand All @@ -199,7 +199,9 @@ gulp.task('compile', function () {
function (err) {
if (err) {
console.log('ERROR:', err.message);
deleteFolders([distFolder, tmpFolder, buildFolder]);
deleteFolder(distFolder);
deleteFolder(tmpFolder);
deleteFolder(buildFolder);
} else {
console.log('Compilation finished succesfully');
}
Expand All @@ -222,6 +224,6 @@ gulp.task('default', ['build:watch']);
/**
* Deletes the specified folder
*/
function deleteFolders(folders) {
return del(folders);
function deleteFolder(folder) {
return fs.removeSync(folder);
}