Giter VIP home page Giter VIP logo

viralify's Introduction

viralify build status

Injects browserify transforms into specified dependencies of a package recursively.

viralify . -t browserify-swap -p ansicolors
var viralify = require('viralify');

viralify(root, [ 'foo', 'bar' ], 'browserify-swap', function (err) {
  if (err) return console.error(err);
  // package.json's of packages 'foo' and 'bar', found in root and below,
  // now have 'browserify-swap' added to the end of their 'browserify.transform' field
})

Installation

npm install viralify

Usage

viralify <path> <options>

  Inject browserify transform(s) into the package.json files of specified packages at and below the given path.

OPTIONS:

  -t, --transform   transform(s) to inject (required)
  -p, --packages    packages into which to inject the transforms (required)
  -f, --front       if set, the transform(s) are injected in the front of the transform field so they run first

EXAMPLES:

  Inject 'browserify-swap' transform for all foo dependencies of the package in the current directory

    viralify . -t browserify-swap -p foo

  Inject 'envify' and 'es6ify' transforms in front for all foo and bar dependencies of the package
  in the current directory

    viralify ./node_modules --transform envify --transform es6ify --front --package foo -p bar

API

viralify(root, packages, transform, front, cb)

Injects the given transform(s) into the browserify.transform field of all package.jsons of the packages below the given root that where specified.

If the transform(s) were contained in the package.json already, no changes are made and no writes performed. This means that all viralify runs succeeding the first one will be much faster.

Parameters:
Name Type Argument Description
root String

of the package

packages Array.<String>

one or more packages to which the transforms should be added

transform Array.<String>

one or more transforms to be added to the transform field

front Boolean <optional>

if set transforms are added to the front of the transform field so they run first

cb function

called when the transform injection is complete

Source:

generated with docme

viralify.sync(root, packages, transform, front)

Same as viralify but performed synchronously.

License

MIT

viralify's People

Contributors

thlorenz avatar

Watchers

James Cloos avatar Naveed Butt avatar

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.