chore(build): create es2015 modules when publishing

This commit is contained in:
Josh Thomas
2016-06-08 20:56:18 -05:00
committed by Adam Bradley
parent 9b2e934a2f
commit b5107cdaf1
3 changed files with 26 additions and 5 deletions

View File

@ -57,7 +57,8 @@ var tscReporter = {
// See: https://github.com/Microsoft/TypeScript/issues/4801 // See: https://github.com/Microsoft/TypeScript/issues/4801
// and https://github.com/ivogabe/gulp-typescript/issues/211 // and https://github.com/ivogabe/gulp-typescript/issues/211
var babelOptions = { var babelOptions = {
modules: 'system', presets: ['es2015'],
plugins: ['transform-es2015-modules-systemjs'],
moduleIds: true, moduleIds: true,
getModuleId: function(name) { getModuleId: function(name) {
return 'ionic-angular/' + name; return 'ionic-angular/' + name;
@ -258,6 +259,21 @@ function tsCompile(options, cacheName){
.pipe(tsc(options, undefined, tscReporter)); .pipe(tsc(options, undefined, tscReporter));
} }
gulp.task('bundle.es6', function() {
var babel = require('gulp-babel');
gulp.src([
'src/components/slides/swiper-widget.js'
])
.pipe(gulp.dest('dist/esm/components/slides'));
return tsCompile(getTscOptions('es6'), 'bundle.es6')
.pipe(babel({
presets: ['es2015-native-modules']
}))
.pipe(gulp.dest('dist/esm'));
});
/** /**
* Compiles Ionic Sass sources to stylesheets and outputs them to dist/bundles. * Compiles Ionic Sass sources to stylesheets and outputs them to dist/bundles.
*/ */
@ -720,7 +736,7 @@ gulp.task('karma', ['tests'], function(done) {
gulp.task('karma-watch', ['watch.tests', 'bundle.system'], function() { gulp.task('karma-watch', ['watch.tests', 'bundle.system'], function() {
watchTask('bundle.system'); watchTask('bundle.system');
var karma = require('karma').server; var karma = require('karma').server;
return karma.start({ configFile: __dirname + '/scripts/karma/karma-watch.conf.js' }) return karma.start({ configFile: __dirname + '/scripts/karma/karma-watch.conf.js'})
}); });
@ -938,7 +954,7 @@ gulp.task('build.release', function(done){
runSequence( runSequence(
'clean', 'clean',
'copy.libs', 'copy.libs',
['bundle', 'sass', 'fonts', 'copy.scss'], ['bundle', 'bundle.es6', 'sass', 'fonts', 'copy.scss'],
done done
); );
}); });

View File

@ -33,6 +33,9 @@
"zone.js": "^0.6.12" "zone.js": "^0.6.12"
}, },
"devDependencies": { "devDependencies": {
"babel-plugin-transform-es2015-modules-systemjs": "^6.9.0",
"babel-preset-es2015": "^6.9.0",
"babel-preset-es2015-native-modules": "^6.6.0",
"canonical-path": "0.0.2", "canonical-path": "0.0.2",
"connect": "^3.3.4", "connect": "^3.3.4",
"conventional-changelog": "^0.5.3", "conventional-changelog": "^0.5.3",
@ -45,7 +48,7 @@
"glob": "^5.0.14", "glob": "^5.0.14",
"gulp": "~3.8.10", "gulp": "~3.8.10",
"gulp-autoprefixer": "^2.3.0", "gulp-autoprefixer": "^2.3.0",
"gulp-babel": "^5.3.0", "gulp-babel": "^6.1.2",
"gulp-cached": "^1.1.0", "gulp-cached": "^1.1.0",
"gulp-concat": "~2.5.0", "gulp-concat": "~2.5.0",
"gulp-connect": "^2.2.0", "gulp-connect": "^2.2.0",
@ -99,4 +102,4 @@
"path": "node_modules/ionic-cz-conventional-changelog" "path": "node_modules/ionic-cz-conventional-changelog"
} }
} }
} }

View File

@ -4,6 +4,8 @@
"description": "An advanced HTML5 mobile app framework built on Angular2", "description": "An advanced HTML5 mobile app framework built on Angular2",
"license": "MIT", "license": "MIT",
"keywords": ["ionic", "framework", "mobile", "app", "hybrid", "webapp", "cordova"], "keywords": ["ionic", "framework", "mobile", "app", "hybrid", "webapp", "cordova"],
"main": "index.js",
"jsnext:main": "esm/index.js",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/driftyco/ionic.git#2.0`" "url": "https://github.com/driftyco/ionic.git#2.0`"