const commonjs = require("@rollup/plugin-commonjs");
const nodeResolve = require("@rollup/plugin-node-resolve");
const json = require("@rollup/plugin-json");
const copy = require("rollup-plugin-copy");
const path = require("path");

module.exports = {
  input: "src/index.js",
  output: {
    esModule: true,
    file: "dist/index.js",
    format: "cjs",
    sourcemap: true,
    inlineDynamicImports: true,
  },
  plugins: [
    commonjs(),
    nodeResolve({ preferBuiltins: true }),
    json(),
    copy({
      targets: [
        {
          src: path.resolve(
            __dirname,
            "node_modules/conventional-changelog-angular/templates/"
          ),
          dest: "dist/",
        },
        {
          src: path.resolve(
            __dirname,
            "node_modules/@commitlint/config-validator/lib/commitlint.schema.json"
          ),
          dest: "dist/",
        },
      ],
    }),
  ],
};
