Skip to content

Commit 380a771

Browse files
committed
Switch to Rollup-based build, add standard and uglified dist files.
1 parent 1262ef9 commit 380a771

File tree

3 files changed

+48
-6
lines changed

3 files changed

+48
-6
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/lib
1+
/dist
22
node_modules
33
npm-debug.log
44
.DS_Store

package.json

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@
22
"name": "asyncro",
33
"version": "1.0.0",
44
"description": "Asynchronous Array Utilities (for await)",
5-
"main": "lib/index.js",
5+
"main": "dist/asyncro.js",
66
"jsnext:main": "src/index.js",
7+
"minified:main": "dist/asyncro.min.js",
78
"scripts": {
8-
"build": "babel src -d lib --minified --no-comments -s",
9-
"prepublish": "npm run -s build && npm run -s test",
10-
"test": "babel-node test",
9+
"clean": "rimraf dist/",
10+
"build": "npm-run-all clean transpile minify size",
11+
"prepublish": "npm-run-all build test",
12+
"transpile": "rollup -c rollup.config.js -m ${npm_package_main}.map -f umd -n $npm_package_name $npm_package_jsnext_main -o $npm_package_main",
13+
"minify": "uglifyjs $npm_package_main -cm -o $npm_package_minified_main -p relative --in-source-map ${npm_package_main}.map --source-map ${npm_package_minified_main}.map",
14+
"size": "size=$(gzip-size $npm_package_minified_main) && echo \"gzip size: $size / $(pretty-bytes $size)\"",
15+
"test": "ava --verbose",
16+
"lint": "eslint {src,test}",
1117
"release": "npm run -s build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish"
1218
},
1319
"repository": "developit/asyncro",
@@ -23,8 +29,19 @@
2329
},
2430
"homepage": "https://github.com/developit/asyncro",
2531
"devDependencies": {
32+
"ava": "^0.16.0",
2633
"babel-cli": "^6.14.0",
2734
"babel-plugin-async-to-promises": "^1.0.5",
28-
"babel-preset-es2015": "^6.14.0"
35+
"babel-preset-es2015": "^6.14.0",
36+
"eslint": "^3.8.1",
37+
"gzip-size-cli": "^1.0.0",
38+
"npm-run-all": "^3.1.1",
39+
"pretty-bytes-cli": "^2.0.0",
40+
"rollup": "^0.36.3",
41+
"rollup-plugin-babel": "^2.6.1",
42+
"rollup-plugin-es3": "^1.0.3",
43+
"rollup-plugin-memory": "^2.0.0",
44+
"sinon": "^1.17.6",
45+
"uglify-js": "^2.7.3"
2946
}
3047
}

rollup.config.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import fs from 'fs';
2+
import babel from 'rollup-plugin-babel';
3+
import memory from 'rollup-plugin-memory';
4+
import es3 from 'rollup-plugin-es3';
5+
6+
var babelRc = JSON.parse(fs.readFileSync('.babelrc','utf8')); // eslint-disable-line
7+
8+
export default {
9+
exports: 'named',
10+
plugins: [
11+
memory({
12+
path: 'src/index',
13+
contents: "export * from './index';"
14+
}),
15+
babel({
16+
babelrc: false,
17+
presets: [
18+
['es2015', { loose:true, modules:false }]
19+
].concat(babelRc.presets.slice(1)),
20+
plugins: babelRc.plugins,
21+
exclude: 'node_modules/**'
22+
}),
23+
es3()
24+
]
25+
};

0 commit comments

Comments
 (0)