Skip to content

Commit

Permalink
chore(build): create es2015 modules when publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
jthoms1 authored and adamdbradley committed Jun 9, 2016
1 parent 9b2e934 commit b5107cd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
22 changes: 19 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ var tscReporter = {
// See: https://github.com/Microsoft/TypeScript/issues/4801
// and https://github.com/ivogabe/gulp-typescript/issues/211
var babelOptions = {
modules: 'system',
presets: ['es2015'],
plugins: ['transform-es2015-modules-systemjs'],
moduleIds: true,
getModuleId: function(name) {
return 'ionic-angular/' + name;
Expand Down Expand Up @@ -258,6 +259,21 @@ function tsCompile(options, cacheName){
.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.
*/
Expand Down Expand Up @@ -720,7 +736,7 @@ gulp.task('karma', ['tests'], function(done) {
gulp.task('karma-watch', ['watch.tests', 'bundle.system'], function() {
watchTask('bundle.system');
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'})
});


Expand Down Expand Up @@ -938,7 +954,7 @@ gulp.task('build.release', function(done){
runSequence(
'clean',
'copy.libs',
['bundle', 'sass', 'fonts', 'copy.scss'],
['bundle', 'bundle.es6', 'sass', 'fonts', 'copy.scss'],
done
);
});
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
"zone.js": "^0.6.12"
},
"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",
"connect": "^3.3.4",
"conventional-changelog": "^0.5.3",
Expand All @@ -45,7 +48,7 @@
"glob": "^5.0.14",
"gulp": "~3.8.10",
"gulp-autoprefixer": "^2.3.0",
"gulp-babel": "^5.3.0",
"gulp-babel": "^6.1.2",
"gulp-cached": "^1.1.0",
"gulp-concat": "~2.5.0",
"gulp-connect": "^2.2.0",
Expand Down Expand Up @@ -99,4 +102,4 @@
"path": "node_modules/ionic-cz-conventional-changelog"
}
}
}
}
2 changes: 2 additions & 0 deletions scripts/npm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"description": "An advanced HTML5 mobile app framework built on Angular2",
"license": "MIT",
"keywords": ["ionic", "framework", "mobile", "app", "hybrid", "webapp", "cordova"],
"main": "index.js",
"jsnext:main": "esm/index.js",
"repository": {
"type": "git",
"url": "https://github.com/driftyco/ionic.git#2.0`"
Expand Down

0 comments on commit b5107cd

Please sign in to comment.