Comparing version 0.1.9 to 0.1.10
61
index.js
'use strict'; | ||
var BinBuild = require('bin-build'); | ||
var BinWrapper = require('bin-wrapper'); | ||
var fs = require('fs'); | ||
var logSymbols = require('log-symbols'); | ||
var path = require('path'); | ||
var pkg = require('./package.json'); | ||
var bin = require('./lib'); | ||
/** | ||
* Variables | ||
*/ | ||
var BIN_VERSION = '2.1'; | ||
var BASE_URL = 'https://raw.github.com/kevva/mozjpeg/v' + pkg.version + '/vendor/'; | ||
/** | ||
* Initialize a new BinWrapper | ||
*/ | ||
var bin = new BinWrapper({ global: false }) | ||
.src(BASE_URL + 'linux/jpegtran', 'linux') | ||
.src(BASE_URL + 'win/jpegtran.exe', 'win32') | ||
.dest(path.join(__dirname, 'vendor')) | ||
.use(process.platform === 'win32' ? 'jpegtran.exe' : 'jpegtran'); | ||
/** | ||
* Only run check if binary doesn't already exist | ||
*/ | ||
fs.exists(bin.use(), function (exists) { | ||
if (!exists) { | ||
var args = [ | ||
'-copy', 'none', | ||
'-outfile', path.join(__dirname, 'test/fixtures/test-optimized.jpg'), | ||
path.join(__dirname, 'test/fixtures/test.jpg') | ||
]; | ||
bin.run(args, function (err) { | ||
if (err) { | ||
console.log(logSymbols.warning + ' pre-build test failed, compiling from source...'); | ||
var builder = new BinBuild() | ||
.src('https://github.com/mozilla/mozjpeg/archive/v' + BIN_VERSION + '.tar.gz') | ||
.cmd('autoreconf -fiv && ./configure --disable-shared --prefix="' + bin.dest() + '" --bindir="' + bin.dest() + '" --libdir="' + bin.dest() + '"') | ||
.cmd('make && make install'); | ||
return builder.build(function (err) { | ||
if (err) { | ||
return console.log(logSymbols.error, err); | ||
} | ||
console.log(logSymbols.success + ' mozjpeg built successfully!'); | ||
}); | ||
} | ||
console.log(logSymbols.success + ' pre-build test passed successfully!'); | ||
}); | ||
} | ||
}); | ||
/** | ||
* Module exports | ||
*/ | ||
module.exports.path = bin.use(); | ||
module.exports.path = bin.path(); |
{ | ||
"name": "mozjpeg", | ||
"version": "0.1.9", | ||
"version": "0.1.10", | ||
"description": "mozjpeg wrapper that makes it seamlessly available as a local dependency", | ||
"license": "MIT", | ||
"repository": "kevva/mozjpeg", | ||
"repository": "imagemin/mozjpeg-bin", | ||
"author": { | ||
@@ -19,3 +19,3 @@ "name": "Kevin Mårtensson", | ||
"scripts": { | ||
"postinstall": "node index.js", | ||
"postinstall": "node lib/install.js", | ||
"test": "mocha --reporter list --timeout 150000" | ||
@@ -26,2 +26,3 @@ }, | ||
"index.js", | ||
"lib", | ||
"test" | ||
@@ -41,3 +42,3 @@ ], | ||
"bin-build": "^0.2.0", | ||
"bin-wrapper": "^0.3.0", | ||
"bin-wrapper": "^0.4.0", | ||
"log-symbols": "^1.0.0" | ||
@@ -44,0 +45,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
# mozjpeg [![Build Status](https://secure.travis-ci.org/kevva/mozjpeg.svg?branch=master)](http://travis-ci.org/kevva/mozjpeg) | ||
# mozjpeg-bin [![Build Status](https://secure.travis-ci.org/imagemin/mozjpeg-bin.svg?branch=master)](http://travis-ci.org/imagemin/mozjpeg-bin) | ||
@@ -3,0 +3,0 @@ > mozjpeg is a production-quality JPEG encoder that improves compression while maintaining compatibility with the vast majority of deployed decoders |
@@ -0,0 +0,0 @@ /*global afterEach, beforeEach, describe, it */ |
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
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
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
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
101140
9
115
2
+ Addedarchive-type@0.1.4(transitive)
+ Addedarray-uniq@0.1.1(transitive)
+ Addedbin-version@0.1.0(transitive)
+ Addedbin-version-check@0.1.0(transitive)
+ Addedbin-wrapper@0.4.0(transitive)
+ Addeddecompress@0.3.3(transitive)
+ Addeddecompress-tar@0.1.1(transitive)
+ Addeddecompress-targz@0.1.1(transitive)
+ Addeddecompress-unzip@0.1.2(transitive)
+ Addeddownload@0.2.4(transitive)
+ Addedeach-async@1.1.1(transitive)
+ Addedfind-versions@0.1.1(transitive)
+ Addedfs-extra@0.10.00.8.1(transitive)
+ Addedget-stdin@1.0.0(transitive)
+ Addedis-7zip@0.1.0(transitive)
+ Addedis-bzip2@0.1.0(transitive)
+ Addedis-gzip@0.1.0(transitive)
+ Addedis-rar@0.1.0(transitive)
+ Addedis-tar@0.1.1(transitive)
+ Addedis-zip@0.1.0(transitive)
+ Addedjsonfile@1.1.11.2.0(transitive)
+ Addedminimist@0.1.0(transitive)
+ Addedncp@0.4.20.5.1(transitive)
+ Addedonetime@1.1.0(transitive)
+ Addedread-chunk@0.1.0(transitive)
+ Addedrimraf@2.2.8(transitive)
+ Addedsemver@2.3.2(transitive)
+ Addedsemver-regex@0.1.1(transitive)
+ Addedset-immediate-shim@1.0.1(transitive)
+ Addedsimple-bufferstream@0.0.4(transitive)
+ Addedtemp-write@0.3.1(transitive)
+ Addedware@0.2.10.3.0(transitive)
- Removedbin-wrapper@0.3.4(transitive)
Updatedbin-wrapper@^0.4.0