Comparing version 0.5.1 to 0.5.2
@@ -0,1 +1,4 @@ | ||
# Chokidar 0.5.2 (January 13, 2012) | ||
* Removed postinstall script to prevent various npm bugs. | ||
# Chokidar 0.5.1 (January 6, 2012) | ||
@@ -2,0 +5,0 @@ * When starting to watch non-existing paths, chokidar will no longer throw |
{ | ||
"name": "chokidar", | ||
"description": "A neat wrapper around node.js fs.watch / fs.watchFile.", | ||
"version": "0.5.1", | ||
"keywords": ["fs", "watch", "watchFile", "watcher", "file"], | ||
"version": "0.5.2", | ||
"keywords": [ | ||
"fs", | ||
"watch", | ||
"watchFile", | ||
"watcher", | ||
"file" | ||
], | ||
"homepage": "https://github.com/paulmillr/chokidar", | ||
@@ -15,13 +21,15 @@ "author": "Paul Miller (http://paulmillr.com)", | ||
}, | ||
"licenses": [{ | ||
"type": "MIT", | ||
"url": "http://github.com/paulmillr/chokidar/raw/master/README.md" | ||
}], | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "http://github.com/paulmillr/chokidar/raw/master/README.md" | ||
} | ||
], | ||
"main": "./lib/index", | ||
"engines": { | ||
"node": "~0.6.10 || 0.7 || 0.8" | ||
"node": "~0.6.10 || 0.7 || 0.8 || 0.9" | ||
}, | ||
"scripts": { | ||
"prepublish": "coffee -o lib/ src/", | ||
"postinstall": "node setup.js postinstall", | ||
"prepublish": "node setup.js prepublish", | ||
"postpublish": "node setup.js postpublish", | ||
"test": "node setup.js test" | ||
@@ -28,0 +36,0 @@ }, |
58
setup.js
@@ -5,3 +5,3 @@ var exec = require('child_process').exec; | ||
// Cross-platform npm postinstall & test script. | ||
// Cross-platform node.js postinstall & test script for coffeescript projects. | ||
@@ -12,5 +12,8 @@ var mode = process.argv[2]; | ||
var execute = function(pathParts, params, callback) { | ||
var getBinaryPath = function(binary) { | ||
return sysPath.join('node_modules', '.bin', binary); | ||
}; | ||
var execute = function(path, params, callback) { | ||
if (callback == null) callback = function() {}; | ||
var path = sysPath.join.apply(null, pathParts); | ||
var command = 'node ' + path + ' ' + params; | ||
@@ -24,10 +27,43 @@ console.log('Executing', command); | ||
if (mode === 'postinstall') { | ||
fsExists(sysPath.join(__dirname, 'lib'), function(exists) { | ||
if (exists) return; | ||
execute(['node_modules', 'coffee-script', 'bin', 'coffee'], '-o lib/ src/'); | ||
}); | ||
} else if (mode === 'test') { | ||
execute(['node_modules', 'mocha', 'bin', 'mocha'], | ||
'--compilers coffee:coffee-script --require test/common.js --colors'); | ||
var togglePostinstall = function(add) { | ||
var pkg = require('./package.json'); | ||
if (add) { | ||
if (!pkg.scripts) pkg.scripts = {}; | ||
pkg.scripts.postinstall = 'node setup.js test'; | ||
} else if (pkg.scripts && pkg.scripts.postinstall) { | ||
delete pkg.scripts.postinstall; | ||
} | ||
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n'); | ||
}; | ||
switch (mode) { | ||
// Remove `.postinstall` script to prevent stupid npm bugs. | ||
case 'prepublish': | ||
togglePostinstall(false); | ||
execute(getBinaryPath('coffee'), '-o lib/ src/'); | ||
break; | ||
// Bring back `.postinstall` script. | ||
case 'postpublish': | ||
console.log(sysPath.resolve(__dirname)); | ||
togglePostinstall(true); | ||
break; | ||
// Compile coffeescript for git users. | ||
case 'postinstall': | ||
fsExists(sysPath.join(__dirname, 'lib'), function(exists) { | ||
if (exists) return; | ||
execute(getBinaryPath('coffee'), '-o lib/ src/'); | ||
}); | ||
break; | ||
// Run tests. | ||
case 'test': | ||
execute( | ||
getBinaryPath('mocha'), | ||
'--compilers coffee:coffee-script --require test/common.js --colors' | ||
); | ||
break; | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
30785
320
0