Update with working working version (#12)
* 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
This commit is contained in:
96
node_modules/@node-minify/cli/lib/cli.js
generated
vendored
Normal file
96
node_modules/@node-minify/cli/lib/cli.js
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.run = void 0;
|
||||
|
||||
var _chalk = _interopRequireDefault(require("chalk"));
|
||||
|
||||
var _compress = require("./compress");
|
||||
|
||||
var _spinner = require("./spinner");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/*!
|
||||
* node-minify
|
||||
* Copyright(c) 2011-2019 Rodolphe Stoclin
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module variables.
|
||||
*/
|
||||
let silence = false;
|
||||
/**
|
||||
* Run one compressor.
|
||||
*/
|
||||
|
||||
const runOne = cli => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const compressor = typeof cli.compressor === 'string' ? require(`@node-minify/${cli.compressor}`) : cli.compressor;
|
||||
const options = {
|
||||
compressorLabel: cli.compressor,
|
||||
compressor,
|
||||
input: cli.input.split(','),
|
||||
output: cli.output
|
||||
};
|
||||
|
||||
if (cli.option) {
|
||||
options.options = JSON.parse(cli.option);
|
||||
}
|
||||
|
||||
if (!silence) {
|
||||
(0, _spinner.spinnerStart)(options);
|
||||
}
|
||||
|
||||
return (0, _compress.compress)(options).then(result => {
|
||||
if (!silence) {
|
||||
(0, _spinner.spinnerStop)(result);
|
||||
}
|
||||
|
||||
resolve(result);
|
||||
}).catch(err => {
|
||||
if (!silence) {
|
||||
(0, _spinner.spinnerError)(options);
|
||||
}
|
||||
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Run cli.
|
||||
*/
|
||||
|
||||
|
||||
const run = cli => {
|
||||
silence = !!cli.silence;
|
||||
|
||||
if (!silence) {
|
||||
console.log('');
|
||||
console.log(_chalk.default.bgBlue.black(' INFO '), 'Starting compression...');
|
||||
console.log('');
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
runOne(cli).then(() => {
|
||||
if (!silence) {
|
||||
console.log('');
|
||||
console.log(_chalk.default.bgGreen.black(' DONE '), _chalk.default.green('Done!'));
|
||||
console.log('');
|
||||
}
|
||||
}).then(resolve).catch(reject);
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Expose `run()`.
|
||||
*/
|
||||
|
||||
|
||||
exports.run = run;
|
||||
Reference in New Issue
Block a user