2020-03-15 10:39:40 -05:00
|
|
|
import resolve from '@rollup/plugin-node-resolve';
|
|
|
|
import commonjs from '@rollup/plugin-commonjs';
|
2020-03-03 17:12:52 -06:00
|
|
|
import copy from 'rollup-plugin-copy';
|
2019-12-09 02:14:25 -06:00
|
|
|
import sourceMaps from 'rollup-plugin-sourcemaps';
|
|
|
|
import { terser } from 'rollup-plugin-terser';
|
|
|
|
|
2020-03-03 17:12:52 -06:00
|
|
|
const { name } = require('./package.json');
|
2019-12-09 02:14:25 -06:00
|
|
|
|
2020-03-03 17:12:52 -06:00
|
|
|
const buildCjsPackage = ({ env }) => ({
|
|
|
|
input: 'compiled/index.js',
|
|
|
|
output: {
|
|
|
|
file: `dist/index.${env}.js`,
|
|
|
|
name,
|
|
|
|
format: 'cjs',
|
|
|
|
sourcemap: true,
|
|
|
|
exports: 'named',
|
|
|
|
globals: {},
|
|
|
|
},
|
2020-04-27 02:09:05 -05:00
|
|
|
external: ['@grafana/e2e-selectors'],
|
2020-03-03 17:12:52 -06:00
|
|
|
plugins: [
|
|
|
|
copy({
|
|
|
|
flatten: false,
|
|
|
|
targets: [
|
2020-03-06 11:25:55 -06:00
|
|
|
{ src: 'bin/**/*.*', dest: 'dist/bin/' },
|
|
|
|
{ src: 'cli.js', dest: 'dist/' },
|
2020-03-03 17:12:52 -06:00
|
|
|
{ src: 'cypress.json', dest: 'dist/' },
|
2020-03-10 14:37:48 -05:00
|
|
|
{ src: 'cypress/**/*.*', dest: 'dist/cypress/' },
|
2020-03-03 17:12:52 -06:00
|
|
|
],
|
|
|
|
}),
|
|
|
|
commonjs({
|
|
|
|
include: /node_modules/,
|
|
|
|
}),
|
|
|
|
resolve(),
|
|
|
|
sourceMaps(),
|
|
|
|
env === 'production' && terser(),
|
|
|
|
],
|
|
|
|
});
|
2019-12-09 02:14:25 -06:00
|
|
|
|
|
|
|
export default [buildCjsPackage({ env: 'development' }), buildCjsPackage({ env: 'production' })];
|