Skip to content

Commit

Permalink
chore(all): update to Babel 6
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Mar 11, 2016
1 parent 20d84bd commit 80e5307
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 46 deletions.
80 changes: 49 additions & 31 deletions build/babel-options.js
@@ -1,35 +1,53 @@
var path = require('path');
var paths = require('./paths');

module.exports = {
filename: '',
filenameRelative: '',
modules: '',
sourceMap: true,
sourceMapName: '',
sourceRoot: '',
moduleRoot: path.resolve('src').replace(/\\/g, '/'),
moduleIds: false,
experimental: false,
comments: false,
compact: false,
code:true,
stage:2,
loose: "all",
optional: [
"es7.decorators",
"es7.classProperties"
],
plugins: [
"babel-dts-generator"
],
extra: {
dts: {
packageName: paths.packageName,
typings: '',
suppressModulePath: true,
suppressComments: false,
memberOutputFilter: /^_.*/
}
}
exports.base = function() {
return {
filename: '',
filenameRelative: '',
sourceMap: true,
sourceRoot: '',
moduleRoot: path.resolve('src').replace(/\\/g, '/'),
moduleIds: false,
comments: false,
compact: false,
code:true,
presets: [ 'es2015-loose', 'stage-1'],
plugins: [
'syntax-flow',
'transform-decorators-legacy',
['babel-dts-generator', {
packageName: paths.packageName,
typings: '',
suppressModulePath: true,
suppressComments: false,
memberOutputFilter: /^_.*/
}],
'transform-flow-strip-types'
]
};
}

exports.commonjs = function() {
var options = exports.base();
options.plugins.push('transform-es2015-modules-commonjs');
return options;
};

exports.amd = function() {
var options = exports.base();
options.plugins.push('transform-es2015-modules-amd');
return options;
};

exports.system = function() {
var options = exports.base();
options.plugins.push('transform-es2015-modules-systemjs');
return options;
};

exports.es2015 = function() {
var options = exports.base();
options.presets = ['stage-1']
return options;
};
15 changes: 8 additions & 7 deletions build/tasks/build.js
Expand Up @@ -39,33 +39,34 @@ gulp.task('build-index', function(){
.pipe(gulp.dest(paths.output));
});

gulp.task('build-es6', function () {
gulp.task('build-es2015', function () {
return gulp.src(paths.output + jsName)
.pipe(gulp.dest(paths.output + 'es6'));
.pipe(to5(assign({}, compilerOptions.es2015())))
.pipe(gulp.dest(paths.output + 'es2015'));
});

gulp.task('build-commonjs', function () {
return gulp.src(paths.output + jsName)
.pipe(to5(assign({}, compilerOptions, {modules:'common'})))
.pipe(to5(assign({}, compilerOptions.commonjs())))
.pipe(gulp.dest(paths.output + 'commonjs'));
});

gulp.task('build-amd', function () {
return gulp.src(paths.output + jsName)
.pipe(to5(assign({}, compilerOptions, {modules:'amd'})))
.pipe(to5(assign({}, compilerOptions.amd())))
.pipe(gulp.dest(paths.output + 'amd'));
});

gulp.task('build-system', function () {
return gulp.src(paths.output + jsName)
.pipe(to5(assign({}, compilerOptions, {modules:'system'})))
.pipe(to5(assign({}, compilerOptions.system())))
.pipe(gulp.dest(paths.output + 'system'));
});

gulp.task('build-dts', function(){
return gulp.src(paths.output + paths.packageName + '.d.ts')
.pipe(rename(paths.packageName + '.d.ts'))
.pipe(gulp.dest(paths.output + 'es6'))
.pipe(gulp.dest(paths.output + 'es2015'))
.pipe(gulp.dest(paths.output + 'commonjs'))
.pipe(gulp.dest(paths.output + 'amd'))
.pipe(gulp.dest(paths.output + 'system'));
Expand All @@ -75,7 +76,7 @@ gulp.task('build', function(callback) {
return runSequence(
'clean',
'build-index',
['build-es6', 'build-commonjs', 'build-amd', 'build-system'],
['build-es2015', 'build-commonjs', 'build-amd', 'build-system'],
'build-dts',
callback
);
Expand Down
10 changes: 5 additions & 5 deletions karma.conf.js
Expand Up @@ -36,11 +36,11 @@ module.exports = function(config) {
'babelPreprocessor': {
options: {
sourceMap: 'inline',
modules: 'system',
moduleIds: false,
loose: "all",
optional: [
"es7.decorators"
presets: [ 'es2015-loose', 'stage-1'],
plugins: [
'syntax-flow',
'transform-decorators-legacy',
'transform-flow-strip-types'
]
}
},
Expand Down
15 changes: 12 additions & 3 deletions package.json
Expand Up @@ -42,12 +42,21 @@
},
"devDependencies": {
"aurelia-tools": "^0.1.12",
"babel-dts-generator": "^0.2.17",
"babel-dts-generator": "^0.4.5",
"babel-eslint": "^4.1.1",
"babel-plugin-syntax-flow": "^6.5.0",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-es2015-modules-amd": "^6.6.5",
"babel-plugin-transform-es2015-modules-commonjs": "^6.7.0",
"babel-plugin-transform-es2015-modules-systemjs": "^6.6.5",
"babel-plugin-transform-flow-strip-types": "^6.7.0",
"babel-preset-es2015": "^6.6.0",
"babel-preset-es2015-loose": "^7.0.0",
"babel-preset-stage-1": "^6.5.0",
"conventional-changelog": "0.0.11",
"del": "^1.1.0",
"gulp": "^3.8.10",
"gulp-babel": "^5.2.1",
"gulp-babel": "^6.1.2",
"gulp-bump": "^0.3.1",
"gulp-concat": "^2.6.0",
"gulp-eslint": "^1.0.0",
Expand All @@ -57,7 +66,7 @@
"gulp-typedoc-extractor": "^0.0.8",
"jasmine-core": "^2.1.3",
"karma": "^0.13.15",
"karma-babel-preprocessor": "^5.2.2",
"karma-babel-preprocessor": "^6.0.1",
"karma-chrome-launcher": "^0.1.7",
"karma-coverage": "^0.3.1",
"karma-jasmine": "^0.3.5",
Expand Down

0 comments on commit 80e5307

Please sign in to comment.