Skip to content

Commit 13f5057

Browse files
author
Philipp Alferov
committed
Add ability to pass arguments from CLI
1 parent de692e3 commit 13f5057

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

gulpfile.js

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ var buffer = require('vinyl-buffer');
88
var source = require('vinyl-source-stream');
99
var sequence = require('run-sequence');
1010
var browserSync = require('browser-sync');
11+
var fs = require('fs');
1112

1213
var config = {
1314
fileSaver: {
@@ -49,6 +50,24 @@ function handleErrors(err) {
4950
this.emit('end');
5051
}
5152

53+
function getUpdateType() {
54+
var env = $.util.env;
55+
56+
if (env.type) {
57+
return { type: env.type };
58+
}
59+
60+
if (env.version) {
61+
return { version: env.version };
62+
}
63+
64+
return { type: 'patch' };
65+
}
66+
67+
function getPackageJsonVersion() {
68+
return JSON.parse(fs.readFileSync('./package.json', 'utf8')).version;
69+
}
70+
5271
/*
5372
* See http://blog.avisi.nl/2014/04/25/how-to-keep-a-fast-build-with-browserify-and-reactjs/
5473
*/
@@ -120,17 +139,11 @@ gulp.task('serve', function () {
120139
});
121140
});
122141

123-
gulp.task('deploy', function() {
142+
gulp.task('deploy:docs', function() {
124143
return gulp.src('./docs/**/*')
125144
.pipe($.ghPages());
126145
});
127146

128-
gulp.task('bump', function() {
129-
return gulp.src('./*.json')
130-
.pipe($.bump({type: 'minor'}))
131-
.pipe(gulp.dest('./'));
132-
});
133-
134147
gulp.task('build', function() {
135148
config.isProd = true;
136149
browserifyDefaults = config.browserify.fileSaver;
@@ -156,4 +169,11 @@ gulp.task('watch:docs', ['serve'], function() {
156169
gulp.watch(config.docs.styles, ['styles:docs']);
157170
});
158171

172+
gulp.task('bump', function() {
173+
174+
return gulp.src('./*.json')
175+
.pipe($.bump(getUpdateType()))
176+
.pipe(gulp.dest('./'));
177+
});
178+
159179
gulp.task('default', ['build']);

0 commit comments

Comments
 (0)