0.0.2 ā€¢ Published 2 years ago

rollup-plugin-mv v0.0.2

Weekly downloads
5
License
MIT
Repository
github
Last release
2 years ago

rollup-plugin-mv

šŸ£ A Rollup plugin to move around generated files and directories

Requirements

This plugin requires an LTS Node version (v8.0.0+) and Rollup

Install

Using npm:

npm install rollup-plugin-mv --save-dev

Usage

Create a rollup.config.js configuration file and import the plugin:

import mv from "rollup-plugin-mv";

export default {
  input: "src/index.js",
  output: {
    dir: "output",
    format: "cjs",
  },
  plugins: [
    mv(
      [
        { src: "dist/file", dest: "dist/assets/file" },
        {
          src: "dist/folder",
          dest: "dist/assets/dir",
          overwrite: true,
        },
      ],
      {
        overwrite: false,
      }
    ),
  ],
};

The first argument accepts an object or an array of objects with the following shape:

{
  /**
   * Source file or directory
   */
  src: string;
  /**
   * Destination file or directory
   */
  dest: string;
  /**
   * Overwrite existing file or directory.
   */
  overwrite?: boolean;
}

Options

overwrite

Type: boolean Default: false

Overwrite existing file or directory.

once

Type: boolean Default: false

Executes the move command only once even if there are multiple outputs.