bin-wrapper
Advanced tools
Comparing version 0.1.9 to 0.2.0
{ | ||
"name": "bin-wrapper", | ||
"version": "0.1.9", | ||
"description": "Binary wrapper for Node.js that makes your programs seamlessly available as local dependencies", | ||
"version": "0.2.0", | ||
"description": "Binary wrapper that makes your programs seamlessly available as local dependencies", | ||
"keywords": [ | ||
@@ -23,16 +23,18 @@ "bin", | ||
}, | ||
"main": "bin-wrapper.js", | ||
"main": "index.js", | ||
"files": [ | ||
"bin-wrapper.js" | ||
"index.js" | ||
], | ||
"dependencies": { | ||
"bin-check": "~0.1.0", | ||
"download": "~0.1.2", | ||
"isbin": "0.0.2", | ||
"mout": "~0.6.0", | ||
"executable": "~0.1.0", | ||
"find-file": "~0.1.2", | ||
"mout": "~0.9.0", | ||
"progress": "~1.1.0", | ||
"rimraf": "~2.2.6", | ||
"which": "~1.0.5" | ||
"tempfile": "~0.1.2" | ||
}, | ||
"devDependencies": { | ||
"mocha": "~1.12.0" | ||
"mocha": "~1.17.0" | ||
}, | ||
@@ -39,0 +41,0 @@ "engines": { |
108
README.md
@@ -11,35 +11,24 @@ # bin-wrapper [![Build Status](https://secure.travis-ci.org/kevva/bin-wrapper.png?branch=master)](http://travis-ci.org/kevva/bin-wrapper) | ||
All `platform` and `arch` specific options takes precedence over the base | ||
options. See [test.js](test.js) for a full fleshed example. | ||
```js | ||
var Bin = require('bin-wrapper'); | ||
var BinWrapper = require('bin-wrapper'); | ||
var bin = new BinWrapper({ bin: 'gifsicle', dest: 'vendor' }); | ||
var opts = { | ||
name: 'Gifsicle', | ||
bin: 'gifsicle', | ||
path: 'vendor', | ||
url: 'http://url/to/gifsicle', | ||
src: 'http://www.lcdf.org/gifsicle/gifsicle-1.71.tar.gz', | ||
buildScript: './configure --bindir="vendor" && make install', | ||
platform: { | ||
win32: { | ||
bin: 'gifsicle.exe', | ||
url: [ | ||
'http://url/to/gifsicle.exe' | ||
'http://url/to/gifsicle.dll' | ||
] | ||
} | ||
} | ||
} | ||
var bin = new Bin(opts); | ||
bin.check('--version', function (works) { | ||
if (!works) { | ||
console.log('Pre-build test failed, compiling from source'); | ||
return bin.build(); | ||
} | ||
console.log('Binary passed the test'); | ||
}); | ||
bin | ||
.addUrl('https://raw.github.com/yeoman/node-gifsicle/0.1.4/vendor/osx/gifsicle', 'darwin') | ||
.addUrl('https://raw.github.com/yeoman/node-gifsicle/0.1.4/vendor/linux/x64/gifsicle', 'linux', 'x64') | ||
.addFile('https://raw.github.com/yeoman/node-jpegtran-bin/master/vendor/win/x64/libjpeg-62.dll', 'windows', 'x64') | ||
.addSource('http://www.lcdf.org/gifsicle/gifsicle-1.71.tar.gz') | ||
.check() | ||
.on('error', function (err) { | ||
console.log(err); | ||
}); | ||
.on('fail', function () { | ||
this.build('./configure && make && make install') | ||
}) | ||
.on('success', function () { | ||
console.log('gifsicle is working'); | ||
}) | ||
.on('finish', function () { | ||
console.log('gifsicle rebuilt successfully!') | ||
}) | ||
``` | ||
@@ -50,4 +39,3 @@ | ||
```js | ||
console.log(bin.path); | ||
// => path/to/vendor/gifsicle | ||
console.log(bin.path); // => path/to/vendor/gifsicle | ||
``` | ||
@@ -57,14 +45,58 @@ | ||
### .check(cmd, cb) | ||
### new BinWrapper(opts) | ||
Check if a binary is present and working. If it isn't, download and test it by | ||
Creates a new `BinWrapper`. Available options are `bin` which is the name of the | ||
binary and `dest` which is where to download/build the binary to. | ||
### .check(cmd) | ||
Check if a binary is present and working. If it isn't, download and test it by | ||
running the binary with `cmd` and see if it exits correctly. | ||
### .build(cb) | ||
Emits `success` if the binary is working and `fail` if the binary failed to exit with | ||
status code `0`. | ||
Download the source archive defined in the `src` property and build it using the | ||
build script defined in the `buildScript` property. | ||
### .build(cmd) | ||
Download the source archive defined in the `src` property and build it using the | ||
build script defined in the `cmd` argument. | ||
Emits `finish` when build is finished successfully. | ||
### .addPath(src) | ||
Add a path where to check for the binary. By default `dest` is added to paths. | ||
### .addUrl(url, platform, arch) | ||
Add a URL to download the binary from. Use `platform` and `arch` to target a | ||
specific system. | ||
### .addFile(url, platform, arch) | ||
Add a file to download alongside with the binary. Use `platform` and `arch` to | ||
target a specific system. | ||
### .addSource(url) | ||
Add a URL where to download the source code from. | ||
## Options | ||
### bin | ||
Type: `String` | ||
Default: `undefined` | ||
Set the name of the binary. | ||
### dest | ||
Type: `String` | ||
Default: `process.cwd()` | ||
Destination to download/build binary. | ||
## License | ||
[MIT License](http://en.wikipedia.org/wiki/MIT_License) (c) [Kevin Mårtensson](http://kevinmartensson.com) |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
9788
241
100
2
8
+ Addedbin-check@~0.1.0
+ Addedexecutable@~0.1.0
+ Addedfind-file@~0.1.2
+ Addedtempfile@~0.1.2
+ Addedbin-check@0.1.5(transitive)
+ Addedexecutable@0.1.3(transitive)
+ Addedfind-file@0.1.4(transitive)
+ Addedmout@0.9.1(transitive)
- Removedisbin@0.0.2
- Removedwhich@~1.0.5
- Removedasync@0.1.22(transitive)
- Removedisbin@0.0.2(transitive)
- Removedmout@0.6.0(transitive)
- Removedwhich@1.0.9(transitive)
Updatedmout@~0.9.0