@forge/cli

11.5.0-next.11-experimental-9e772ae11.5.0-next.23
out/command-line/command.js
~out/command-line/command.jsModified
+14−8
Index: package/out/command-line/command.js
===================================================================
--- package/out/command-line/command.js
+++ package/out/command-line/command.js
@@ -1,7 +1,7 @@
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
-exports.validateContext = exports.getAutocompleteConfig = exports.Command = exports.WrapperError = void 0;
+exports.environmentPrecondition = exports.validateContext = exports.getAutocompleteConfig = exports.Command = exports.WrapperError = void 0;
 const tslib_1 = require("tslib");
 const commander_1 = tslib_1.__importStar(require("commander"));
 const semver_1 = tslib_1.__importDefault(require("semver"));
 const cli_shared_1 = require("@forge/cli-shared");
@@ -147,10 +147,10 @@
     }
     requireAppId() {
         return this.precondition(this.preCommandController.verifyManifestExistsWithAppConfig());
     }
-    verifyRuntimeVersion() {
-        return this.precondition(this.preCommandController.verifyRuntimeVersion());
+    showRuntimeWarning() {
+        return this.precondition(this.preCommandController.showRuntimeWarning());
     }
     nonInteractiveOption(...args) {
         return this.clone({ requiredOptionFlags: args }).option('--non-interactive', cli_shared_1.Text.nonInteractive.description);
     }
@@ -182,13 +182,9 @@
             return await (0, cli_shared_1.exitOnError)(this.ui, err);
         }
     }
     environmentOption() {
-        return this.option('-e, --environment [environment]', cli_shared_1.Text.env.option).precondition(async (...args) => {
-            const { environment: environmentArg, nonInteractive } = last(args);
-            const environment = environmentArg || (await this.defaultEnvironmentController.run(nonInteractive));
-            return { environment: (0, environment_1.checkEnvironmentOption)(environment) };
-        });
+        return this.option('-e, --environment [environment]', cli_shared_1.Text.env.option).precondition(environmentPrecondition('environment', this.defaultEnvironmentController));
     }
     contextOption() {
         const supportedProductsService = this.supportedProductsService;
         return this.option('-s, --site [site]', cli_shared_1.Text.optionSite)
@@ -455,5 +451,15 @@
     }
     return { site: maybeSiteUrl, product: maybeSupportedProduct };
 }
 exports.validateContext = validateContext;
+function environmentPrecondition(key, environmentController) {
+    return async (...args) => {
+        const lastArgs = last(args);
+        const environmentArg = lastArgs[key];
+        const nonInteractive = lastArgs.nonInteractive ?? false;
+        const environment = environmentArg || (await environmentController.run(nonInteractive));
+        return { [key]: (0, environment_1.checkEnvironmentOption)(environment) };
+    };
+}
+exports.environmentPrecondition = environmentPrecondition;
 //# sourceMappingURL=command.js.map
\ No newline at end of file