first commit
This commit is contained in:
15
build/node_modules/cwebp-bin/lib/index.js
generated
vendored
Normal file
15
build/node_modules/cwebp-bin/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const BinWrapper = require('bin-wrapper');
|
||||
const pkg = require('../package.json');
|
||||
|
||||
const url = `https://raw.githubusercontent.com/imagemin/cwebp-bin/v${pkg.version}/vendor/`;
|
||||
|
||||
module.exports = new BinWrapper()
|
||||
.src(`${url}osx/cwebp`, 'darwin')
|
||||
.src(`${url}linux/x86/cwebp`, 'linux', 'x86')
|
||||
.src(`${url}linux/x64/cwebp`, 'linux', 'x64')
|
||||
.src(`${url}win/x86/cwebp.exe`, 'win32', 'x86')
|
||||
.src(`${url}win/x64/cwebp.exe`, 'win32', 'x64')
|
||||
.dest(path.join(__dirname, '../vendor'))
|
||||
.use(process.platform === 'win32' ? 'cwebp.exe' : 'cwebp');
|
||||
28
build/node_modules/cwebp-bin/lib/install.js
generated
vendored
Normal file
28
build/node_modules/cwebp-bin/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('cwebp pre-build test failed');
|
||||
log.info('compiling from source');
|
||||
|
||||
const builder = new BinBuild()
|
||||
.src('http://downloads.webmproject.org/releases/webp/libwebp-0.6.1.tar.gz')
|
||||
.cmd(`./configure --disable-shared --prefix="${bin.dest()}" --bindir="${bin.dest()}"`)
|
||||
.cmd('make && make install');
|
||||
|
||||
return builder.run(err => {
|
||||
if (err) {
|
||||
log.error(err.stack);
|
||||
return;
|
||||
}
|
||||
|
||||
log.success('cwebp built successfully');
|
||||
});
|
||||
}
|
||||
|
||||
log.success('cwebp pre-build test passed successfully');
|
||||
});
|
||||
Reference in New Issue
Block a user