import externalDependencies from '@azimutlabs/rollup-plugin-external';
import copy from 'rollup-plugin-copy';

export default [
  {
    // Build the rolled-up type declarations
    input: 'index.js',
    output: [{ file: 'dist/index.js', format: 'cjs' }],
    plugins: [
      // flag (peer)dependencies as external to package
      externalDependencies(),
      copy({
        targets: [
          { src: ['**/*.js'], dest: 'dist' },
          { src: ['**/*.sh'], dest: 'dist' },
          { src: 'package.json', dest: 'dist' },
          { src: 'README.md', dest: 'dist' },
        ],
        flatten: false,
      }),
    ],

    // exclude externalDependencies' flags
    external: (id) => id.includes('fp-ts'),
  },
];
