Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #90 (update bin-wrapper to 4.0.1) #95

Merged
merged 2 commits into from Oct 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
44 changes: 21 additions & 23 deletions lib/install.js
Expand Up @@ -4,30 +4,28 @@ const binBuild = require('bin-build');
const logalot = require('logalot');
const bin = require('.');

bin.run(['--version'], err => {
if (err) {
logalot.warn(err.message);
logalot.warn('pngquant pre-build test failed');
logalot.info('compiling from source');

const libpng = process.platform === 'darwin' ? 'libpng' : 'libpng-dev';
bin.run(['--version']).then(() => {
logalot.success('pngquant pre-build test passed successfully');
}).catch(err => {
logalot.warn(err.message);
logalot.warn('pngquant pre-build test failed');
logalot.info('compiling from source');

binBuild.file(path.resolve(__dirname, '../vendor/source/pngquant.tar.gz'), [
'rm ./INSTALL',
`./configure --prefix="${bin.dest()}"`,
`make install BINPREFIX="${bin.dest()}"`
])
.then(() => {
logalot.success('pngquant built successfully');
})
.catch(err => {
err.message = `pngquant failed to build, make sure that ${libpng} is installed`;
logalot.error(err.stack);
const libpng = process.platform === 'darwin' ? 'libpng' : 'libpng-dev';

// eslint-disable-next-line unicorn/no-process-exit
process.exit(1);
});
}
binBuild.file(path.resolve(__dirname, '../vendor/source/pngquant.tar.gz'), [
'rm ./INSTALL',
`./configure --prefix="${bin.dest()}"`,
`make install BINPREFIX="${bin.dest()}"`
])
.then(() => {
logalot.success('pngquant built successfully');
})
.catch(err => {
err.message = `pngquant failed to build, make sure that ${libpng} is installed`;
logalot.error(err.stack);

logalot.success('pngquant pre-build test passed successfully');
// eslint-disable-next-line unicorn/no-process-exit
process.exit(1);
});
});
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -48,7 +48,7 @@
],
"dependencies": {
"bin-build": "^3.0.0",
"bin-wrapper": "^3.0.0",
"bin-wrapper": "^4.0.1",
"execa": "^0.10.0",
"logalot": "^2.0.0"
},
Expand Down
3 changes: 2 additions & 1 deletion test.js
Expand Up @@ -29,7 +29,8 @@ test('minify a png', async t => {
const src = path.join(__dirname, 'fixtures/test.png');
const dest = path.join(tmp, 'test.png');
const args = [
'-o', dest,
'-o',
dest,
src
];

Expand Down