Skip to content

Commit

Permalink
Merge pull request #2064 from zertosh/rollup
Browse files Browse the repository at this point in the history
chore(build): Use rollup to bundle cjs build
  • Loading branch information
jayphelps authored Oct 24, 2016
2 parents ece1b89 + cb68c1d commit d55dd87
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"clean_spec": "Clean up existing test spec build output",
"clean_dist_cjs": "Clean up existing CJS package output",
"clean_dist_es6": "Clean up existing ES6 package output",
"clean_dist_global": "Clean up existing Global package output",
"commit": "Run git commit wizard",
"compile_dist_cjs": "Compile codebase into CJS module",
"compile_dist_es6": "Compile codebase into ES6",
Expand All @@ -56,7 +57,7 @@
"build_es6": "npm-run-all clean_dist_es6 copy_src_es6 compile_dist_es6",
"build_es6_for_docs": "npm-run-all clean_dist_es6 copy_src_es6 compile_dist_es6_for_docs",
"build_closure_core": "node ./tools/make-closure-core.js",
"build_global": "shx rm -rf ./dist/global && mkdirp ./dist/global && node tools/make-umd-bundle.js && npm-run-all build_closure_core",
"build_global": "npm-run-all clean_dist_global build_es6 && mkdirp ./dist/global && node tools/make-umd-bundle.js && npm-run-all build_closure_core",
"build_perf": "webdriver-manager update && npm-run-all build_cjs build_global perf",
"build_test": "shx rm -rf ./dist/ && npm-run-all build_cjs clean_spec build_spec test_mocha",
"build_cover": "shx rm -rf ./dist/ && npm-run-all build_cjs build_spec cover",
Expand All @@ -67,6 +68,7 @@
"clean_spec": "shx rm -rf spec-js",
"clean_dist_cjs": "shx rm -rf ./dist/cjs",
"clean_dist_es6": "shx rm -rf ./dist/es6",
"clean_dist_global": "shx rm -rf ./dist/global",
"copy_src_cjs": "mkdirp ./dist/cjs/src && shx cp -r ./src/* ./dist/cjs/src",
"copy_src_es6": "mkdirp ./dist/es6/src && shx cp -r ./src/* ./dist/es6/src",
"commit": "git-cz",
Expand Down Expand Up @@ -142,10 +144,11 @@
},
"homepage": "https://github.com/ReactiveX/RxJS",
"devDependencies": {
"babel-polyfill": "6.9.1",
"babel-core": "6.17.0",
"babel-polyfill": "6.16.0",
"babel-preset-es2015": "6.16.0",
"benchmark": "^2.1.0",
"benchpress": "2.0.0-beta.1",
"browserify": "13.0.1",
"chai": "^3.5.0",
"color": "^0.11.1",
"colors": "1.1.2",
Expand Down Expand Up @@ -177,6 +180,7 @@
"platform": "^1.3.1",
"promise": "^7.1.1",
"protractor": "^3.1.1",
"rollup": "0.36.3",
"rx": "latest",
"shx": "^0.1.4",
"sinon": "^2.0.0-pre",
Expand All @@ -187,7 +191,6 @@
"typings": "^1.3.3",
"validate-commit-msg": "^2.3.1",
"watch": "^0.18.0",
"watchify": "3.7.0",
"webpack": "^1.13.1",
"xmlhttprequest": "1.8.0"
},
Expand Down
23 changes: 18 additions & 5 deletions tools/make-umd-bundle.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
var browserify = require('browserify');
var rollup = require('rollup');
var fs = require('fs');

var b = browserify('dist/cjs/Rx.js', {
baseDir: 'dist/cjs',
standalone: 'Rx'
var babel = require('babel-core');

rollup.rollup({
entry: 'dist/es6/Rx.js'
}).then(function (bundle) {
var result = bundle.generate({
format: 'es'
});

var out = babel.transform(result.code, {
compact: false,
presets: [
['es2015', {loose: true}]
],
});

fs.writeFileSync('dist/global/Rx.js', out.code);
});
b.bundle().pipe(fs.createWriteStream('dist/global/Rx.js'));

0 comments on commit d55dd87

Please sign in to comment.