HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/buyercall_forms/buyercall/node_modules/pngquant-bin/lib/install.js
'use strict';
const path = require('path');
const binBuild = require('bin-build');
const log = require('logalot');
const bin = require('.');

bin.run(['--version']).then(() => {
	log.success('pngquant pre-build test passed successfully');
}).catch(err => {
	log.warn(err.message);
	log.warn('pngquant pre-build test failed');
	log.info('compiling from source');

	const libpng = process.platform === 'darwin' ? 'libpng' : 'libpng-dev';

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

		// eslint-disable-next-line unicorn/no-process-exit
		process.exit(1);
	});
});