first commit
This commit is contained in:
+7
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
const spawn = require('child_process').spawn;
|
||||
const binPath = require('.');
|
||||
|
||||
spawn(binPath, process.argv.slice(2), {stdio: 'inherit'})
|
||||
.on('exit', process.exit);
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
module.exports = require('./lib').path();
|
||||
+15
@@ -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
@@ -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');
|
||||
});
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Imagemin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
{
|
||||
"_from": "cwebp-bin@^4.0.0",
|
||||
"_id": "cwebp-bin@4.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-7it/YzPTQm+1K7QF+m8uyLYolPQ=",
|
||||
"_location": "/cwebp-bin",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "cwebp-bin@^4.0.0",
|
||||
"name": "cwebp-bin",
|
||||
"escapedName": "cwebp-bin",
|
||||
"rawSpec": "^4.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^4.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/imagemin-webp"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/cwebp-bin/-/cwebp-bin-4.0.0.tgz",
|
||||
"_shasum": "ee2b7f6333d3426fb52bb405fa6f2ec8b62894f4",
|
||||
"_spec": "cwebp-bin@^4.0.0",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build/node_modules/imagemin-webp",
|
||||
"author": {
|
||||
"name": "1000ch",
|
||||
"email": "shogo.sensui@gmail.com",
|
||||
"url": "github.com/1000ch"
|
||||
},
|
||||
"bin": {
|
||||
"cwebp": "cli.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/imagemin/cwebp-bin/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"bin-build": "^2.2.0",
|
||||
"bin-wrapper": "^3.0.1",
|
||||
"logalot": "^2.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "cwebp wrapper that makes it seamlessly available as a local dependency",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"bin-check": "^4.0.1",
|
||||
"compare-size": "^3.0.0",
|
||||
"execa": "^0.8.0",
|
||||
"tempy": "^0.2.1",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"files": [
|
||||
"cli.js",
|
||||
"index.js",
|
||||
"lib"
|
||||
],
|
||||
"homepage": "https://github.com/imagemin/cwebp-bin#readme",
|
||||
"keywords": [
|
||||
"imagemin",
|
||||
"compress",
|
||||
"image",
|
||||
"img",
|
||||
"jpeg",
|
||||
"jpg",
|
||||
"minify",
|
||||
"optimize",
|
||||
"png",
|
||||
"webp"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
{
|
||||
"name": "Kevin Mårtensson",
|
||||
"email": "kevinmartensson@gmail.com",
|
||||
"url": "github.com/kevva"
|
||||
},
|
||||
{
|
||||
"name": "Shinnosuke Watanabe",
|
||||
"url": "github.com/shinnn"
|
||||
}
|
||||
],
|
||||
"name": "cwebp-bin",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/imagemin/cwebp-bin.git"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "node lib/install.js",
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "4.0.0"
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
# cwebp-bin [](https://travis-ci.org/imagemin/cwebp-bin)
|
||||
|
||||
> [WebP](https://developers.google.com/speed/webp/) is a new image format that provides lossless and lossy compression for images on the web. WebP lossless images are 26% smaller in size compared to PNGs. WebP lossy images are 25-34% smaller in size compared to JPEG images at equivalent SSIM index.
|
||||
|
||||
You probably want [`imagemin-webp`](https://github.com/imagemin/imagemin-webp) instead.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install cwebp-bin
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const {execFile} = require('child_process');
|
||||
const cwebp = require('cwebp-bin');
|
||||
|
||||
execFile(cwebp, ['input.png', '-o', 'output.webp'], err => {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
console.log('Image is converted!');
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## CLI
|
||||
|
||||
```
|
||||
$ npm install --global cwebp-bin
|
||||
```
|
||||
|
||||
```
|
||||
$ cwebp --help
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Imagemin](https://github.com/imagemin)
|
||||
BIN
Binary file not shown.
Reference in New Issue
Block a user