Skip to content

Commit

Permalink
Merge pull request #1793 from Polymer/faster-builds
Browse files Browse the repository at this point in the history
Use gulp-vulcanize concurrently for faster builds
  • Loading branch information
kevinpschaaf committed Jun 9, 2015
2 parents 3c70d64 + 43504e6 commit a025702
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 25 deletions.
35 changes: 11 additions & 24 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ var lazypipe = require('lazypipe');
var polyclean = require('polyclean');
var del = require('del');

var fs = require('fs');
var path = require('path');

var micro = "polymer-micro.html";
Expand Down Expand Up @@ -62,30 +61,22 @@ function vulcanizeWithExcludes(target, excludes) {
};
}

gulp.task('micro', ['mkdir'], vulcanizeWithExcludes(micro));
gulp.task('mini', ['mkdir'], vulcanizeWithExcludes(mini, [micro]));
gulp.task('max', ['mkdir'], vulcanizeWithExcludes(max, [mini, micro]));
gulp.task('micro', vulcanizeWithExcludes(micro));
gulp.task('mini', vulcanizeWithExcludes(mini, [micro]));
gulp.task('max', vulcanizeWithExcludes(max, [mini, micro]));

gulp.task('clean', function(cb) {
del(workdir, cb);
});

gulp.task('mkdir', function(cb) {
fs.exists(workdir, function(exists) {
return exists ? cb() : fs.mkdir(workdir, null, cb);
});
});

// copy bower.json into dist folder
gulp.task('copy-bower-json', ['mkdir'], function() {
gulp.task('copy-bower-json', function() {
return gulp.src('bower.json').pipe(gulp.dest(workdir));
});

// Default Task
gulp.task('default', ['clean'], function(cb) {
// work around vulcanize not supporting concurrent builds
// Vulcanize bug: https://github.com/Polymer/vulcanize/issues/190
runseq('micro', 'mini', 'max', cb);
gulp.task('default', function(cb) {
runseq('clean', ['micro', 'mini', 'max'], cb);
});

// switch src and build for testing
Expand Down Expand Up @@ -114,22 +105,18 @@ gulp.task('switch-build', function() {
.pipe(gulp.dest('.'));
});

gulp.task('switch', ['default'], function(cb) {
runseq('save-src', 'switch-build', cb);
gulp.task('switch', function(cb) {
runseq('default', 'save-src', 'switch-build', cb);
});

gulp.task('restore', ['clean'], function(cb) {
gulp.task('restore', function(cb) {
runseq('restore-src', 'cleanup-switch', cb);
});

gulp.task('audit', function() {
return gulp.src([distMini, distMicro, distMax])
.pipe(audit('build.log', {
repos: [
'.'
]
}))
.pipe(gulp.dest('dist'));
.pipe(audit('build.log', { repos: ['.'] }))
.pipe(gulp.dest(workdir));
});

gulp.task('release', function(cb) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"gulp-audit": "^1.0.0",
"gulp-rename": "^1.2.2",
"gulp-replace": "^0.5.3",
"gulp-vulcanize": "^6.0.0",
"gulp-vulcanize": "^6.0.1",
"lazypipe": "^0.2.3",
"polyclean": "^1.2.0",
"run-sequence": "^1.1.0"
Expand Down

0 comments on commit a025702

Please sign in to comment.