1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

remove minify-js use html-minifier instead #6357

Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
si458 2024-09-10 20:01:10 +01:00
parent 21206b670c
commit 2b5337329a
3 changed files with 8 additions and 6 deletions

View file

@ -140,7 +140,7 @@ if (directRun && (NodeJSVer >= 12)) {
// Get things setup
jsdom = require('jsdom');
esprima = require('esprima'); // https://www.npmjs.com/package/esprima
if (minifyLib == 1) { minify = require('minify-js'); }
if (minifyLib == 1) { log("minify-js is no longer used, please switch to \"html-minifier\""); process.exit(); return; }
if (minifyLib == 2) { minify = require('html-minifier').minify; } // https://www.npmjs.com/package/html-minifier
switch (op) {
@ -157,8 +157,8 @@ if (directRun && (NodeJSVer >= 12)) {
if (directRun) { setup(); }
function setup() {
var libs = ['jsdom@22.1.0', 'esprima@4.0.1', 'minify-js@0.0.4'];
if (minifyLib == 1) { libs.push('minify-js@0.0.4'); }
var libs = ['jsdom@22.1.0', 'esprima@4.0.1'];
if (minifyLib == 1) { log("minify-js is no longer used, please switch to \"html-minifier\""); process.exit(); return; }
if (minifyLib == 2) { libs.push('html-minifier@4.0.0'); }
InstallModules(libs, start);
}
@ -169,7 +169,7 @@ function startEx(argv) {
// Load dependencies
jsdom = require('jsdom');
esprima = require('esprima'); // https://www.npmjs.com/package/esprima
if (minifyLib == 1) { minify = require('minify-js'); }
if (minifyLib == 1) { log("minify-js is no longer used, please switch to \"html-minifier\""); process.exit(); return; }
if (minifyLib == 2) { minify = require('html-minifier').minify; } // https://www.npmjs.com/package/html-minifier
var command = null;
@ -490,6 +490,8 @@ function startEx(argv) {
outnamemin = (outname.substring(0, outname.length - 5) + '-min.html');
} else if (outname.endsWith('.htm')) {
outnamemin = (outname.substring(0, outname.length - 4) + '-min.htm');
} else if (outname.endsWith('.js')) {
outnamemin = (outname.substring(0, outname.length - 3) + '-min.js');
} else {
outnamemin = (outname, outname + '.min');
}