Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thlorenz/viralify
Injects browserify transforms into specified dependencies of a package recursively.
https://github.com/thlorenz/viralify
Last synced: 2 months ago
JSON representation
Injects browserify transforms into specified dependencies of a package recursively.
- Host: GitHub
- URL: https://github.com/thlorenz/viralify
- Owner: thlorenz
- License: mit
- Created: 2013-12-20T20:48:56.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2018-08-15T07:38:33.000Z (over 6 years ago)
- Last Synced: 2024-10-17T23:52:44.631Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 234 KB
- Stars: 11
- Watchers: 3
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# viralify [![build status](https://secure.travis-ci.org/thlorenz/viralify.png)](http://travis-ci.org/thlorenz/viralify)
Injects browserify transforms into specified dependencies of a package recursively.
```sh
viralify . -t browserify-swap -p ansicolors
``````js
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
```
viralifyInject 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 firstEXAMPLES:
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 directoryviralify ./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 allpackage.json
s
of the packages below the givenroot
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
*generated with [docme](https://github.com/thlorenz/docme)*
#### viralify.sync(root, packages, transform, front)
Same as `viralify` but performed synchronously.
## License
MIT