Skip to content

Commit 98272d2

Browse files
committed
Fix gulp script to change version in the correct file
Command `gulp set --version <VERSION>` was meant to change version in `version.js` which is later used in driver's user agent. However it tried to modify `package.json` file instead of `version.js`. This commit makes it operate on the correct file.
1 parent 8d9b4ed commit 98272d2

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

gulpfile.babel.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ var merge = require('merge-stream');
4747
var install = require("gulp-install");
4848
var os = require('os');
4949
var file = require('gulp-file');
50+
var semver = require('semver');
5051

5152
gulp.task('default', ["test"]);
5253

@@ -225,8 +226,13 @@ gulp.task('set', function() {
225226
// Get the --version arg from command line
226227
var version = minimist(process.argv.slice(2), { string: 'version' }).version;
227228

229+
if (!semver.valid(version)) {
230+
throw 'Invalid version "' + version + '"';
231+
}
232+
228233
// Change the version in relevant files
229-
return gulp.src(['package.json'], {base: "./"})
234+
var versionFile = path.join('src', 'version.js');
235+
return gulp.src([versionFile], {base: "./"})
230236
.pipe(replace('0.0.0-dev', version))
231237
.pipe(gulp.dest('./'));
232238

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"minimist": "^1.2.0",
5353
"phantomjs-prebuilt": "^2.1.7 ",
5454
"run-sequence": "^1.1.4",
55+
"semver": "^5.3.0",
5556
"through2": "~2.0.0",
5657
"vinyl-buffer": "^1.0.0",
5758
"vinyl-source-stream": "^1.1.0"

0 commit comments

Comments
 (0)