You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

install.js 890B

1234567891011121314151617181920212223242526272829
  1. 'use strict';
  2. const path = require('path');
  3. const binBuild = require('bin-build');
  4. const log = require('logalot');
  5. const bin = require('.');
  6. bin.run(['--version']).then(() => {
  7. log.success('pngquant pre-build test passed successfully');
  8. }).catch(err => {
  9. log.warn(err.message);
  10. log.warn('pngquant pre-build test failed');
  11. log.info('compiling from source');
  12. const libpng = process.platform === 'darwin' ? 'libpng' : 'libpng-dev';
  13. binBuild.file(path.resolve(__dirname, '../vendor/source/pngquant.tar.gz'), [
  14. 'rm ./INSTALL',
  15. `./configure --prefix="${bin.dest()}"`,
  16. `make install BINPREFIX="${bin.dest()}"`
  17. ]).then(() => {
  18. log.success('pngquant built successfully');
  19. }).catch(err => {
  20. err.message = `pngquant failed to build, make sure that ${libpng} is installed`;
  21. log.error(err.stack);
  22. // eslint-disable-next-line unicorn/no-process-exit
  23. process.exit(1);
  24. });
  25. });