@forge/cli
12.22.0-experimental-04cc2b912.23.0-next.7-experimental-44b7a12
out/command-line/register-app-commands.js~
out/command-line/register-app-commands.jsModified+10−13
Index: package/out/command-line/register-app-commands.js
===================================================================
--- package/out/command-line/register-app-commands.js
+++ package/out/command-line/register-app-commands.js
@@ -1,13 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-exports.isValidDevSpaceId = exports.CATEGORY_PREDICATES = exports.PRODUCT_OPTIONS_DISPLAY = exports.TemplateContext = exports.TemplateCategory = void 0;
-exports.formatProduct = formatProduct;
-exports.templateMatchesProduct = templateMatchesProduct;
-exports.directoryNameFromAppName = directoryNameFromAppName;
-exports.createCommandHandler = createCommandHandler;
-exports.filterTemplatesByProduct = filterTemplatesByProduct;
-exports.registerCommands = registerCommands;
+exports.registerCommands = exports.filterTemplatesByProduct = exports.createCommandHandler = exports.isValidDevSpaceId = exports.directoryNameFromAppName = exports.templateMatchesProduct = exports.formatProduct = exports.CATEGORY_PREDICATES = exports.PRODUCT_OPTIONS_DISPLAY = exports.TemplateContext = exports.TemplateCategory = void 0;
const tslib_1 = require("tslib");
const fs_1 = tslib_1.__importDefault(require("fs"));
const sanitize_filename_1 = tslib_1.__importDefault(require("sanitize-filename"));
const cli_shared_1 = require("@forge/cli-shared");
@@ -18,9 +12,9 @@
TemplateCategory["ROVO"] = "Rovo Agent and action";
TemplateCategory["UI_KIT_2"] = "UI Kit";
TemplateCategory["CUSTOM_UI"] = "Custom UI";
TemplateCategory["BACKEND"] = "Triggers and Validators";
-})(TemplateCategory || (exports.TemplateCategory = TemplateCategory = {}));
+})(TemplateCategory = exports.TemplateCategory || (exports.TemplateCategory = {}));
var TemplateContext;
(function (TemplateContext) {
TemplateContext["SHOW_ALL"] = "show-all";
TemplateContext["GLOBAL"] = "global";
@@ -34,9 +28,9 @@
TemplateContext["CUSTOMER_SERVICE_MANAGEMENT"] = "customer-service-management";
TemplateContext["TEAMWORK_GRAPH"] = "teamwork-graph";
TemplateContext["ROVO"] = "rovo";
TemplateContext["CROSS_CONTEXT"] = "cross-context";
-})(TemplateContext || (exports.TemplateContext = TemplateContext = {}));
+})(TemplateContext = exports.TemplateContext || (exports.TemplateContext = {}));
const GLOBAL_TEMPLATE_NAME = 'global-ui-ui-kit';
const PRODUCT_OPTIONS = {
[TemplateContext.SHOW_ALL]: [TemplateContext.SHOW_ALL],
[TemplateContext.GLOBAL]: [TemplateContext.GLOBAL],
@@ -82,8 +76,9 @@
.split('-')
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
.join(' '));
}
+exports.formatProduct = formatProduct;
function ensureDirectoryDoesntExist(directory) {
if (fs_1.default.existsSync(directory)) {
throw new cli_shared_2.ValidationError(cli_shared_2.Text.create.error.directory.exists(directory));
}
@@ -114,19 +109,17 @@
return { name: modifyTemplateByCategory(template, category), analytics: { category } };
}
else {
const templateName = await ui.promptForList(cli_shared_2.Text.create.promptTemplate, filteredTemplates);
- return {
- name: templateName,
- analytics: { category: undefined }
- };
+ return { name: templateName, analytics: { category: undefined } };
}
}
function templateMatchesProduct(productName, templateName, products) {
return (templateName.includes(productName) &&
products.length > 0 &&
!products.some((otherProduct) => otherProduct && otherProduct.length > productName.length && templateName.includes(otherProduct)));
}
+exports.templateMatchesProduct = templateMatchesProduct;
function directoryNameFromAppName(appName) {
if (appName === undefined) {
return undefined;
}
@@ -134,8 +127,9 @@
const chars = Array.from(normalized);
const allDashes = chars.every((char) => char === '-');
return allDashes ? undefined : normalized;
}
+exports.directoryNameFromAppName = directoryNameFromAppName;
const isValidDevSpaceId = (developerSpaceId) => {
const UUID_PATTERN = /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
return UUID_PATTERN.test(developerSpaceId);
};
@@ -242,8 +236,9 @@
});
ui.info(cli_shared_2.Text.create.cmd.successDetails(directory, result.environments));
return result;
}
+exports.createCommandHandler = createCommandHandler;
function prepareDirectoryForApp(ui, name, template, directory) {
if (directory) {
ensureDirectoryDoesntExist(directory);
ui.info(cli_shared_2.Text.create.intro(directory));
@@ -330,8 +325,9 @@
return product === 'show-all'
? templates
: templates.filter((template) => templateMatchesProduct(product, template, productOptions));
}
+exports.filterTemplatesByProduct = filterTemplatesByProduct;
function filterTemplatesByCategory(templates, category) {
return category === TemplateCategory.SHOW_ALL
? templates
: templates.map((name) => name.replace('-ui-kit', '').replace('-custom-ui', '').replace('-rovo', ''));
@@ -419,5 +415,6 @@
async function registerCommands(deps) {
await registerCreateCommands(deps);
await registerRegisterCommand(deps);
}
+exports.registerCommands = registerCommands;
//# sourceMappingURL=register-app-commands.js.map
\ No newline at end of file