From 83ae546ad64bad244d3e1f15e2a1ddf6353cbd8b Mon Sep 17 00:00:00 2001 From: liabru Date: Sat, 3 Sep 2016 23:25:07 +0100 Subject: [PATCH] changed naming approach for prerelease versions --- Gulpfile.js | 17 ++++++++++++----- src/core/Matter.js | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Gulpfile.js b/Gulpfile.js index 8e8cdb7..2358ba1 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -87,11 +87,11 @@ gulp.task('release:push:docs', function(callback) { }); gulp.task('build:dev', function() { - return build(extend(extend({}, pkg), { version: 'dev' })); + return build(extend(extend({}, pkg), { version: pkg.version + '-dev' })); }); gulp.task('build:edge', function() { - return build(extend(extend({}, pkg), { version: 'master' })); + return build(extend(extend({}, pkg), { version: pkg.version + '-alpha' })); }); gulp.task('build:release', function() { @@ -113,7 +113,14 @@ gulp.task('watch', function() { var bundle = function() { gutil.log('Updated bundle build/matter-dev.js'); - b.bundle().pipe(fs.createWriteStream('build/matter-dev.js')); + b.bundle() + .pipe(through2({ objectMode: true }, function(chunk, encoding, callback) { + return callback( + null, + chunk.toString().replace(/@@VERSION@@/g, pkg.version + '-dev') + ); + })) + .pipe(fs.createWriteStream('build/matter-dev.js')); }; b.on('update', bundle); @@ -243,7 +250,7 @@ var build = function(options) { gutil.log('Building', filename, options.date); var compiled = gulp.src(['src/module/main.js']) - .pipe(replace("version = 'master'", "version = '" + options.version + "'")) + .pipe(replace('@@VERSION@@', options.version)) .pipe(through2.obj(function(file, enc, next){ browserify(file.path, { standalone: 'Matter' }) .bundle(function(err, res){ @@ -252,7 +259,7 @@ var build = function(options) { }); })); - if (options.version !== 'dev') { + if (!options.version.includes('-')) { compiled.pipe(preprocess({ context: { DEBUG: false } })); } diff --git a/src/core/Matter.js b/src/core/Matter.js index 92c6644..6fa3dd6 100644 --- a/src/core/Matter.js +++ b/src/core/Matter.js @@ -26,7 +26,7 @@ var Plugin = require('./Plugin'); * @readOnly * @type {String} */ - Matter.version = 'master'; + Matter.version = '@@VERSION@@'; /** * A list of plugin dependencies to be installed. These are normally set and installed through `Matter.use`.