UNPKG

rally-tools

Version:
76 lines (69 loc) 1.9 kB
import nodeResolve from "rollup-plugin-node-resolve"; import commonjs from "rollup-plugin-commonjs"; import json from "rollup-plugin-json"; import babel from "rollup-plugin-babel"; import packagejson from "./package.json"; let config = { input: "-----", external: [ ...Object.keys(packagejson.dependencies), "path", "fs", "chalk", "os", "child_process", "perf_hooks" ], output: { file: "----", format: "cjs", banner: ` #!/usr/bin/env node /*---------------------------------------------- * Generated by rollup. Written by John Schmidt. * Rally Tools CLI v${packagejson.version} *--------------------------------------------*/ const importLazy = require("import-lazy")(require); `.substring(1), name: "RallyTools", sourcemap: true, }, plugins: [ nodeResolve({ preferBuiltins: true, module: true, //jsnext: true, }), commonjs({ include: "node_modules/**", extensions: [".js"], }), json(), babel({ presets: [ ["@babel/env", { "targets": { "node": "16.14.2", }, "modules": false, }] ], plugins: [ ["@babel/proposal-decorators", {legacy: true}], "@babel/proposal-optional-chaining", ], }), ], } function newConfig(input, output, format="cjs"){ let newOut = {...config.output}; newOut.file = output; newOut.format = format if(format !== "cjs"){ newOut.banner = ""; } let c = { ...config, input, output: newOut, } return c; } export default [ newConfig("src/cli.js", "./bundle.js", "cjs"), newConfig("src/index.js", "./web.js", "umd"), ];