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

Use gulp-vulcanize concurrently for faster builds #1793

Merged
merged 1 commit into from
Jun 9, 2015
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
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