New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

viralify

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

viralify - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

test/multi-transforms.sync.js

36

index.js

@@ -26,2 +26,9 @@ 'use strict';

function packsWithTransforms(root, transform, front, relPaths) {
return relPaths
.map(function (x) { return path.resolve(root, x) })
.map(addTransform.bind(null, front, transform));
}
var go = module.exports =

@@ -48,11 +55,9 @@

glob('**/package.json', { cwd: root }, function (err, res) {
glob('**/package.json', { cwd: root }, function (err, relPaths) {
if (err) return cb(err);
// nothing to do
if (!res.length) return cb();
if (!relPaths.length) return cb();
var packs = res
.map(function (x) { return path.resolve(root, x) })
.map(addTransform.bind(null, front, transform));
var packs = packsWithTransforms(root, transform, front, relPaths);

@@ -70,1 +75,22 @@ var tasks = packs

};
module.exports.sync =
/**
* Same as `viralify` but performed synchronously.
*
* @name viralivy.sync
* @function
* @param {String} root of the package
* @param {Array.<String>} transform one or more transforms to be added to the transform field
* @param {Boolean=} front if set transforms are added to the front of the transform field so they run first
*/
function sync(root, transform, front) {
if (!Array.isArray(transform)) transform = [ transform ];
var relPaths = glob.sync('**/package.json', { cwd: root })
var packs = packsWithTransforms(root, transform, front, relPaths);
packs.forEach(function (p) {
fs.writeFileSync(p.file, JSON.stringify(p.pack, null, 2), 'utf8');
})
}

2

package.json
{
"name": "viralify",
"version": "0.2.0",
"version": "0.3.0",
"description": "Injects one or more browserify transforms into all dependencies of a package recursively.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -123,3 +123,3 @@ # viralify [![build status](https://secure.travis-ci.org/thlorenz/viralify.png)](http://travis-ci.org/thlorenz/viralify)

<span>, </span>
<a href="https://github.com/thlorenz/viralify/blob/master/index.js#L28">lineno 28</a>
<a href="https://github.com/thlorenz/viralify/blob/master/index.js#L35">lineno 35</a>
</li>

@@ -138,2 +138,6 @@ </ul></dd>

#### viralify.sync(root, transform, front)
Same as `viralify` but performed synchronously.
## License

@@ -140,0 +144,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc