Git Product home page Git Product logo

render-dir's Introduction

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 -

  1. A file path transformation
  2. 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!

render-dir's People

Contributors

sramam avatar

Watchers

 avatar  avatar

render-dir's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.