New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

render-dir

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

render-dir

Copies ('renders') files from srcdir -> dstdir, with transformation & filtering, with a promised interface.

latest
Source
npmnpm
Version
2.1.1
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

render-dir

npm license travis status Build status Coverage Status David David Commitizen friendly NPM

Simple convenience function to help copy a source directory to a destinaton directory, with file contents being transformed.

Provides a promise based interface, that provides two things -

  • A file path transformation
  • A file content transformation

File Transformation

This is the raison d'etre for the library. Since different tools use different template engines, render-dir does not force an opinion.

The transformer() is invoked with the content of each file, allowing the user to provide the actual transformation logic, while getting a convenient promised interface to fs book-keeping

Installation

NOTE: We strongly prefer local installations versus global. Prevents most if not all occurances of "works-on-my-machine" symptom.

npm install render-dir
yarn install render-dir

Usage

renderDir is implmented as a simple API, but also exposed as an CLI, with the callback being provided in a javascript file, with the default export.

API


const renderDir = require('render-dir');

renderDir(srcdir: string, dstdir: string, transformer?: (fdesc: FileDescriptor) => FileDescriptor) => Promise<{}>

CLI


  Usage: render-dir [options] <srcdir> <dstdir>

  Applies transform & copies files from 'srcdir' -> 'dstdir', with filtering


  Options:

    -V, --version                output the version number
    -x, --transform <transform>  file with default exported function, used to transform file/content
    -h, --help                   output usage information
npx render-dir -x ./transform.js /src/template/dir/ /dst/dir/rendered/

Development Tooling

License

Apache-2.0

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Support

Bugs, PRs, comments, suggestions welcomed!

Keywords

dir

FAQs

Package last updated on 15 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts