1. graceful-copy
Gracefully copy a directory with templates.
graceful-copy
Package: graceful-copy
Created by: egoist
Last modified: Sat, 18 Jun 2022 13:45:32 GMT
Version: 1.1.0
License: MIT
Downloads: 39
Repository: https://github.com/egoist/graceful-copy

Install

npm install graceful-copy
yarn add graceful-copy

graceful-copy

NPM version NPM downloads Build Status

Gracefully copy a directory with templates.

Why is this useful?

This could be used to build a scaffolding tool like yeoman or vue-cli.

Install

 $ npm install --save graceful-copy

Usage

 const copy = require('graceful-copy')

copy('./template', './dest', {
  data: {
    foo: 'bar'
  }
}).then(files => {
  console.log(files) // array of filenames in './dest'
}).catch(err => {
  console.log(err.stack)
})

Templates

Templates could use handlebars syntax.

API

copy(src, dest, options)

src: string

Source directory. Could be a relative or absolute path.

dest: string

Destination directory.

options: object

clean: boolean

Whether to clean destination directory before writing to it. Defaults to true.

cwd: string

Current working directory. Defaults to process.cwd().

data: object

The data to render templates in source directory.

skipInterpolation: string | string[]

Patterns used to skip interpolation, eg: ./foo*/bar-*.js


graceful-copy © EGOIST, Released under the MIT License.

Authored and maintained by EGOIST with help from contributors (list).

egoistian.com · GitHub @egoist · Twitter @rem_rin_rin

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code