aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Edwards <[email protected]>2017-04-13 19:07:38 -0700
committerJason Miller <[email protected]>2017-04-13 22:07:38 -0400
commita51bcea96b4ecc33e547bfc898a0adc1f627b6ea (patch)
tree008591d294a127e28e12dfd32a61097de6bb0247
parentcf764a1ca8c13a5ea7d1b34d370ee46e75e635b8 (diff)
Cleanup Build Chain (#48)
* condense rollup:* scripts; set multiple targets * add module entry * remove mkdirp
-rw-r--r--package.json10
-rw-r--r--rollup.config.js11
2 files changed, 14 insertions, 7 deletions
diff --git a/package.json b/package.json
index 61c0835..2770e22 100644
--- a/package.json
+++ b/package.json
@@ -1,9 +1,9 @@
{
"name": "mitt",
- "amdName": "mitt",
"version": "1.1.0",
"description": "Tiny 200b functional Event Emitter / pubsub.",
"jsnext:main": "src/index.js",
+ "module": "dist/mitt.es.js",
"main": "dist/mitt.js",
"umd:main": "dist/mitt.umd.js",
"scripts": {
@@ -11,10 +11,9 @@
"testonly": "mocha --compilers js:babel-register test/**/*.js",
"lint": "eslint src test",
"test": "flow && npm run lint && npm run testonly",
- "build": "npm-run-all clean -p rollup:* -p minify:* -s docs size",
- "clean": "rimraf dist && mkdirp dist",
- "rollup:cjs": "rollup -c rollup.config.js -m -f cjs -n $npm_package_amdName $npm_package_jsnext_main -o $npm_package_main",
- "rollup:umd": "rollup -c rollup.config.js -m -f umd -n $npm_package_amdName $npm_package_jsnext_main -o $npm_package_umd_main",
+ "build": "npm-run-all clean -p rollup -p minify:* -s docs size",
+ "clean": "rimraf dist",
+ "rollup": "rollup -c",
"minify:cjs": "uglifyjs $npm_package_main -cm toplevel -o $npm_package_main -p relative --in-source-map ${npm_package_main}.map --source-map ${npm_package_main}.map",
"minify:umd": "uglifyjs $npm_package_umd_main -cm -o $npm_package_umd_main -p relative --in-source-map ${npm_package_umd_main}.map --source-map ${npm_package_umd_main}.map",
"docs": "documentation readme src/index.js --section API -q",
@@ -68,7 +67,6 @@
"eslint": "^3.13.1",
"flow-bin": "^0.38.0",
"gzip-size-cli": "^1.0.0",
- "mkdirp": "^0.5.1",
"mocha": "^3.2.0",
"npm-run-all": "^2.1.1",
"pretty-bytes-cli": "^2.0.0",
diff --git a/rollup.config.js b/rollup.config.js
index 60940ef..8e3cf4f 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -1,10 +1,19 @@
import buble from 'rollup-plugin-buble';
import flow from 'rollup-plugin-flow';
+const pkg = require('./package');
+
export default {
+ entry: 'src/index.js',
useStrict: false,
+ sourceMap: true,
plugins: [
- flow(),
+ flow(),
buble()
+ ],
+ targets: [
+ {dest: pkg.main, format: 'cjs'},
+ {dest: pkg.module, format: 'es'},
+ {dest: pkg['umd:main'], format: 'umd', moduleName: pkg.name}
]
};