@hubspot/cli 7.6.0-beta.2 → 7.6.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/__tests__/migrate.test.d.ts +1 -0
- package/api/__tests__/migrate.test.js +183 -0
- package/bin/cli.js +6 -2
- package/commands/__tests__/account.test.d.ts +1 -0
- package/commands/__tests__/account.test.js +74 -0
- package/commands/__tests__/auth.test.d.ts +1 -0
- package/commands/__tests__/auth.test.js +43 -0
- package/commands/__tests__/cms.test.d.ts +1 -0
- package/commands/__tests__/cms.test.js +49 -0
- package/commands/__tests__/config.test.d.ts +1 -0
- package/commands/__tests__/config.test.js +49 -0
- package/commands/__tests__/create.test.d.ts +1 -0
- package/commands/__tests__/create.test.js +38 -0
- package/commands/__tests__/customObject.test.d.ts +1 -0
- package/commands/__tests__/customObject.test.js +54 -0
- package/commands/__tests__/doctor.test.d.ts +1 -0
- package/commands/__tests__/doctor.test.js +139 -0
- package/commands/__tests__/feedback.test.d.ts +1 -0
- package/commands/__tests__/feedback.test.js +62 -0
- package/commands/__tests__/fetch.test.d.ts +1 -0
- package/commands/__tests__/fetch.test.js +56 -0
- package/commands/__tests__/filemanager.test.d.ts +1 -0
- package/commands/__tests__/filemanager.test.js +50 -0
- package/commands/__tests__/function.test.d.ts +1 -0
- package/commands/__tests__/function.test.js +51 -0
- package/commands/__tests__/getStarted.test.d.ts +1 -0
- package/commands/__tests__/getStarted.test.js +170 -0
- package/commands/__tests__/hubdb.test.d.ts +1 -0
- package/commands/__tests__/hubdb.test.js +55 -0
- package/commands/__tests__/init.test.d.ts +1 -0
- package/commands/__tests__/init.test.js +47 -0
- package/commands/__tests__/lint.test.d.ts +1 -0
- package/commands/__tests__/lint.test.js +38 -0
- package/commands/__tests__/list.test.d.ts +1 -0
- package/commands/__tests__/list.test.js +47 -0
- package/commands/__tests__/logs.test.d.ts +1 -0
- package/commands/__tests__/logs.test.js +70 -0
- package/commands/__tests__/mcp.test.d.ts +1 -0
- package/commands/__tests__/mcp.test.js +51 -0
- package/commands/__tests__/mv.test.d.ts +1 -0
- package/commands/__tests__/mv.test.js +84 -0
- package/commands/__tests__/open.test.d.ts +1 -0
- package/commands/__tests__/open.test.js +96 -0
- package/commands/__tests__/project.test.d.ts +1 -0
- package/commands/__tests__/project.test.js +100 -0
- package/commands/__tests__/remove.test.d.ts +1 -0
- package/commands/__tests__/remove.test.js +77 -0
- package/commands/__tests__/sandbox.test.d.ts +1 -0
- package/commands/__tests__/sandbox.test.js +49 -0
- package/commands/__tests__/secret.test.d.ts +1 -0
- package/commands/__tests__/secret.test.js +54 -0
- package/commands/__tests__/testAccount.test.d.ts +1 -0
- package/commands/__tests__/testAccount.test.js +60 -0
- package/commands/__tests__/theme.test.d.ts +1 -0
- package/commands/__tests__/theme.test.js +52 -0
- package/commands/account/__tests__/auth.test.d.ts +1 -0
- package/commands/account/__tests__/auth.test.js +31 -0
- package/commands/account/__tests__/clean.test.d.ts +1 -0
- package/commands/account/__tests__/clean.test.js +33 -0
- package/commands/account/__tests__/createOverride.test.d.ts +1 -0
- package/commands/account/__tests__/createOverride.test.js +37 -0
- package/commands/account/__tests__/info.test.d.ts +1 -0
- package/commands/account/__tests__/info.test.js +33 -0
- package/commands/account/__tests__/list.test.d.ts +1 -0
- package/commands/account/__tests__/list.test.js +33 -0
- package/commands/account/__tests__/remove.test.d.ts +1 -0
- package/commands/account/__tests__/remove.test.js +41 -0
- package/commands/account/__tests__/removeOverride.d.ts +1 -0
- package/commands/account/__tests__/removeOverride.js +30 -0
- package/commands/account/__tests__/rename.test.d.ts +1 -0
- package/commands/account/__tests__/rename.test.js +47 -0
- package/commands/account/__tests__/use.test.d.ts +1 -0
- package/commands/account/__tests__/use.test.js +37 -0
- package/commands/app/__tests__/migrate.test.d.ts +1 -0
- package/commands/app/__tests__/migrate.test.js +129 -0
- package/commands/app/secret/__tests__/add.test.d.ts +1 -0
- package/commands/app/secret/__tests__/add.test.js +33 -0
- package/commands/app/secret/__tests__/delete.test.d.ts +1 -0
- package/commands/app/secret/__tests__/delete.test.js +33 -0
- package/commands/app/secret/__tests__/list.test.d.ts +1 -0
- package/commands/app/secret/__tests__/list.test.js +30 -0
- package/commands/app/secret/__tests__/update.test.d.ts +1 -0
- package/commands/app/secret/__tests__/update.test.js +33 -0
- package/commands/customObject/__tests__/create.test.d.ts +1 -0
- package/commands/customObject/__tests__/create.test.js +45 -0
- package/commands/customObject/__tests__/schema.test.d.ts +1 -0
- package/commands/customObject/__tests__/schema.test.js +58 -0
- package/commands/customObject/schema/__tests__/create.test.d.ts +1 -0
- package/commands/customObject/schema/__tests__/create.test.js +33 -0
- package/commands/customObject/schema/__tests__/delete.test.d.ts +1 -0
- package/commands/customObject/schema/__tests__/delete.test.js +47 -0
- package/commands/customObject/schema/__tests__/fetch-all.test.d.ts +1 -0
- package/commands/customObject/schema/__tests__/fetch-all.test.js +46 -0
- package/commands/customObject/schema/__tests__/fetch.test.d.ts +1 -0
- package/commands/customObject/schema/__tests__/fetch.test.js +50 -0
- package/commands/customObject/schema/__tests__/list.test.d.ts +1 -0
- package/commands/customObject/schema/__tests__/list.test.js +34 -0
- package/commands/customObject/schema/__tests__/update.test.d.ts +1 -0
- package/commands/customObject/schema/__tests__/update.test.js +45 -0
- package/commands/fetch.js +0 -1
- package/commands/filemanager/__tests__/fetch.test.d.ts +1 -0
- package/commands/filemanager/__tests__/fetch.test.js +37 -0
- package/commands/filemanager/__tests__/upload.test.d.ts +1 -0
- package/commands/filemanager/__tests__/upload.test.js +35 -0
- package/commands/getStarted.js +8 -14
- package/commands/hubdb/__tests__/clear.test.d.ts +1 -0
- package/commands/hubdb/__tests__/clear.test.js +33 -0
- package/commands/hubdb/__tests__/create.test.d.ts +1 -0
- package/commands/hubdb/__tests__/create.test.js +33 -0
- package/commands/hubdb/__tests__/delete.test.d.ts +1 -0
- package/commands/hubdb/__tests__/delete.test.js +33 -0
- package/commands/hubdb/__tests__/fetch.test.d.ts +1 -0
- package/commands/hubdb/__tests__/fetch.test.js +33 -0
- package/commands/hubdb/__tests__/list.test.d.ts +1 -0
- package/commands/hubdb/__tests__/list.test.js +101 -0
- package/commands/logs.js +0 -1
- package/commands/mcp/__tests__/setup.test.d.ts +1 -0
- package/commands/mcp/__tests__/setup.test.js +31 -0
- package/commands/mcp/__tests__/start.test.d.ts +1 -0
- package/commands/mcp/__tests__/start.test.js +32 -0
- package/commands/mcp/setup.js +1 -0
- package/commands/mcp/start.d.ts +4 -1
- package/commands/mcp/start.js +8 -3
- package/commands/open.js +14 -12
- package/commands/project/__tests__/add.test.d.ts +1 -0
- package/commands/project/__tests__/add.test.js +48 -0
- package/commands/project/__tests__/create.test.d.ts +1 -0
- package/commands/project/__tests__/create.test.js +45 -0
- package/commands/project/__tests__/deploy.test.d.ts +1 -0
- package/commands/project/__tests__/deploy.test.js +350 -0
- package/commands/project/__tests__/devUnifiedFlow.test.d.ts +1 -0
- package/commands/project/__tests__/devUnifiedFlow.test.js +419 -0
- package/commands/project/__tests__/download.test.d.ts +1 -0
- package/commands/project/__tests__/download.test.js +44 -0
- package/commands/project/__tests__/fixtures/exampleProject.json +33 -0
- package/commands/project/__tests__/installDeps.test.d.ts +1 -0
- package/commands/project/__tests__/installDeps.test.js +180 -0
- package/commands/project/__tests__/listBuilds.test.d.ts +1 -0
- package/commands/project/__tests__/listBuilds.test.js +43 -0
- package/commands/project/__tests__/logs.test.d.ts +1 -0
- package/commands/project/__tests__/logs.test.js +246 -0
- package/commands/project/__tests__/migrate.test.d.ts +1 -0
- package/commands/project/__tests__/migrate.test.js +116 -0
- package/commands/project/__tests__/migrateApp.test.d.ts +1 -0
- package/commands/project/__tests__/migrateApp.test.js +87 -0
- package/commands/project/__tests__/open.test.d.ts +1 -0
- package/commands/project/__tests__/open.test.js +44 -0
- package/commands/project/__tests__/profile.test.d.ts +1 -0
- package/commands/project/__tests__/profile.test.js +47 -0
- package/commands/project/__tests__/upload.test.d.ts +1 -0
- package/commands/project/__tests__/upload.test.js +48 -0
- package/commands/project/__tests__/watch.test.d.ts +1 -0
- package/commands/project/__tests__/watch.test.js +40 -0
- package/commands/project/deploy.d.ts +1 -0
- package/commands/project/deploy.js +21 -10
- package/commands/sandbox/__tests__/create.test.d.ts +1 -0
- package/commands/sandbox/__tests__/create.test.js +36 -0
- package/commands/sandbox/__tests__/delete.test.d.ts +1 -0
- package/commands/sandbox/__tests__/delete.test.js +36 -0
- package/commands/secret/__tests__/addSecret.test.d.ts +1 -0
- package/commands/secret/__tests__/addSecret.test.js +34 -0
- package/commands/secret/__tests__/deleteSecret.test.d.ts +1 -0
- package/commands/secret/__tests__/deleteSecret.test.js +46 -0
- package/commands/secret/__tests__/listSecret.test.d.ts +1 -0
- package/commands/secret/__tests__/listSecret.test.js +34 -0
- package/commands/secret/__tests__/updateSecret.test.d.ts +1 -0
- package/commands/secret/__tests__/updateSecret.test.js +34 -0
- package/commands/testAccount/__tests__/create.test.d.ts +1 -0
- package/commands/testAccount/__tests__/create.test.js +38 -0
- package/commands/testAccount/__tests__/createConfig.test.d.ts +1 -0
- package/commands/testAccount/__tests__/createConfig.test.js +37 -0
- package/commands/testAccount/__tests__/delete.test.d.ts +1 -0
- package/commands/testAccount/__tests__/delete.test.js +36 -0
- package/commands/testAccount/create.js +16 -3
- package/commands/testAccount/createConfig.d.ts +0 -2
- package/commands/testAccount/createConfig.js +7 -8
- package/commands/theme/__tests__/generate-selectors.test.d.ts +1 -0
- package/commands/theme/__tests__/generate-selectors.test.js +33 -0
- package/commands/theme/__tests__/marketplace-validate.test.d.ts +1 -0
- package/commands/theme/__tests__/marketplace-validate.test.js +41 -0
- package/commands/theme/__tests__/preview.test.d.ts +1 -0
- package/commands/theme/__tests__/preview.test.js +65 -0
- package/lang/en.d.ts +15 -2
- package/lang/en.js +15 -2
- package/lib/__tests__/accountTypes.test.d.ts +1 -0
- package/lib/__tests__/accountTypes.test.js +100 -0
- package/lib/__tests__/buildAccount.test.d.ts +1 -0
- package/lib/__tests__/buildAccount.test.js +231 -0
- package/lib/__tests__/commonOpts.test.d.ts +1 -0
- package/lib/__tests__/commonOpts.test.js +87 -0
- package/lib/__tests__/dependencyManagement.test.d.ts +1 -0
- package/lib/__tests__/dependencyManagement.test.js +180 -0
- package/lib/__tests__/developerTestAccounts.test.d.ts +1 -0
- package/lib/__tests__/developerTestAccounts.test.js +180 -0
- package/lib/__tests__/hasFeature.test.d.ts +1 -0
- package/lib/__tests__/hasFeature.test.js +37 -0
- package/lib/__tests__/npm.test.d.ts +1 -0
- package/lib/__tests__/npm.test.js +62 -0
- package/lib/__tests__/oauth.test.d.ts +1 -0
- package/lib/__tests__/oauth.test.js +113 -0
- package/lib/__tests__/parsing.test.d.ts +1 -0
- package/lib/__tests__/parsing.test.js +36 -0
- package/lib/__tests__/polling.test.d.ts +1 -0
- package/lib/__tests__/polling.test.js +78 -0
- package/lib/__tests__/process.test.d.ts +1 -0
- package/lib/__tests__/process.test.js +90 -0
- package/lib/__tests__/projectProfiles.test.d.ts +1 -0
- package/lib/__tests__/projectProfiles.test.js +134 -0
- package/lib/__tests__/sandboxSync.test.d.ts +1 -0
- package/lib/__tests__/sandboxSync.test.js +131 -0
- package/lib/__tests__/sandboxes.test.d.ts +1 -0
- package/lib/__tests__/sandboxes.test.js +148 -0
- package/lib/__tests__/serverlessLogs.test.d.ts +1 -0
- package/lib/__tests__/serverlessLogs.test.js +154 -0
- package/lib/__tests__/usageTracking.test.d.ts +1 -0
- package/lib/__tests__/usageTracking.test.js +165 -0
- package/lib/__tests__/validation.test.d.ts +1 -0
- package/lib/__tests__/validation.test.js +145 -0
- package/lib/__tests__/yargsUtils.test.d.ts +1 -0
- package/lib/__tests__/yargsUtils.test.js +74 -0
- package/lib/app/__tests__/migrate.test.d.ts +1 -0
- package/lib/app/__tests__/migrate.test.js +495 -0
- package/lib/app/__tests__/migrate_legacy.test.d.ts +1 -0
- package/lib/app/__tests__/migrate_legacy.test.js +136 -0
- package/lib/app/migrate.js +2 -6
- package/lib/dependencyManagement.d.ts +1 -1
- package/lib/dependencyManagement.js +2 -2
- package/lib/doctor/Diagnosis.js +11 -11
- package/lib/doctor/Doctor.js +42 -42
- package/lib/doctor/__tests__/Diagnosis.test.d.ts +1 -0
- package/lib/doctor/__tests__/Diagnosis.test.js +87 -0
- package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.d.ts +1 -0
- package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.js +172 -0
- package/lib/doctor/__tests__/Doctor.test.d.ts +1 -0
- package/lib/doctor/__tests__/Doctor.test.js +398 -0
- package/lib/errorHandlers/index.js +8 -0
- package/lib/mcp/setup.js +26 -5
- package/lib/middleware/__test__/configMiddleware.test.js +12 -12
- package/lib/middleware/__test__/gitMiddleware.test.js +4 -4
- package/lib/middleware/__test__/notificationsMiddleware.test.js +2 -2
- package/lib/middleware/__test__/requestMiddleware.test.js +2 -2
- package/lib/middleware/__test__/yargsChecksMiddleware.test.js +7 -7
- package/lib/middleware/notificationsMiddleware.js +16 -13
- package/lib/projects/__tests__/AppDevModeInterface.test.d.ts +1 -0
- package/lib/projects/__tests__/AppDevModeInterface.test.js +517 -0
- package/lib/projects/__tests__/LocalDevProcess.test.d.ts +1 -0
- package/lib/projects/__tests__/LocalDevProcess.test.js +314 -0
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.d.ts +1 -0
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +175 -0
- package/lib/projects/__tests__/ProjectLogsManager.test.d.ts +1 -0
- package/lib/projects/__tests__/ProjectLogsManager.test.js +191 -0
- package/lib/projects/__tests__/buildAndDeploy.test.d.ts +1 -0
- package/lib/projects/__tests__/buildAndDeploy.test.js +25 -0
- package/lib/projects/__tests__/components.test.d.ts +1 -0
- package/lib/projects/__tests__/components.test.js +186 -0
- package/lib/projects/__tests__/projects.test.d.ts +1 -0
- package/lib/projects/__tests__/projects.test.js +89 -0
- package/lib/projects/__tests__/structure.test.d.ts +1 -0
- package/lib/projects/__tests__/structure.test.js +249 -0
- package/lib/projects/add/__tests__/legacyAddComponent.test.d.ts +1 -0
- package/lib/projects/add/__tests__/legacyAddComponent.test.js +206 -0
- package/lib/projects/add/__tests__/v3AddComponent.test.d.ts +1 -0
- package/lib/projects/add/__tests__/v3AddComponent.test.js +190 -0
- package/lib/projects/create/__tests__/legacy.test.d.ts +1 -0
- package/lib/projects/create/__tests__/legacy.test.js +126 -0
- package/lib/projects/create/__tests__/v3.test.d.ts +1 -0
- package/lib/projects/create/__tests__/v3.test.js +80 -0
- package/lib/projects/create/v3.d.ts +3 -2
- package/lib/projects/create/v3.js +2 -2
- package/lib/projects/localDev/DevServerManager.js +0 -1
- package/lib/projects/upload.js +1 -1
- package/lib/prompts/__tests__/downloadProjectPrompt.test.d.ts +1 -0
- package/lib/prompts/__tests__/downloadProjectPrompt.test.js +30 -0
- package/lib/prompts/__tests__/projectsLogsPrompt.test.d.ts +1 -0
- package/lib/prompts/__tests__/projectsLogsPrompt.test.js +42 -0
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.d.ts +10 -9
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +75 -31
- package/lib/prompts/createModulePrompt.js +1 -2
- package/lib/prompts/projectAddPrompt.d.ts +2 -1
- package/lib/prompts/projectAddPrompt.js +2 -1
- package/lib/prompts/promptUtils.d.ts +2 -2
- package/lib/prompts/promptUtils.js +161 -35
- package/lib/prompts/selectProjectTemplatePrompt.d.ts +2 -1
- package/lib/prompts/selectProjectTemplatePrompt.js +2 -1
- package/lib/schema.js +5 -1
- package/lib/testUtils.js +1 -2
- package/lib/ui/SpinniesManager.js +0 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/supportHyperlinks.js +2 -2
- package/lib/ui/supportsColor.js +2 -2
- package/lib/usageTracking.d.ts +11 -0
- package/lib/usageTracking.js +67 -73
- package/lib/utils/hasFlag.d.ts +1 -0
- package/lib/utils/hasFlag.js +15 -0
- package/lib/yargsUtils.d.ts +2 -1
- package/lib/yargsUtils.js +3 -13
- package/mcp-server/tools/project/AddFeatureToProject.js +4 -1
- package/mcp-server/tools/project/CreateProjectTool.d.ts +2 -2
- package/mcp-server/tools/project/CreateProjectTool.js +4 -1
- package/mcp-server/tools/project/DeployProject.js +4 -1
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +4 -1
- package/mcp-server/tools/project/UploadProjectTools.js +4 -1
- package/mcp-server/tools/project/ValidateProjectTool.js +4 -1
- package/mcp-server/tools/project/__tests__/AddFeatureToProject.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/AddFeatureToProject.test.js +153 -0
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +130 -0
- package/mcp-server/tools/project/__tests__/DeployProject.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/DeployProject.test.js +121 -0
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.js +128 -0
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.js +109 -0
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.js +112 -0
- package/mcp-server/utils/__tests__/command.test.d.ts +1 -0
- package/mcp-server/utils/__tests__/command.test.js +47 -0
- package/mcp-server/utils/__tests__/project.test.d.ts +1 -0
- package/mcp-server/utils/__tests__/project.test.js +84 -0
- package/mcp-server/utils/project.js +3 -0
- package/mcp-server/utils/toolUsageTracking.d.ts +1 -0
- package/mcp-server/utils/toolUsageTracking.js +25 -0
- package/package.json +9 -9
- package/types/Prompts.d.ts +4 -2
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
37
|
+
const github = __importStar(require("@hubspot/local-dev-lib/api/github"));
|
|
38
|
+
const exitCodes_1 = require("../../../enums/exitCodes");
|
|
39
|
+
const legacy_1 = require("../legacy");
|
|
40
|
+
const constants_1 = require("../../../constants");
|
|
41
|
+
vi.mock('@hubspot/local-dev-lib/logger');
|
|
42
|
+
vi.mock('@hubspot/local-dev-lib/api/github');
|
|
43
|
+
const mockedFetchRepoFile = vi.mocked(github.fetchRepoFile);
|
|
44
|
+
const repoConfig = {
|
|
45
|
+
[constants_1.PROJECT_COMPONENT_TYPES.COMPONENTS]: [
|
|
46
|
+
{
|
|
47
|
+
label: 'Component 1',
|
|
48
|
+
path: 'component1',
|
|
49
|
+
type: 'Component',
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
[constants_1.PROJECT_COMPONENT_TYPES.PROJECTS]: [
|
|
53
|
+
{
|
|
54
|
+
name: 'project1',
|
|
55
|
+
label: 'Project 1',
|
|
56
|
+
path: 'project1',
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
};
|
|
60
|
+
describe('lib/projects/create/legacy', () => {
|
|
61
|
+
describe('getProjectComponentListFromRepo()', () => {
|
|
62
|
+
it('returns a list of components', async () => {
|
|
63
|
+
// @ts-expect-error - Mocking AxiosResponse
|
|
64
|
+
mockedFetchRepoFile.mockResolvedValue({
|
|
65
|
+
data: repoConfig,
|
|
66
|
+
});
|
|
67
|
+
const components = await (0, legacy_1.getProjectComponentListFromRepo)('gh-ref');
|
|
68
|
+
expect(components).toEqual(repoConfig[constants_1.PROJECT_COMPONENT_TYPES.COMPONENTS]);
|
|
69
|
+
});
|
|
70
|
+
it('returns an empty list if no components are found', async () => {
|
|
71
|
+
mockedFetchRepoFile.mockRejectedValue(new Error('Not found'));
|
|
72
|
+
const components = await (0, legacy_1.getProjectComponentListFromRepo)('gh-ref');
|
|
73
|
+
expect(components).toEqual([]);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
describe('getProjectTemplateListFromRepo()', () => {
|
|
77
|
+
let exitMock;
|
|
78
|
+
beforeEach(() => {
|
|
79
|
+
// @ts-expect-error - Mocking process.exit
|
|
80
|
+
exitMock = vi
|
|
81
|
+
.spyOn(process, 'exit')
|
|
82
|
+
.mockImplementation(() => undefined);
|
|
83
|
+
});
|
|
84
|
+
afterEach(() => {
|
|
85
|
+
exitMock.mockRestore();
|
|
86
|
+
});
|
|
87
|
+
it('returns a list of project templates', async () => {
|
|
88
|
+
// @ts-expect-error - Mocking AxiosResponse
|
|
89
|
+
mockedFetchRepoFile.mockResolvedValue({
|
|
90
|
+
data: repoConfig,
|
|
91
|
+
});
|
|
92
|
+
const templates = await (0, legacy_1.getProjectTemplateListFromRepo)(constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, 'gh-ref');
|
|
93
|
+
expect(templates).toEqual(repoConfig[constants_1.PROJECT_COMPONENT_TYPES.PROJECTS]);
|
|
94
|
+
});
|
|
95
|
+
it('Logs an error and exits the process if the request for the template list fails', async () => {
|
|
96
|
+
mockedFetchRepoFile.mockRejectedValue(new Error('Not found'));
|
|
97
|
+
await (0, legacy_1.getProjectTemplateListFromRepo)(constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, 'gh-ref');
|
|
98
|
+
expect(logger_1.logger.error).toHaveBeenCalledWith(expect.stringMatching(/Failed to fetch the config.json file from the target repository/));
|
|
99
|
+
expect(exitMock).toHaveBeenCalledWith(exitCodes_1.EXIT_CODES.ERROR);
|
|
100
|
+
});
|
|
101
|
+
it('Logs an error and exits the process if there are no projects listed in the repo config', async () => {
|
|
102
|
+
// @ts-expect-error - Mocking AxiosResponse
|
|
103
|
+
mockedFetchRepoFile.mockResolvedValue({});
|
|
104
|
+
await (0, legacy_1.getProjectTemplateListFromRepo)(constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, 'gh-ref');
|
|
105
|
+
expect(logger_1.logger.error).toHaveBeenCalledWith(expect.stringMatching(/Unable to find any projects in the target repository's config.json file/));
|
|
106
|
+
expect(exitMock).toHaveBeenCalledWith(exitCodes_1.EXIT_CODES.ERROR);
|
|
107
|
+
});
|
|
108
|
+
it('Logs an error and exits the process if any of the projects in the repo config are missing required properties', async () => {
|
|
109
|
+
// @ts-expect-error - Mocking AxiosResponse
|
|
110
|
+
mockedFetchRepoFile.mockResolvedValue({
|
|
111
|
+
data: {
|
|
112
|
+
...repoConfig,
|
|
113
|
+
[constants_1.PROJECT_COMPONENT_TYPES.PROJECTS]: [
|
|
114
|
+
{
|
|
115
|
+
name: 'project1',
|
|
116
|
+
label: 'Project 1',
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
await (0, legacy_1.getProjectTemplateListFromRepo)(constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, 'gh-ref');
|
|
122
|
+
expect(logger_1.logger.error).toHaveBeenCalledWith(expect.stringMatching(/Found misconfigured projects in the target repository's config.json file/));
|
|
123
|
+
expect(exitMock).toHaveBeenCalledWith(exitCodes_1.EXIT_CODES.ERROR);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const v3_1 = require("../v3");
|
|
4
|
+
vi.mock('@hubspot/local-dev-lib/logger');
|
|
5
|
+
vi.mock('@hubspot/local-dev-lib/api/github');
|
|
6
|
+
describe('lib/projects/create/v3', () => {
|
|
7
|
+
describe('calculateComponentTemplateChoices()', () => {
|
|
8
|
+
const mockComponents = [
|
|
9
|
+
{
|
|
10
|
+
label: 'Module Component',
|
|
11
|
+
path: 'module',
|
|
12
|
+
type: 'module',
|
|
13
|
+
supportedAuthTypes: ['oauth'],
|
|
14
|
+
supportedDistributions: ['private'],
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
label: 'Card Component',
|
|
18
|
+
path: 'card',
|
|
19
|
+
type: 'card',
|
|
20
|
+
supportedAuthTypes: ['oauth', 'static'],
|
|
21
|
+
supportedDistributions: ['private', 'marketplace'],
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
const mockProjectMetadataForChoices = {
|
|
25
|
+
hsMetaFiles: [],
|
|
26
|
+
components: {
|
|
27
|
+
module: { count: 0, maxCount: 5, hsMetaFiles: [] },
|
|
28
|
+
card: { count: 3, maxCount: 3, hsMetaFiles: [] },
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
it('returns enabled components when they meet all requirements', () => {
|
|
32
|
+
const choices = (0, v3_1.calculateComponentTemplateChoices)(mockComponents, 'oauth', 'private', mockProjectMetadataForChoices);
|
|
33
|
+
expect(choices).toHaveLength(3); // includes separator
|
|
34
|
+
expect(choices[0]).toEqual({
|
|
35
|
+
name: 'Module Component',
|
|
36
|
+
value: mockComponents[0],
|
|
37
|
+
});
|
|
38
|
+
expect(choices[2]).toEqual({
|
|
39
|
+
name: expect.stringContaining('Card Component'),
|
|
40
|
+
value: mockComponents[1],
|
|
41
|
+
disabled: expect.stringContaining('maximum'),
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
it('disables components when auth type is not supported', () => {
|
|
45
|
+
const choices = (0, v3_1.calculateComponentTemplateChoices)(mockComponents, 'privatekey', 'private', mockProjectMetadataForChoices);
|
|
46
|
+
// All components should be disabled, so they come after the separator
|
|
47
|
+
expect(choices[1]).toEqual({
|
|
48
|
+
name: expect.stringContaining('Module Component'),
|
|
49
|
+
value: mockComponents[0],
|
|
50
|
+
disabled: expect.stringContaining('privatekey'),
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
it('disables components when distribution is not supported', () => {
|
|
54
|
+
const choices = (0, v3_1.calculateComponentTemplateChoices)(mockComponents, 'oauth', 'enterprise', mockProjectMetadataForChoices);
|
|
55
|
+
// All components should be disabled, so they come after the separator
|
|
56
|
+
expect(choices[1]).toEqual({
|
|
57
|
+
name: expect.stringContaining('Module Component'),
|
|
58
|
+
value: mockComponents[0],
|
|
59
|
+
disabled: expect.stringContaining('enterprise'),
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
it('handles components without auth type or distribution restrictions', () => {
|
|
63
|
+
const componentsWithoutRestrictions = [
|
|
64
|
+
{
|
|
65
|
+
label: 'Unrestricted Component',
|
|
66
|
+
path: 'unrestricted',
|
|
67
|
+
type: 'module',
|
|
68
|
+
},
|
|
69
|
+
];
|
|
70
|
+
const choices = (0, v3_1.calculateComponentTemplateChoices)(componentsWithoutRestrictions, 'oauth', 'private', {
|
|
71
|
+
hsMetaFiles: [],
|
|
72
|
+
components: { module: { count: 0, maxCount: 5, hsMetaFiles: [] } },
|
|
73
|
+
});
|
|
74
|
+
expect(choices[0]).toEqual({
|
|
75
|
+
name: 'Unrestricted Component',
|
|
76
|
+
value: componentsWithoutRestrictions[0],
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Separator } from '@inquirer/prompts';
|
|
1
2
|
import { ComponentTemplate, ComponentTemplateChoice, ProjectTemplateRepoConfig } from '../../../types/Projects';
|
|
2
3
|
import { ProjectMetadata } from '@hubspot/project-parsing-lib/src/lib/project';
|
|
3
4
|
import { SelectProjectTemplatePromptResponse } from '../../prompts/selectProjectTemplatePrompt';
|
|
@@ -7,13 +8,13 @@ export declare function createV3App(providedAuth: string | undefined, providedDi
|
|
|
7
8
|
authType: string;
|
|
8
9
|
distribution: string;
|
|
9
10
|
}>;
|
|
10
|
-
export declare function calculateComponentTemplateChoices(components: ComponentTemplate[], authType: string | undefined, distribution: string | undefined, projectMetadata?: ProjectMetadata): ComponentTemplateChoice[];
|
|
11
|
+
export declare function calculateComponentTemplateChoices(components: ComponentTemplate[], authType: string | undefined, distribution: string | undefined, projectMetadata?: ProjectMetadata): (ComponentTemplateChoice | Separator)[];
|
|
11
12
|
type V3ComponentInfo = {
|
|
12
13
|
authType?: string;
|
|
13
14
|
distribution?: string;
|
|
14
15
|
repoConfig?: ProjectTemplateRepoConfig;
|
|
15
16
|
projectContents?: string;
|
|
16
|
-
componentTemplateChoices?: ComponentTemplateChoice[];
|
|
17
|
+
componentTemplateChoices?: (ComponentTemplateChoice | Separator)[];
|
|
17
18
|
};
|
|
18
19
|
export declare function v3ComponentFlow(platformVersion: string, projectBase: string | undefined, providedAuth: string | undefined, providedDistribution: string | undefined): Promise<V3ComponentInfo>;
|
|
19
20
|
export declare function generateComponentPaths({ selectProjectTemplatePromptResponse, platformVersion, repoConfig, projectContents, authType, distribution, }: {
|
|
@@ -8,6 +8,7 @@ exports.createV3App = createV3App;
|
|
|
8
8
|
exports.calculateComponentTemplateChoices = calculateComponentTemplateChoices;
|
|
9
9
|
exports.v3ComponentFlow = v3ComponentFlow;
|
|
10
10
|
exports.generateComponentPaths = generateComponentPaths;
|
|
11
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
11
12
|
const constants_1 = require("../../constants");
|
|
12
13
|
const en_1 = require("../../../lang/en");
|
|
13
14
|
const promptUtils_1 = require("../../prompts/promptUtils");
|
|
@@ -17,7 +18,6 @@ const path_1 = __importDefault(require("path"));
|
|
|
17
18
|
const legacy_1 = require("./legacy");
|
|
18
19
|
const errorHandlers_1 = require("../../errorHandlers");
|
|
19
20
|
const exitCodes_1 = require("../../enums/exitCodes");
|
|
20
|
-
const inquirer = require('inquirer');
|
|
21
21
|
exports.EMPTY_PROJECT = 'empty';
|
|
22
22
|
exports.PROJECT_WITH_APP = 'app';
|
|
23
23
|
async function createV3App(providedAuth, providedDistribution) {
|
|
@@ -96,7 +96,7 @@ function calculateComponentTemplateChoices(components, authType, distribution, p
|
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
98
|
return disabledComponents.length
|
|
99
|
-
? [...enabledComponents, new
|
|
99
|
+
? [...enabledComponents, new prompts_1.Separator(), ...disabledComponents]
|
|
100
100
|
: [...enabledComponents];
|
|
101
101
|
}
|
|
102
102
|
async function v3ComponentFlow(platformVersion, projectBase, providedAuth, providedDistribution) {
|
package/lib/projects/upload.js
CHANGED
|
@@ -25,7 +25,7 @@ const buildAndDeploy_1 = require("./buildAndDeploy");
|
|
|
25
25
|
const exitCodes_1 = require("../enums/exitCodes");
|
|
26
26
|
async function uploadProjectFiles(accountId, projectName, filePath, uploadMessage, platformVersion, intermediateRepresentation) {
|
|
27
27
|
SpinniesManager_1.default.init({});
|
|
28
|
-
const accountIdentifier = (0, ui_1.uiAccountDescription)(accountId)
|
|
28
|
+
const accountIdentifier = (0, ui_1.uiAccountDescription)(accountId) || `${accountId}`;
|
|
29
29
|
SpinniesManager_1.default.add('upload', {
|
|
30
30
|
text: en_1.lib.projectUpload.uploadProjectFiles.add(projectName, accountIdentifier),
|
|
31
31
|
succeedColor: 'white',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
4
|
+
const projects_1 = require("@hubspot/local-dev-lib/api/projects");
|
|
5
|
+
const downloadProjectPrompt_1 = require("../downloadProjectPrompt");
|
|
6
|
+
vi.mock('../promptUtils', () => ({
|
|
7
|
+
promptUser: vi.fn().mockResolvedValue({ project: 'test-project' }),
|
|
8
|
+
}));
|
|
9
|
+
vi.mock('@hubspot/local-dev-lib/api/projects', () => ({
|
|
10
|
+
fetchProjects: vi.fn().mockResolvedValue({
|
|
11
|
+
data: { results: [] },
|
|
12
|
+
}),
|
|
13
|
+
}));
|
|
14
|
+
vi.mock('@hubspot/local-dev-lib/config', () => ({
|
|
15
|
+
getAccountId: vi.fn().mockImplementation(() => 123456789),
|
|
16
|
+
}));
|
|
17
|
+
describe('lib/prompts/downloadProjectPrompt', () => {
|
|
18
|
+
it('should honor the account passed as an option', async () => {
|
|
19
|
+
const account = 'Prod';
|
|
20
|
+
await (0, downloadProjectPrompt_1.downloadProjectPrompt)({ account });
|
|
21
|
+
expect(config_1.getAccountId).toHaveBeenCalledTimes(1);
|
|
22
|
+
expect(config_1.getAccountId).toHaveBeenCalledWith(account);
|
|
23
|
+
});
|
|
24
|
+
it('should fetch the projects for the correct accountId', async () => {
|
|
25
|
+
const account = 'Prod';
|
|
26
|
+
await (0, downloadProjectPrompt_1.downloadProjectPrompt)({ account });
|
|
27
|
+
expect(projects_1.fetchProjects).toHaveBeenCalledTimes(1);
|
|
28
|
+
expect(projects_1.fetchProjects).toHaveBeenCalledWith(123456789);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const projectsLogsPrompt_1 = require("../projectsLogsPrompt");
|
|
7
|
+
const promptUtils_1 = require("../promptUtils");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
vi.mock('../promptUtils');
|
|
10
|
+
describe('lib/prompts/projectsLogsPrompt', () => {
|
|
11
|
+
it('should return undefined functionName when functionChoices is undefined', async () => {
|
|
12
|
+
const actual = await (0, projectsLogsPrompt_1.projectLogsPrompt)({ functionChoices: undefined });
|
|
13
|
+
expect(actual).toEqual({});
|
|
14
|
+
expect(promptUtils_1.promptUser).not.toHaveBeenCalled();
|
|
15
|
+
});
|
|
16
|
+
it('should return the functionName without prompting when there is only one functionChoice', async () => {
|
|
17
|
+
const functionChoice = 'this-is-the-only-function';
|
|
18
|
+
const { functionName } = await (0, projectsLogsPrompt_1.projectLogsPrompt)({
|
|
19
|
+
functionChoices: [functionChoice],
|
|
20
|
+
});
|
|
21
|
+
expect(functionName).toEqual(functionChoice);
|
|
22
|
+
expect(promptUtils_1.promptUser).not.toHaveBeenCalled();
|
|
23
|
+
});
|
|
24
|
+
it('should prompt the user if there is more than one choice', async () => {
|
|
25
|
+
const functionChoices = ['choice 1', 'choice 2'];
|
|
26
|
+
const projectName = 'my cool project';
|
|
27
|
+
await (0, projectsLogsPrompt_1.projectLogsPrompt)({
|
|
28
|
+
functionChoices,
|
|
29
|
+
projectName,
|
|
30
|
+
});
|
|
31
|
+
expect(promptUtils_1.promptUser).toHaveBeenCalledTimes(1);
|
|
32
|
+
expect(promptUtils_1.promptUser).toHaveBeenLastCalledWith(expect.arrayContaining([
|
|
33
|
+
expect.objectContaining({
|
|
34
|
+
name: 'functionName',
|
|
35
|
+
type: 'list',
|
|
36
|
+
message: `[--function] Select function in ${chalk_1.default.bold(projectName)} project`,
|
|
37
|
+
when: expect.any(Function),
|
|
38
|
+
choices: functionChoices,
|
|
39
|
+
}),
|
|
40
|
+
]));
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { DeveloperTestAccountConfig } from '@hubspot/local-dev-lib/types/developerTestAccounts';
|
|
1
|
+
import { AccountLevel, DeveloperTestAccountConfig } from '@hubspot/local-dev-lib/types/developerTestAccounts';
|
|
2
2
|
declare const hubs: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
MARKETING: string;
|
|
4
|
+
OPS: string;
|
|
5
|
+
SERVICE: string;
|
|
6
|
+
SALES: string;
|
|
7
|
+
CONTENT: string;
|
|
8
8
|
};
|
|
9
9
|
type HubName = keyof typeof hubs;
|
|
10
|
-
type
|
|
11
|
-
|
|
10
|
+
export type HubConfig = {
|
|
11
|
+
hub: HubName;
|
|
12
|
+
tier: AccountLevel;
|
|
13
|
+
};
|
|
12
14
|
export declare function createDeveloperTestAccountConfigPrompt(args?: {
|
|
13
15
|
name?: string;
|
|
14
16
|
description?: string;
|
|
15
|
-
tiers?: HubConfig[];
|
|
16
17
|
}): Promise<DeveloperTestAccountConfig>;
|
|
17
18
|
export {};
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createDeveloperTestAccountConfigPrompt = createDeveloperTestAccountConfigPrompt;
|
|
4
4
|
const en_1 = require("../../lang/en");
|
|
5
5
|
const promptUtils_1 = require("./promptUtils");
|
|
6
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
6
7
|
const hubs = {
|
|
7
8
|
MARKETING: 'marketingLevel',
|
|
8
9
|
OPS: 'opsLevel',
|
|
@@ -10,41 +11,63 @@ const hubs = {
|
|
|
10
11
|
SALES: 'salesLevel',
|
|
11
12
|
CONTENT: 'contentLevel',
|
|
12
13
|
};
|
|
14
|
+
const AccountTiers = {
|
|
15
|
+
FREE: 'FREE',
|
|
16
|
+
STARTER: 'STARTER',
|
|
17
|
+
PROFESSIONAL: 'PROFESSIONAL',
|
|
18
|
+
ENTERPRISE: 'ENTERPRISE',
|
|
19
|
+
};
|
|
20
|
+
const makeHubTiers = (hubKey) => {
|
|
21
|
+
const hubTypeKey = hubKey.toLowerCase();
|
|
22
|
+
const hubName = en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.hubTypes[hubTypeKey];
|
|
23
|
+
return [
|
|
24
|
+
{
|
|
25
|
+
name: `${hubName} [${AccountTiers.FREE}]`,
|
|
26
|
+
value: { hub: hubKey, tier: AccountTiers.FREE },
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: `${hubName} [${AccountTiers.STARTER}]`,
|
|
30
|
+
value: { hub: hubKey, tier: AccountTiers.STARTER },
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: `${hubName} [${AccountTiers.PROFESSIONAL}]`,
|
|
34
|
+
value: { hub: hubKey, tier: AccountTiers.PROFESSIONAL },
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: `${hubName} [${AccountTiers.ENTERPRISE}]`,
|
|
38
|
+
value: { hub: hubKey, tier: AccountTiers.ENTERPRISE },
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
};
|
|
13
42
|
const TEST_ACCOUNT_TIERS = [
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
promptUtils_1.Separator,
|
|
25
|
-
{ name: 'Service STARTER', value: 'SERVICE:STARTER' },
|
|
26
|
-
{ name: 'Service PROFESSIONAL', value: 'SERVICE:PROFESSIONAL' },
|
|
27
|
-
{ name: 'Service ENTERPRISE', value: 'SERVICE:ENTERPRISE' },
|
|
28
|
-
promptUtils_1.Separator,
|
|
29
|
-
{ name: 'Sales STARTER', value: 'SALES:STARTER' },
|
|
30
|
-
{ name: 'Sales PROFESSIONAL', value: 'SALES:PROFESSIONAL' },
|
|
31
|
-
{ name: 'Sales ENTERPRISE', value: 'SALES:ENTERPRISE' },
|
|
32
|
-
promptUtils_1.Separator,
|
|
33
|
-
{ name: 'Content STARTER', value: 'CONTENT:STARTER' },
|
|
34
|
-
{ name: 'Content PROFESSIONAL', value: 'CONTENT:PROFESSIONAL' },
|
|
35
|
-
{ name: 'Content ENTERPRISE', value: 'CONTENT:ENTERPRISE' },
|
|
36
|
-
promptUtils_1.Separator,
|
|
43
|
+
...makeHubTiers('MARKETING'),
|
|
44
|
+
new prompts_1.Separator(),
|
|
45
|
+
...makeHubTiers('OPS'),
|
|
46
|
+
new prompts_1.Separator(),
|
|
47
|
+
...makeHubTiers('SERVICE'),
|
|
48
|
+
new prompts_1.Separator(),
|
|
49
|
+
...makeHubTiers('SALES'),
|
|
50
|
+
new prompts_1.Separator(),
|
|
51
|
+
...makeHubTiers('CONTENT'),
|
|
52
|
+
new prompts_1.Separator(),
|
|
37
53
|
];
|
|
38
54
|
async function createDeveloperTestAccountConfigPrompt(args = {}) {
|
|
39
|
-
const { name, description
|
|
55
|
+
const { name, description } = args;
|
|
40
56
|
let accountName = name;
|
|
41
57
|
let accountDescription = description;
|
|
42
|
-
let accountLevelsArray =
|
|
58
|
+
let accountLevelsArray = [];
|
|
43
59
|
if (!accountName) {
|
|
44
60
|
const namePromptResult = await (0, promptUtils_1.promptUser)({
|
|
45
61
|
name: 'accountName',
|
|
46
62
|
message: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.namePrompt,
|
|
47
63
|
type: 'input',
|
|
64
|
+
validate: value => {
|
|
65
|
+
if (!value) {
|
|
66
|
+
return en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.errors
|
|
67
|
+
.nameRequired;
|
|
68
|
+
}
|
|
69
|
+
return true;
|
|
70
|
+
},
|
|
48
71
|
});
|
|
49
72
|
accountName = namePromptResult.accountName;
|
|
50
73
|
}
|
|
@@ -56,17 +79,36 @@ async function createDeveloperTestAccountConfigPrompt(args = {}) {
|
|
|
56
79
|
});
|
|
57
80
|
accountDescription = descriptionPromptResult.description;
|
|
58
81
|
}
|
|
59
|
-
|
|
82
|
+
const useDefaultAccountLevelsPromptResult = await (0, promptUtils_1.promptUser)({
|
|
83
|
+
name: 'useDefaultAccountLevels',
|
|
84
|
+
message: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt
|
|
85
|
+
.useDefaultAccountLevelsPrompt.message,
|
|
86
|
+
type: 'list',
|
|
87
|
+
choices: [
|
|
88
|
+
{
|
|
89
|
+
name: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt
|
|
90
|
+
.useDefaultAccountLevelsPrompt.default,
|
|
91
|
+
value: 'default',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt
|
|
95
|
+
.useDefaultAccountLevelsPrompt.manual,
|
|
96
|
+
value: 'manual',
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
});
|
|
100
|
+
if (useDefaultAccountLevelsPromptResult.useDefaultAccountLevels === 'manual') {
|
|
60
101
|
const accountLevelsPromptResult = await (0, promptUtils_1.promptUser)({
|
|
61
102
|
name: 'testAccountLevels',
|
|
62
103
|
message: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.tiersPrompt,
|
|
63
104
|
type: 'checkbox',
|
|
105
|
+
pageSize: 13,
|
|
64
106
|
choices: TEST_ACCOUNT_TIERS,
|
|
65
107
|
validate: choices => {
|
|
66
108
|
if (choices?.length > 1) {
|
|
67
109
|
const hubMap = {};
|
|
68
110
|
for (const choice of choices) {
|
|
69
|
-
const hub = choice.
|
|
111
|
+
const { hub } = choice.value;
|
|
70
112
|
if (hubMap[hub]) {
|
|
71
113
|
return en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.errors
|
|
72
114
|
.tiersError;
|
|
@@ -79,15 +121,17 @@ async function createDeveloperTestAccountConfigPrompt(args = {}) {
|
|
|
79
121
|
});
|
|
80
122
|
accountLevelsArray = accountLevelsPromptResult.testAccountLevels;
|
|
81
123
|
}
|
|
82
|
-
if (!accountLevelsArray) {
|
|
83
|
-
accountLevelsArray = [];
|
|
84
|
-
}
|
|
85
124
|
const accountLevels = accountLevelsArray.reduce((acc, level) => {
|
|
86
|
-
const
|
|
125
|
+
const { hub: hubName, tier: hubTier } = level;
|
|
87
126
|
const hubLevel = hubs[hubName];
|
|
88
127
|
acc[hubLevel] = hubTier;
|
|
89
128
|
return acc;
|
|
90
129
|
}, {});
|
|
130
|
+
Object.values(hubs).forEach(hubLevel => {
|
|
131
|
+
if (!accountLevels[hubLevel]) {
|
|
132
|
+
accountLevels[hubLevel] = AccountTiers.ENTERPRISE;
|
|
133
|
+
}
|
|
134
|
+
});
|
|
91
135
|
return {
|
|
92
136
|
accountName: accountName,
|
|
93
137
|
description: accountDescription,
|
|
@@ -26,9 +26,8 @@ const CONTENT_TYPES_PROMPT = {
|
|
|
26
26
|
type: 'checkbox',
|
|
27
27
|
name: 'contentTypes',
|
|
28
28
|
message: (0, lang_1.i18n)(`lib.prompts.createModulePrompt.selectContentType`),
|
|
29
|
-
default: ['ANY'],
|
|
30
29
|
choices: [
|
|
31
|
-
{ name: 'Any', value: 'ANY' },
|
|
30
|
+
{ name: 'Any', value: 'ANY', checked: true },
|
|
32
31
|
{ name: 'Landing page', value: 'LANDING_PAGE' },
|
|
33
32
|
{ name: 'Site page', value: 'SITE_PAGE' },
|
|
34
33
|
{ name: 'Blog post', value: 'BLOG_POST' },
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Separator } from '@inquirer/prompts';
|
|
1
2
|
import { ComponentTemplate, ComponentTemplateChoice } from '../../types/Projects';
|
|
2
3
|
type ProjectAddPromptResponse = {
|
|
3
4
|
componentTemplate: ComponentTemplate;
|
|
@@ -10,5 +11,5 @@ export declare function projectAddPrompt(components: ComponentTemplate[], prompt
|
|
|
10
11
|
name?: string;
|
|
11
12
|
type?: string;
|
|
12
13
|
}): Promise<ProjectAddPromptResponse>;
|
|
13
|
-
export declare function projectAddPromptV3(components: ComponentTemplateChoice[], selectedFeatures: string[] | undefined): Promise<ProjectAddPromptResponseV3>;
|
|
14
|
+
export declare function projectAddPromptV3(components: (ComponentTemplateChoice | Separator)[], selectedFeatures: string[] | undefined): Promise<ProjectAddPromptResponseV3>;
|
|
14
15
|
export {};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.projectAddPrompt = projectAddPrompt;
|
|
4
4
|
exports.projectAddPromptV3 = projectAddPromptV3;
|
|
5
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
5
6
|
const promptUtils_1 = require("./promptUtils");
|
|
6
7
|
const en_1 = require("../../lang/en");
|
|
7
8
|
function findComponentByPathOrLabel(components, componentPathOrLabel) {
|
|
@@ -51,7 +52,7 @@ async function projectAddPromptV3(components, selectedFeatures) {
|
|
|
51
52
|
const selectedComponents = [];
|
|
52
53
|
if (selectedFeatures) {
|
|
53
54
|
components.forEach(template => {
|
|
54
|
-
if (!template.value) {
|
|
55
|
+
if (template instanceof prompts_1.Separator || !template.value) {
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
57
58
|
if (selectedFeatures?.includes(template.value.type)) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { Separator as _Separator } from '@inquirer/prompts';
|
|
1
2
|
import { PromptConfig, GenericPromptResponse, PromptWhen, PromptChoices } from '../../types/Prompts';
|
|
2
|
-
export declare const Separator:
|
|
3
|
+
export declare const Separator: _Separator;
|
|
3
4
|
export declare function promptUser<T extends GenericPromptResponse>(config: PromptConfig<T> | PromptConfig<T>[]): Promise<T>;
|
|
4
5
|
export declare function confirmPrompt(message: string, options?: {
|
|
5
6
|
defaultAnswer?: boolean;
|
|
6
|
-
when?: PromptWhen;
|
|
7
7
|
}): Promise<boolean>;
|
|
8
8
|
export declare function listPrompt<T = string>(message: string, { choices, when, defaultAnswer, validate, }: {
|
|
9
9
|
choices: PromptChoices<T>;
|