Comparing version 0.1.8 to 1.0.0
@@ -7,4 +7,3 @@ #!/usr/bin/env node | ||
spawn(binPath, process.argv.slice(2), { | ||
stdio: 'inherit' | ||
}).on('exit', process.exit); | ||
spawn(binPath, process.argv.slice(2), { stdio: 'inherit' }) | ||
.on('exit', process.exit); |
'use strict'; | ||
var bin = require('./lib'); | ||
/** | ||
* Module exports | ||
*/ | ||
module.exports.path = bin.path(); | ||
module.exports.version = bin.v; |
@@ -5,12 +5,27 @@ 'use strict'; | ||
var path = require('path'); | ||
var pkg = require('../package.json'); | ||
var BASE_URL = 'https://raw.githubusercontent.com/shinnn/node-cwebp-bin/2b4b0836753e748f899209c86a37a378bc9fdcd9/vendor/'; | ||
/** | ||
* Variables | ||
*/ | ||
var bin = new BinWrapper() | ||
.src(BASE_URL + 'osx/cwebp', 'darwin') | ||
.src(BASE_URL + 'linux/cwebp', 'linux') | ||
.src(BASE_URL + 'win/cwebp.exe', 'win32') | ||
.dest(path.join(__dirname, '../vendor')) | ||
.use(process.platform === 'win32' ? 'cwebp.exe' : 'cwebp'); | ||
var BIN_VERSION = '0.4.1'; | ||
var BASE_URL = 'https://raw.github.com/imagemin/cwebp-bin/v' + pkg.version + '/vendor/'; | ||
/** | ||
* Initialize a new BinWrapper | ||
*/ | ||
var bin = new BinWrapper() | ||
.src(BASE_URL + 'osx/cwebp', 'darwin') | ||
.src(BASE_URL + 'linux/cwebp', 'linux') | ||
.src(BASE_URL + 'win/cwebp.exe', 'win32') | ||
.dest(path.join(__dirname, '../vendor')) | ||
.use(process.platform === 'win32' ? 'cwebp.exe' : 'cwebp'); | ||
/** | ||
* Module exports | ||
*/ | ||
module.exports = bin; | ||
module.exports.v = BIN_VERSION; |
@@ -7,21 +7,27 @@ 'use strict'; | ||
bin.run(['-version'], function (error) { | ||
if (error) { | ||
console.log(logSymbols.warning + ' pre-build test failed, compiling from source...'); | ||
/** | ||
* Install binary and check whether it works | ||
* If the test fails, try to build it | ||
*/ | ||
var builder = new BinBuild() | ||
.src('http://downloads.webmproject.org/releases/webp/libwebp-0.4.1.tar.gz') | ||
.cmd('./configure --prefix="' + bin.dest() + '" --bindir="' + bin.dest() + '"') | ||
.cmd('make && make install'); | ||
bin.run(['-version'], function (err) { | ||
if (err) { | ||
console.log(logSymbols.warning + ' pre-build test failed, compiling from source...'); | ||
return builder.build(function (error) { | ||
if (error) { | ||
return console.log(logSymbols.error, error); | ||
} | ||
var builder = new BinBuild() | ||
.src('http://downloads.webmproject.org/releases/webp/libwebp-' + bin.v + '.tar.gz') | ||
.cmd('./configure --disable-shared --prefix="' + bin.dest() + '" --bindir="' + bin.dest() + '"') | ||
.cmd('make && make install'); | ||
console.log(logSymbols.success + ' cwebp built successfully!'); | ||
}); | ||
} | ||
return builder.build(function (err) { | ||
if (err) { | ||
console.log(logSymbols.error, err); | ||
return; | ||
} | ||
console.log(logSymbols.success + ' pre-build test passed successfully!'); | ||
console.log(logSymbols.success + ' cwebp built successfully!'); | ||
}); | ||
} | ||
console.log(logSymbols.success + ' pre-build test passed successfully!'); | ||
}); |
{ | ||
"name": "cwebp-bin", | ||
"version": "0.1.8", | ||
"description": "cwebp node.js wrapper that convert JPG or PNG into WebP", | ||
"bin": { | ||
"cwebp": "cli.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/1000ch/node-cwebp-bin.git" | ||
}, | ||
"scripts": { | ||
"test": "mocha --reporter spec --timeout 75000", | ||
"postinstall": "node lib/install.js" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/1000ch/node-cwebp-bin/issues" | ||
}, | ||
"homepage": "https://github.com/1000ch/node-cwebp-bin", | ||
"version": "1.0.0", | ||
"description": "cwebp wrapper that makes it seamlessly available as a local dependency", | ||
"license": "MIT", | ||
"repository": "imagemin/cwebp-bin", | ||
"author": { | ||
"name": "1000ch", | ||
"email": "shogo.sensui@gmail.com", | ||
"url": "https://github.com/1000ch" | ||
"url": "http://github.com/1000ch" | ||
}, | ||
@@ -28,16 +15,8 @@ "engines": { | ||
}, | ||
"licenses": [ | ||
{ | ||
"type": "BSD" | ||
} | ||
], | ||
"dependencies": { | ||
"bin-build": "^1.0.0", | ||
"bin-wrapper": "^1.0.0", | ||
"log-symbols": "^1.0.0" | ||
"bin": { | ||
"cwebp": "cli.js" | ||
}, | ||
"devDependencies": { | ||
"bin-check": "^1.0.0", | ||
"mocha": "^1.21.4", | ||
"rimraf": "^2.2.8" | ||
"scripts": { | ||
"postinstall": "node lib/install.js", | ||
"test": "node test/test.js" | ||
}, | ||
@@ -50,9 +29,23 @@ "files": [ | ||
"keywords": [ | ||
"compress", | ||
"image", | ||
"img", | ||
"jpeg", | ||
"jpg", | ||
"jpeg", | ||
"minify", | ||
"optimize", | ||
"png", | ||
"webp" | ||
] | ||
], | ||
"dependencies": { | ||
"bin-build": "^1.0.0", | ||
"bin-wrapper": "^1.0.0", | ||
"log-symbols": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^0.0.4", | ||
"bin-check": "^1.0.0", | ||
"mkdirp": "^0.5.0", | ||
"rimraf": "^2.2.8" | ||
} | ||
} |
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
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
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
61
3594
4
1
43
1