import typescript from '@rollup/plugin-typescript';
import terser from '@rollup/plugin-terser';
import resolve from '@rollup/plugin-node-resolve';
import { readFileSync } from 'node:fs';

const pkg = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8'));
const banner = `/*! ${pkg.name} v${pkg.version} | (c) ${new Date().getUTCFullYear()} sharadtech | License: ${pkg.license || 'See LICENSE'} | Built: ${new Date().toISOString()} */`;

export default {
  input: 'src/index.ts',
  output: [
    {
      file: 'dist/infralytiqs.js',
      format: 'iife',
      name: 'Infralytiqs',
      sourcemap: false,
      banner,
    },
    {
      file: 'dist/infralytiqs.min.js',
      format: 'iife',
      name: 'Infralytiqs',
      sourcemap: false,
      banner,
      plugins: [terser({ format: { comments: /^!/ } })],
    },
  ],
  plugins: [
    resolve(),
    typescript({ tsconfig: './tsconfig.json', declaration: false, declarationDir: undefined }),
  ],
};
