* Fix workflow * Trigger * [auto] Update compiled version * [auto] Commit modules * Push Windows changes * Fix * [auto] Update compiled version * Try removing cwd * [auto] Update compiled version * Try with path module * [auto] Update compiled version * Fix path * [auto] Update compiled version * Use raw path * [auto] Update compiled version * Other path * [auto] Update compiled version * Avoid @action/exec * [auto] Update compiled version * test * [auto] Update compiled version * test * [auto] Update compiled version * test * [auto] Update compiled version * test * [auto] Update compiled version * Try with shelljs * [auto] Update compiled version * Fix my stupidity * Copy scripts to local dir * [auto] Update compiled version * Still use path * [auto] Update compiled version * Delete entrypoint.sh * [auto] Update compiled version * Make file executable * [auto] Update compiled version * Try using bash * [auto] Update compiled version
52 lines
1.3 KiB
JavaScript
Executable File
52 lines
1.3 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
/*!
|
|
* node-minify
|
|
* Copyright(c) 2011-2019 Rodolphe Stoclin
|
|
* MIT Licensed
|
|
*/
|
|
|
|
const updateNotifier = require('update-notifier');
|
|
const program = require('commander');
|
|
const cli = require('../lib/cli');
|
|
const pkg = require('../package.json');
|
|
|
|
updateNotifier({ pkg: pkg }).notify();
|
|
|
|
program
|
|
.version(pkg.version, '-v, --version')
|
|
.option('-c, --compressor [compressor]', 'use the specified compressor [uglify-js]', 'uglify-js')
|
|
.option('-i, --input [file]', 'input file path')
|
|
.option('-o, --output [file]', 'output file path')
|
|
.option('-s, --silence', 'no output will be printed')
|
|
.option('-O, --option [option]', 'option for the compressor as JSON object', '');
|
|
|
|
program.on('--help', function() {
|
|
console.log(' List of compressors:');
|
|
console.log('');
|
|
console.log(' - babel-minify');
|
|
console.log(' - gcc');
|
|
console.log(' - html-minifier');
|
|
console.log(' - terser');
|
|
console.log(' - uglify-js');
|
|
console.log(' - uglify-es');
|
|
console.log(' - yui');
|
|
console.log('');
|
|
});
|
|
|
|
program.parse(process.argv);
|
|
|
|
const options = program.opts();
|
|
|
|
/**
|
|
* Show help if missing mandatory.
|
|
*/
|
|
if (!options.compressor || !options.input || !options.output) {
|
|
program.help();
|
|
}
|
|
|
|
cli.run(options).catch(err => {
|
|
console.error(err);
|
|
process.exit(1);
|
|
});
|