2021-01-07 19:09:57 +00:00
|
|
|
import { terser } from 'rollup-plugin-terser';
|
|
|
|
|
2021-03-10 18:24:20 +00:00
|
|
|
const distfile = (insertion) => `dist/preserves-schema${insertion}.js`;
|
2021-01-07 19:09:57 +00:00
|
|
|
|
|
|
|
function umd(insertion, extra) {
|
|
|
|
return {
|
|
|
|
file: distfile(insertion),
|
|
|
|
format: 'umd',
|
2021-03-10 18:24:20 +00:00
|
|
|
name: 'PreservesSchema',
|
|
|
|
globals: {
|
|
|
|
'@preserves/core': 'Preserves',
|
|
|
|
},
|
2021-01-07 19:09:57 +00:00
|
|
|
... (extra || {})
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
function es6(insertion, extra) {
|
|
|
|
return {
|
|
|
|
file: distfile('.es6' + insertion),
|
|
|
|
format: 'es',
|
2021-03-10 18:24:20 +00:00
|
|
|
globals: {
|
|
|
|
'@preserves/core': 'Preserves',
|
|
|
|
},
|
|
|
|
... (extra || {}),
|
2021-01-07 19:09:57 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-03-14 21:53:13 +00:00
|
|
|
function cli(name) {
|
|
|
|
return {
|
|
|
|
input: `lib/bin/${name}.js`,
|
|
|
|
output: [{file: `dist/bin/${name}.js`, format: 'commonjs'}],
|
|
|
|
external: [
|
|
|
|
'@preserves/core',
|
|
|
|
'chalk',
|
|
|
|
'chokidar',
|
|
|
|
'fs',
|
|
|
|
'glob',
|
|
|
|
'minimatch',
|
|
|
|
'path',
|
|
|
|
'yargs/yargs',
|
|
|
|
],
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export default [
|
|
|
|
{
|
|
|
|
input: 'lib/index.js',
|
|
|
|
output: [
|
|
|
|
umd(''),
|
|
|
|
umd('.min', { plugins: [terser()] }),
|
|
|
|
es6(''),
|
|
|
|
es6('.min', { plugins: [terser()] }),
|
|
|
|
],
|
|
|
|
external: ['@preserves/core'],
|
|
|
|
},
|
|
|
|
cli('preserves-schema-ts'),
|
|
|
|
cli('preserves-schemac'),
|
|
|
|
];
|