From 5da8b4ddbfab6dbf079350b9ad6aaf07001d871d Mon Sep 17 00:00:00 2001 From: Leandro Lemos Date: Sun, 28 Aug 2016 03:52:50 +1000 Subject: [PATCH] Fixing gh-pages task --- gulpfile.js | 37 +++++++++++++++++++++---------------- package.json | 1 + tasks/gh-pages.js | 11 ++++++----- 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 03f52934..8b3a7818 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -20,46 +20,51 @@ gulp.task('test', function() { }); gulp.task('scripts', function() { - browserifyTask({ + return browserifyTask({ environment: 'development' }).vendor(); }) +gulp.task('scripts:production', function() { + return browserifyTask({ + environment: 'production' + }).vendor(); +}) + gulp.task('styles', function() { - cssTask({ + return cssTask({ environment: 'development' }); }) +gulp.task('styles:production', function() { + return cssTask({ + environment: 'production' + }); +}) + gulp.task('styles:package', function() { - cssTask({ + return cssTask({ environment: 'package' }); }) gulp.task('copy', function() { - copyTask({ + return copyTask({ environment: 'development' }); }) -gulp.task('deploy', ['test'], function() { - browserifyTask({ - environment: 'production' - }) - .vendor(); - - cssTask({ +gulp.task('copy:production', function() { + return copyTask({ environment: 'production' }); +}) - copyTask({ - environment: 'production' - }); -}); +gulp.task('prepublish', ['test', 'scripts:production', 'styles:production', 'copy:production']) gulp.task('publish', function(done) { - ghPagesTask(done); + return ghPagesTask(done); }) // Development workflow diff --git a/package.json b/package.json index 012d2de9..8eaee05e 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "build": "babel ./src -d lib --ignore '__tests__' && gulp styles:package", "prepublish-to-npm": "git pull && npm run build && git commit -am 'Prepare for publishing'", "publish-to-npm": "(git pull origin master && npm version patch && git push origin master && git checkout release && git merge master && git push origin release && git checkout master && npm publish && git push --tags)", + "prepublish-to-gh-pages": "node --harmony ./node_modules/gulp/bin/gulp prepublish", "publish-to-gh-pages": "node --harmony ./node_modules/gulp/bin/gulp publish" }, "repository": { diff --git a/tasks/gh-pages.js b/tasks/gh-pages.js index 7b3d31a1..8f9b1543 100644 --- a/tasks/gh-pages.js +++ b/tasks/gh-pages.js @@ -1,13 +1,14 @@ var gulp = require('gulp'); var path = require('path'); var ghPages = require('gh-pages'); -var configs = require('./configs'); module.exports = function(done) { - var origin = configs.paths['production']; - - return ghPages.publish(origin, function () { - console.log(arguments); + return ghPages.publish(path.join(__dirname, '../dist'), function (err) { + if (err) { + console.error('Failed to publish', err); + } else { + console.info('Published to gh-pages'); + } done(); }); };