sprout2000 / esbuild-copy-plugin

An esbuild plugin to copy static files that changed from a source directory to a destination directory.

Home Page:https://www.npmjs.com/package/@sprout2000/esbuild-copy-plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@sprout2000/esbuild-copy-plugin

jest GitHub top language npm

An esbuild plugin to copy static files that changed from a source directory to a destination directory.

* This plugin is a typed and fully tested version of @nickjj's esbuild-copy-static-files.

Installation

npm install --save-dev @sprout2000/esbuild-copy-plugin

You will need to have Node.js >=16.7 installed.

Usage

import { build } from "esbuild";
import { copyPlugin } from "@sprout2000/esbuild-copy-plugin";

build({
  plugins: [
    copyPlugin({
      src: "./assets/icon.png",
      dest: "./dist/logo.png",
    }),
  ],
});

API

interface CopyPluginOptions extends fs.CopySyncOptions {
  src?: string;
  dest?: string;
}
option default
src?: string "assets"
dest?: string "dist"
dereference?: boolean false
errorOnExist?: boolean false
filter?: (src, dest) => boolean undefined
force?: boolean false
preserveTimestamps?: boolean false
recursive?: boolean true
verbatimSymlinks?: boolean false

See fs.CopySyncOptions in Node.js LTS for more details.

Unit test

# clone this repo, and install devDependencies...
git clone https://github.com/sprout2000/esbuild-copy-plugin.git
cd esbuild-copy-plugin
npm install

# run the test
npm test

About

An esbuild plugin to copy static files that changed from a source directory to a destination directory.

https://www.npmjs.com/package/@sprout2000/esbuild-copy-plugin

License:MIT License


Languages

Language:TypeScript 100.0%