1.0.0 • Published 10 months ago

cpycnf v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

cpycnf

Define recurring file copy tasks in a config and execute them.

Usage

Global

npm install cpycnf --global
$ cpycnf

Local

npm install cpycnf [--save-dev]
$ npx cpycnf

Add to package.json

{
  "name": "my-package",
  "scripts": {
    "copy": "cpycnf"
  }
}

Configuration

Add the cpycnf config to your package.json or a dedicated config file: .cpycnfrc.{json,js,cjs}, .config/cpycnfrc, .config/cpycnfrc.{json,js,cjs}, cpycnf.config.{js,cjs}

Example

One-to-one applicable to all .json config files.

{
  "tasks": [
    ["node_modules/jquery/dist/jquery.min.*", "public/jquery"],
    [
      [
        "node_modules/bootstrap/dist/js/bootstrap.bundle.min.*",
        "node_modules/bootstrap/dist/css/bootstrap.min.*"
      ], "public/bootstrap", { "flat": true }
    ]
  ]
}

Every task in the tasks array consists of an array with a fixed structure:

type Task = [source: string | string[], destination: string, options: Options]

Under the hood cpycnf uses cpy. Head over to cpy#options for the options reference.

Example package.json

{
  "name": "my-package",
  // ...
  "cpycnf": {
    "tasks": [
      // ...
    ]
  }
}

Example .js, .cjs

module.exports = {
  tasks: [
    // ...
  ]
}
1.0.0

10 months ago