diff --git a/gulpfile.js b/gulpfile.js index e4a03ac..ca463f4 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -5,7 +5,7 @@ const webpack = require('webpack'); const webpackStream = require('webpack-stream'); const uglify = require('gulp-uglify'); -function webpackBuild(filename, libraryName) { +function webpackBuild(filename, libraryName, version) { const config = { module: { loaders: [ @@ -37,7 +37,8 @@ function webpackBuild(filename, libraryName) { }, plugins: [ new webpack.DefinePlugin({ - 'process.env.NODE_ENV': '"production"' + 'process.env.NODE_ENV': '"production"', + VERSION: JSON.stringify(version), }), // Use browser version of visionmedia-debug new webpack.NormalModuleReplacementPlugin( @@ -68,14 +69,14 @@ gulp.task('build', ['build-babel', 'build-babili']); gulp.task('build-babel', () => { return gulp.src('src/index.js') - .pipe(webpackBuild('babel.js', 'Babel')) + .pipe(webpackBuild('babel.js', 'Babel', require('./package.json').version)) .pipe(gulp.dest('.')) .pipe(minifyAndRename()) .pipe(gulp.dest('.')); }); gulp.task('build-babili', () => { return gulp.src('src/babili.js') - .pipe(webpackBuild('babili.js', 'Babili')) + .pipe(webpackBuild('babili.js', 'Babili', require('./packages/babili-standalone/package.json').version)) .pipe(gulp.dest('packages/babili-standalone/')) .pipe(minifyAndRename()) .pipe(gulp.dest('packages/babili-standalone/')); diff --git a/src/babili.js b/src/babili.js index b7b54d6..81c805e 100644 --- a/src/babili.js +++ b/src/babili.js @@ -37,3 +37,5 @@ export function transform(code, options = {}) { ] }); } + +export const version = VERSION; diff --git a/src/index.js b/src/index.js index 6839e60..ee926b9 100644 --- a/src/index.js +++ b/src/index.js @@ -251,7 +251,7 @@ registerPresets({ }, }); -export const version = Babel.version; +export const version = VERSION; // Listen for load event if we're in a browser and then kick off finding and // running of scripts with "text/babel" type.