Add rollup for packaging
This commit is contained in:
parent
6868c2fc98
commit
1f8c3b7a78
1
.gitignore
vendored
1
.gitignore
vendored
@ -18,6 +18,7 @@ pids
|
|||||||
|
|
||||||
# Dependency directories
|
# Dependency directories
|
||||||
node_modules/
|
node_modules/
|
||||||
|
dist/
|
||||||
|
|
||||||
# Optional npm cache directory
|
# Optional npm cache directory
|
||||||
.npm
|
.npm
|
||||||
|
|||||||
1876
package-lock.json
generated
1876
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
28
package.json
28
package.json
@ -2,13 +2,23 @@
|
|||||||
"name": "reactimal",
|
"name": "reactimal",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Reactive programming primitives",
|
"description": "Reactive programming primitives",
|
||||||
"main": "src/index.js",
|
"main": "dist/reactimal.js",
|
||||||
|
"module": "dist/reactimal.mjs",
|
||||||
"files": [
|
"files": [
|
||||||
"src"
|
"src"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "jasmine",
|
"test": "jasmine",
|
||||||
"format_code": "nodejs node_modules/prettier/bin-prettier.js --config ./prettier.config.js --write \"{.,{packages,bin}/**/!(dist)}/*.{js,json,md}\""
|
"clean": "rimraf dist",
|
||||||
|
"format_code": "nodejs node_modules/prettier/bin-prettier.js --config ./prettier.config.js --write \"{.,{packages,bin}/**/!(dist)}/*.{js,json,md}\"",
|
||||||
|
"build:umd": "rollup -c rollup.config.js && uglifyjs -m --screw-ie8 -c -o dist/reactimal.min.js dist/reactimal.js",
|
||||||
|
"build:umd:zip": "npm run build:umd && gzip -c9 dist/reactimal.min.js > dist/reactimal.min.js.gz && gzip -c9 dist/reactimal.min.mjs > dist/reactimal.min.mjs.gz",
|
||||||
|
"build": "npm run build:umd:zip && ls -l dist/",
|
||||||
|
"prepublish": "npm run clean && npm run build"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://gitlab.com/explorigin/reactimal.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"reactive"
|
"reactive"
|
||||||
@ -18,6 +28,18 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"jasmine": "^3.2.0",
|
"jasmine": "^3.2.0",
|
||||||
"jasmine-es6": "^0.4.3",
|
"jasmine-es6": "^0.4.3",
|
||||||
"prettier": "^1.14.3"
|
"prettier": "^1.14.3",
|
||||||
|
"babel-cli": "6.18.0",
|
||||||
|
"babel-core": "6.21.0",
|
||||||
|
"babel-eslint": "7.1.1",
|
||||||
|
"babel-preset-es2015": "6.18.0",
|
||||||
|
"babel-preset-es2015-rollup": "3.0.0",
|
||||||
|
"babel-preset-stage-0": "6.16.0",
|
||||||
|
"eslint": "3.2.0",
|
||||||
|
"rimraf": "2.5.4",
|
||||||
|
"rollup": "0.66.6",
|
||||||
|
"rollup-plugin-babel": "2.7.1",
|
||||||
|
"rollup-plugin-esmin": "0.1.3",
|
||||||
|
"uglify-es": "3.3.9"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
43
rollup.config.js
Normal file
43
rollup.config.js
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
import esmin from 'rollup-plugin-esmin';
|
||||||
|
import babel from 'rollup-plugin-babel';
|
||||||
|
import pkg from './package.json';
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
input: 'src/index.js',
|
||||||
|
output: {
|
||||||
|
file: pkg.module,
|
||||||
|
format: 'es'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default [
|
||||||
|
// reactimal.mjs
|
||||||
|
config,
|
||||||
|
|
||||||
|
// reactimal.min.mjs
|
||||||
|
{
|
||||||
|
...config,
|
||||||
|
output: {
|
||||||
|
...config.output,
|
||||||
|
file: 'dist/reactimal.min.mjs'
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
esmin({
|
||||||
|
overrides: {
|
||||||
|
sourceType: 'module'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
// reactimal.js
|
||||||
|
{
|
||||||
|
...config,
|
||||||
|
output: {
|
||||||
|
format: 'umd',
|
||||||
|
file: 'dist/reactimal.js',
|
||||||
|
name: 'reactimal'
|
||||||
|
},
|
||||||
|
plugins: [babel({ sourceType: 'module' })]
|
||||||
|
}
|
||||||
|
];
|
||||||
Reference in New Issue
Block a user