From c958d2bb90e3268339680134f6147b3a25c54b34 Mon Sep 17 00:00:00 2001 From: Wee Bit Date: Fri, 11 Aug 2023 20:47:40 +0200 Subject: [PATCH] Remove NODE_ENV check Motivation: https://github.com/tj/commander.js/pull/1955 --- lib/command.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/command.js b/lib/command.js index a8f41a672..40f02f34d 100644 --- a/lib/command.js +++ b/lib/command.js @@ -12,8 +12,6 @@ const { suggestSimilar } = require('./suggestSimilar'); // @ts-check -const PRODUCTION = process.env.NODE_ENV === 'production'; - class Command extends EventEmitter { /** * Initialize a new `Command`. @@ -905,7 +903,7 @@ Expecting one of '${allowedValues.join("', '")}'`); _parseSubroutine(async, userArgsCallback, argv, parseOptions) { const methodName = async ? 'parseAsync' : 'parse'; - if (!PRODUCTION && this.parent) { + if (this.parent) { console.warn(`Called .${methodName}() on subcommand '${this._name}'. Call on top-level command instead`); } @@ -934,7 +932,7 @@ Call on top-level command instead`); parse(argv, parseOptions) { return this._parseSubroutine(false, (userArgs) => { const result = this._parseCommand([], userArgs); - if (!PRODUCTION && isThenable(result)) { + if (isThenable(result)) { console.warn(`.parse() is incompatible with async hooks and actions. Use .parseAsync() instead.`); }