Rollup
This commit is contained in:
parent
44f142d86b
commit
66cac324e0
|
@ -13,17 +13,20 @@
|
|||
"devDependencies": {
|
||||
"@types/jest": "^26.0.19",
|
||||
"jest": "^26.6.3",
|
||||
"rollup": "^2.36.1",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"ts-jest": "^26.4.4",
|
||||
"ts-node-dev": "^1.1.1",
|
||||
"typescript": "^4.1.3"
|
||||
},
|
||||
"scripts": {
|
||||
"prepare": "npx tsc",
|
||||
"watch": "npx tsc -w",
|
||||
"clean": "rm -rf lib",
|
||||
"veryclean": "npm run clean && rm -rf node_modules",
|
||||
"clean": "rm -rf lib dist",
|
||||
"prepare": "npx tsc && npx rollup -c",
|
||||
"rollupwatch": "npx rollup -c -w",
|
||||
"test": "npx jest",
|
||||
"testwatch": "npx jest -w"
|
||||
"testwatch": "npx jest -w",
|
||||
"veryclean": "npm run clean && rm -rf node_modules",
|
||||
"watch": "npx tsc -w"
|
||||
},
|
||||
"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