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:
		
							parent
							
								
									21206b670c
								
							
						
					
					
						commit
						2b5337329a
					
				
					 3 changed files with 8 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -18,7 +18,7 @@ RUN if ! [ -z "$DISABLE_TRANSLATE" ] && [ "$DISABLE_TRANSLATE" != "yes" ] && [ "
 | 
			
		|||
    fi
 | 
			
		||||
 | 
			
		||||
# install translate/minify modules if need too
 | 
			
		||||
RUN if [ -z "$DISABLE_MINIFY" ] || [ -z "$DISABLE_TRANSLATE" ]; then cd meshcentral && npm install html-minifier jsdom minify-js; fi
 | 
			
		||||
RUN if [ -z "$DISABLE_MINIFY" ] || [ -z "$DISABLE_TRANSLATE" ]; then cd meshcentral && npm install html-minifier jsdom; fi
 | 
			
		||||
 | 
			
		||||
# first extractall if need too
 | 
			
		||||
RUN if [ -z "$DISABLE_MINIFY" ] || [ -z "$DISABLE_TRANSLATE" ]; then cd meshcentral/translate && node translate.js extractall; fi
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4143,7 +4143,7 @@ function mainStart() {
 | 
			
		|||
        else if (config.settings.xmongodb != null) { modules.push('mongojs@3.1.0'); } // Add MongoJS, old driver.
 | 
			
		||||
        if (nodemailer || ((config.smtp != null) && (config.smtp.name != 'console')) || (config.sendmail != null)) { modules.push('nodemailer@6.9.8'); } // Add SMTP support
 | 
			
		||||
        if (sendgrid || (config.sendgrid != null)) { modules.push('@sendgrid/mail'); } // Add SendGrid support
 | 
			
		||||
        if ((args.translate || args.dev) && (Number(process.version.match(/^v(\d+\.\d+)/)[1]) >= 16)) { modules.push('jsdom@22.1.0'); modules.push('esprima@4.0.1'); modules.push('minify-js@0.0.4'); modules.push('html-minifier@4.0.0'); } // Translation support
 | 
			
		||||
        if ((args.translate || args.dev) && (Number(process.version.match(/^v(\d+\.\d+)/)[1]) >= 16)) { modules.push('jsdom@22.1.0'); modules.push('esprima@4.0.1'); modules.push('html-minifier@4.0.0'); } // Translation support
 | 
			
		||||
        if (typeof config.settings.crowdsec == 'object') { modules.push('@crowdsec/express-bouncer@0.1.0'); } // Add CrowdSec bounser module (https://www.npmjs.com/package/@crowdsec/express-bouncer)
 | 
			
		||||
 | 
			
		||||
        if (typeof config.settings.autobackup == 'object') {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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');
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue