first commit
This commit is contained in:
13
build/node_modules/guetzli/lib/index.js
generated
vendored
Normal file
13
build/node_modules/guetzli/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const BinWrapper = require('bin-wrapper');
|
||||
const pkg = require('../package.json');
|
||||
|
||||
const url = `https://raw.githubusercontent.com/imagemin/guetzli-bin/v${pkg.version}/vendor/`;
|
||||
|
||||
module.exports = new BinWrapper()
|
||||
.src(`${url}macos/guetzli`, 'darwin')
|
||||
.src(`${url}linux/guetzli`, 'linux')
|
||||
.src(`${url}win/guetzli.exe`, 'win32')
|
||||
.dest(path.resolve(__dirname, '../vendor'))
|
||||
.use(process.platform === 'win32' ? 'guetzli.exe' : 'guetzli');
|
||||
28
build/node_modules/guetzli/lib/install.js
generated
vendored
Normal file
28
build/node_modules/guetzli/lib/install.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
const BinBuild = require('bin-build');
|
||||
const log = require('logalot');
|
||||
const bin = require('.');
|
||||
|
||||
bin.run(['--version'], err => {
|
||||
if (err) {
|
||||
log.warn(err.message);
|
||||
log.warn('guetzli pre-build test failed');
|
||||
log.info('compiling from source');
|
||||
|
||||
const builder = new BinBuild()
|
||||
.src('https://github.com/google/guetzli/archive/v1.0.1.tar.gz')
|
||||
.cmd(`mkdir -p ${bin.dest()}`)
|
||||
.cmd(`make && mv bin/Release/${bin.use()} ${bin.path()}`);
|
||||
|
||||
return builder.run(err => {
|
||||
if (err) {
|
||||
log.error(err.stack);
|
||||
return;
|
||||
}
|
||||
|
||||
log.success('guetzli built successfully');
|
||||
});
|
||||
}
|
||||
|
||||
log.success('guetzli pre-build test passed successfully');
|
||||
});
|
||||
Reference in New Issue
Block a user