From bec6f4284931d1a3b10f057e7a8dae271b159c0f Mon Sep 17 00:00:00 2001 From: bulk88 Date: Wed, 14 Apr 2021 03:39:08 -0400 Subject: [PATCH] fix config file: "html5" and "includeAutoGeneratedTags" were ignored the fix for #860 enabled disabling these 2 flags from the command line but also made them uncontrollable from the JSON config file old commander.js (not 2021 commander.js) assigns boolean true unconditionally as defaultValue for all --no- arguments, when minifier fuses command line and JSON config file options together in cli.js's createOptions(), it sees program["includeAutoGeneratedTags"] = true and ignored config["includeAutoGeneratedTags"], in my case "= false". Delete the defaultValue/key from commander.js object before parsing user's ARGV to solve the bug. --- cli.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cli.js b/cli.js index 2d0a9b30..91bb6ca6 100755 --- a/cli.js +++ b/cli.js @@ -147,6 +147,9 @@ mainOptionKeys.forEach(function(key) { } else if (~['html5', 'includeAutoGeneratedTags'].indexOf(key)) { program.option('--no-' + paramCase(key), option); +// prevent defaultValue = true for --no- args in commander v2.15.X +// since command line overrides JSON config file cmd line arg missing + delete program[key]; } else { program.option('--' + paramCase(key), option);