pingan8787 / rollup-plugin-copy-any-files

After the Rollup / Vite project builds, copy the files to the specified directory.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rollup-plugin-copy-files

After the Rollup / Vite project builds, copy the files to the specified directory.

The timing point for plug-in execution is Rollup closeBundle Hooks.

Installation

npm install rollup-plugin-copy-files -D
# Or pnpm
pnpm add rollup-plugin-copy-files -D

Usage

// rollup.config.js
const rollupPluginCopyAnyFiles = require('rollup-plugin-copy-any-files');

// Define targets
const targets = {
    copy: [
        { src: './source/', target: './target/' },
    ]
}

// Use plugin
export default {
  input: './index.ts',
  output: {
    file: './dist/index.js',
    format: 'cjs',
    name: 'index'
  },
  plugins: [rollupPluginCopyAnyFiles(targets)]
}

Options

export interface CopyOptions {
    src: string,
    target: string,
    name?: string
}

export interface BuildOptions {
    src: string,
    target: string,
    name?: string,
}

export interface Options {
    copy?: CopyOptions[],
    build?: BuildOptions[],
}

TODO

  • Add package operations - BuildOptions options.

About

After the Rollup / Vite project builds, copy the files to the specified directory.

License:MIT License


Languages

Language:TypeScript 100.0%