Socket
Socket
Sign inDemoInstall

cwebp-bin

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cwebp-bin - npm Package Compare versions

Comparing version 0.1.8 to 1.0.0

README.md

5

cli.js

@@ -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;

29

lib/index.js

@@ -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"
}
}
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