Rollup
This commit is contained in:
parent
44f142d86b
commit
66cac324e0
|
@ -13,17 +13,20 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^26.0.19",
|
"@types/jest": "^26.0.19",
|
||||||
"jest": "^26.6.3",
|
"jest": "^26.6.3",
|
||||||
|
"rollup": "^2.36.1",
|
||||||
|
"rollup-plugin-terser": "^7.0.2",
|
||||||
"ts-jest": "^26.4.4",
|
"ts-jest": "^26.4.4",
|
||||||
"ts-node-dev": "^1.1.1",
|
"ts-node-dev": "^1.1.1",
|
||||||
"typescript": "^4.1.3"
|
"typescript": "^4.1.3"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepare": "npx tsc",
|
"clean": "rm -rf lib dist",
|
||||||
"watch": "npx tsc -w",
|
"prepare": "npx tsc && npx rollup -c",
|
||||||
"clean": "rm -rf lib",
|
"rollupwatch": "npx rollup -c -w",
|
||||||
"veryclean": "npm run clean && rm -rf node_modules",
|
|
||||||
"test": "npx jest",
|
"test": "npx jest",
|
||||||
"testwatch": "npx jest -w"
|
"testwatch": "npx jest -w",
|
||||||
|
"veryclean": "npm run clean && rm -rf node_modules",
|
||||||
|
"watch": "npx tsc -w"
|
||||||
},
|
},
|
||||||
"dependencies": {}
|
"dependencies": {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
import pkg from './package.json';
|
||||||
|
import { terser } from 'rollup-plugin-terser';
|
||||||
|
|
||||||
|
function distfile(insertion) {
|
||||||
|
const f = `${pkg.name}-${pkg.version}${insertion}.js`;
|
||||||
|
return `dist/${f}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function umd(insertion, extra) {
|
||||||
|
return {
|
||||||
|
file: distfile(insertion),
|
||||||
|
format: 'umd',
|
||||||
|
name: 'Preserves',
|
||||||
|
... (extra || {})
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function es6(insertion, extra) {
|
||||||
|
return {
|
||||||
|
file: distfile('.es6' + insertion),
|
||||||
|
format: 'es',
|
||||||
|
... (extra || {})
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
input: 'lib/index.js',
|
||||||
|
output: [
|
||||||
|
umd(''),
|
||||||
|
umd('.min', { plugins: [terser()] }),
|
||||||
|
es6(''),
|
||||||
|
es6('.min', { plugins: [terser()] }),
|
||||||
|
],
|
||||||
|
}
|
Loading…
Reference in New Issue