2019-04-16 19:18:42 +02:00
|
|
|
import babel from "rollup-plugin-babel";
|
|
|
|
import resolve from "rollup-plugin-node-resolve";
|
|
|
|
import json from "rollup-plugin-json";
|
2019-04-19 17:31:44 +02:00
|
|
|
import minify from "rollup-plugin-babel-minify";
|
|
|
|
import peerDepsExternal from "rollup-plugin-peer-deps-external";
|
2019-04-16 19:18:42 +02:00
|
|
|
import { name, version, description, author, license } from "./package.json";
|
2019-05-27 07:52:34 +02:00
|
|
|
import components from "./src/index.js";
|
2019-04-16 19:18:42 +02:00
|
|
|
|
2019-05-27 07:52:34 +02:00
|
|
|
const createConfig = (component, module) => {
|
|
|
|
return {
|
2019-05-28 07:44:07 +02:00
|
|
|
input: `./src/${component === "index" ? "" : component + "/"}index.js`,
|
2019-05-27 07:52:34 +02:00
|
|
|
output: {
|
2019-05-28 07:44:07 +02:00
|
|
|
file: `./${component}/index` + (module ? ".mjs" : ".js"),
|
2019-05-27 07:52:34 +02:00
|
|
|
format: module ? "es" : "cjs",
|
|
|
|
sourcemap: true
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
peerDepsExternal(),
|
|
|
|
resolve({ modulesOnly: true }),
|
|
|
|
json(),
|
|
|
|
babel({
|
|
|
|
exclude: "node_modules/**",
|
|
|
|
plugins: ["@babel/plugin-proposal-object-rest-spread"]
|
|
|
|
}),
|
|
|
|
minify({
|
|
|
|
comments: false,
|
|
|
|
sourceMap: true,
|
|
|
|
banner: `/**\n * ${name}/${component} | v${version}\n * ${description}\n * (c) ${new Date().getFullYear()} ${author}\n * @license ${license}\n */`
|
|
|
|
})
|
|
|
|
]
|
|
|
|
};
|
2019-04-16 19:18:42 +02:00
|
|
|
};
|
2019-05-27 07:52:34 +02:00
|
|
|
|
|
|
|
const config = [];
|
|
|
|
for (let component of components) {
|
|
|
|
config.push(createConfig(component, false));
|
|
|
|
config.push(createConfig(component, true));
|
|
|
|
}
|
2019-05-28 07:44:07 +02:00
|
|
|
|
2019-05-27 07:52:34 +02:00
|
|
|
export default config;
|