@hubspot/cli 7.7.19-experimental.3 → 7.7.20-experimental.0
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/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/app.js +1 -6
- 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/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/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 +344 -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/dev/unifiedFlow.js +1 -1
- 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 +40 -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 +24 -14
- 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 +6 -65
- package/lang/en.js +6 -65
- 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 +171 -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/buildAccount.d.ts +1 -7
- package/lib/buildAccount.js +4 -54
- 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/mcp/setup.js +18 -2
- 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/localDev/DevServerManager.js +0 -1
- package/lib/projects/localDev/helpers.d.ts +1 -1
- package/lib/projects/localDev/helpers.js +2 -2
- package/lib/projects/structure.d.ts +2 -2
- package/lib/projects/upload.d.ts +1 -2
- package/lib/projects/upload.js +0 -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 +43 -81
- package/lib/schema.js +5 -1
- package/lib/ui/SpinniesManager.js +0 -1
- package/lib/ui/supportHyperlinks.js +2 -2
- package/lib/ui/supportsColor.js +2 -2
- 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/__tests__/AddFeatureToProject.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/AddFeatureToProject.test.js +152 -0
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +129 -0
- package/mcp-server/tools/project/__tests__/DeployProject.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/DeployProject.test.js +120 -0
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.js +127 -0
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.js +108 -0
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.js +111 -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 +81 -0
- package/package.json +8 -8
- package/commands/app/install.d.ts +0 -8
- package/commands/app/install.js +0 -127
package/lib/buildAccount.js
CHANGED
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.saveAccountToConfig = saveAccountToConfig;
|
|
7
|
-
exports.createDeveloperTestAccountV3 = createDeveloperTestAccountV3;
|
|
8
7
|
exports.buildDeveloperTestAccount = buildDeveloperTestAccount;
|
|
9
8
|
exports.buildSandbox = buildSandbox;
|
|
10
9
|
const personalAccessKey_1 = require("@hubspot/local-dev-lib/personalAccessKey");
|
|
@@ -15,15 +14,12 @@ const developerTestAccounts_1 = require("@hubspot/local-dev-lib/api/developerTes
|
|
|
15
14
|
const config_2 = require("@hubspot/local-dev-lib/constants/config");
|
|
16
15
|
const sandboxHubs_1 = require("@hubspot/local-dev-lib/api/sandboxHubs");
|
|
17
16
|
const personalAccessKeyPrompt_1 = require("./prompts/personalAccessKeyPrompt");
|
|
18
|
-
const createDeveloperTestAccountConfigPrompt_1 = require("./prompts/createDeveloperTestAccountConfigPrompt");
|
|
19
17
|
const lang_1 = require("./lang");
|
|
20
18
|
const accountNamePrompt_1 = require("./prompts/accountNamePrompt");
|
|
21
19
|
const SpinniesManager_1 = __importDefault(require("./ui/SpinniesManager"));
|
|
22
20
|
const index_1 = require("./errorHandlers/index");
|
|
23
21
|
const sandboxes_1 = require("./sandboxes");
|
|
24
22
|
const developerTestAccounts_2 = require("./developerTestAccounts");
|
|
25
|
-
const en_1 = require("../lang/en");
|
|
26
|
-
const polling_1 = require("./polling");
|
|
27
23
|
async function saveAccountToConfig(accountId, accountName, env, personalAccessKey, force = false) {
|
|
28
24
|
if (!personalAccessKey) {
|
|
29
25
|
const configData = await (0, personalAccessKeyPrompt_1.personalAccessKeyPrompt)({
|
|
@@ -64,51 +60,12 @@ async function saveAccountToConfig(accountId, accountName, env, personalAccessKe
|
|
|
64
60
|
logger_1.logger.log('');
|
|
65
61
|
return validName;
|
|
66
62
|
}
|
|
67
|
-
async function
|
|
68
|
-
const result = {
|
|
69
|
-
accountName: testAccountConfig.accountName,
|
|
70
|
-
};
|
|
71
|
-
const { data } = await (0, developerTestAccounts_1.createDeveloperTestAccount)(parentAccountId, testAccountConfig);
|
|
72
|
-
result.accountId = data.id;
|
|
73
|
-
try {
|
|
74
|
-
await (0, polling_1.poll)(() => (0, developerTestAccounts_1.fetchDeveloperTestAccountGateSyncStatus)(parentAccountId, result.accountId), {
|
|
75
|
-
successStates: ['SUCCESS'],
|
|
76
|
-
errorStates: [],
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
catch (err) {
|
|
80
|
-
(0, index_1.debugError)(err);
|
|
81
|
-
throw new Error(en_1.lib.buildAccount.createDeveloperTestAccountV3.syncFailure);
|
|
82
|
-
}
|
|
83
|
-
// HACK: The status endpoint sometimes returns an early success status.
|
|
84
|
-
// Sleep for an extra 5 seconds to make sure the sync is actually complete.
|
|
85
|
-
await new Promise(resolve => setTimeout(resolve, 5000));
|
|
86
|
-
try {
|
|
87
|
-
// Attempt to generate a new personal access key for the test account now that gate sync is complete.
|
|
88
|
-
const { data } = await (0, developerTestAccounts_1.generateDeveloperTestAccountPersonalAccessKey)(parentAccountId, result.accountId);
|
|
89
|
-
result.personalAccessKey = data.personalAccessKey;
|
|
90
|
-
}
|
|
91
|
-
catch (err) {
|
|
92
|
-
(0, index_1.debugError)(err);
|
|
93
|
-
throw new Error(en_1.lib.buildAccount.createDeveloperTestAccountV3.pakFailure);
|
|
94
|
-
}
|
|
95
|
-
return result;
|
|
96
|
-
}
|
|
97
|
-
async function buildDeveloperTestAccount(testAccountName, parentAccountConfig, env, portalLimit, useV3 = false) {
|
|
63
|
+
async function buildDeveloperTestAccount(testAccountName, parentAccountConfig, env, portalLimit) {
|
|
98
64
|
const id = (0, getAccountIdentifier_1.getAccountIdentifier)(parentAccountConfig);
|
|
99
65
|
const parentAccountId = (0, config_1.getAccountId)(id);
|
|
100
|
-
let testAccountConfig = {
|
|
101
|
-
accountName: testAccountName,
|
|
102
|
-
};
|
|
103
66
|
if (!parentAccountId) {
|
|
104
67
|
throw new Error((0, lang_1.i18n)(`lib.developerTestAccount.create.loading.fail`));
|
|
105
68
|
}
|
|
106
|
-
if (useV3) {
|
|
107
|
-
testAccountConfig = await (0, createDeveloperTestAccountConfigPrompt_1.createDeveloperTestAccountConfigPrompt)({
|
|
108
|
-
name: testAccountConfig.accountName,
|
|
109
|
-
description: 'Test Account created by the HubSpot CLI',
|
|
110
|
-
}, false);
|
|
111
|
-
}
|
|
112
69
|
SpinniesManager_1.default.init({
|
|
113
70
|
succeedColor: 'white',
|
|
114
71
|
});
|
|
@@ -121,16 +78,9 @@ async function buildDeveloperTestAccount(testAccountName, parentAccountConfig, e
|
|
|
121
78
|
let developerTestAccountId;
|
|
122
79
|
let developerTestAccountPersonalAccessKey;
|
|
123
80
|
try {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
developerTestAccountPersonalAccessKey = result.personalAccessKey;
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
const { data } = await (0, developerTestAccounts_1.createDeveloperTestAccount)(parentAccountId, testAccountName);
|
|
131
|
-
developerTestAccountId = data.id;
|
|
132
|
-
developerTestAccountPersonalAccessKey = data.personalAccessKey;
|
|
133
|
-
}
|
|
81
|
+
const { data } = await (0, developerTestAccounts_1.createDeveloperTestAccount)(parentAccountId, testAccountName);
|
|
82
|
+
developerTestAccountId = data.id;
|
|
83
|
+
developerTestAccountPersonalAccessKey = data.personalAccessKey;
|
|
134
84
|
SpinniesManager_1.default.succeed('buildDeveloperTestAccount', {
|
|
135
85
|
text: (0, lang_1.i18n)(`lib.developerTestAccount.create.loading.succeed`, {
|
|
136
86
|
accountName: testAccountName,
|
package/lib/doctor/Diagnosis.js
CHANGED
|
@@ -6,7 +6,7 @@ const chalk_1 = require("chalk");
|
|
|
6
6
|
const interpolation_1 = require("../interpolation");
|
|
7
7
|
const ui_1 = require("../ui");
|
|
8
8
|
const index_1 = require("../ui/index");
|
|
9
|
-
const
|
|
9
|
+
const lang_1 = require("../lang");
|
|
10
10
|
class Diagnosis {
|
|
11
11
|
prefixes;
|
|
12
12
|
diagnosis;
|
|
@@ -21,24 +21,24 @@ class Diagnosis {
|
|
|
21
21
|
};
|
|
22
22
|
this.diagnosis = {
|
|
23
23
|
cli: {
|
|
24
|
-
header: i18n(`lib.doctor.diagnosis.cli.header`),
|
|
24
|
+
header: (0, lang_1.i18n)(`lib.doctor.diagnosis.cli.header`),
|
|
25
25
|
sections: [],
|
|
26
26
|
},
|
|
27
27
|
cliConfig: {
|
|
28
|
-
header: i18n(`lib.doctor.diagnosis.cliConfig.header`),
|
|
28
|
+
header: (0, lang_1.i18n)(`lib.doctor.diagnosis.cliConfig.header`),
|
|
29
29
|
sections: [],
|
|
30
30
|
},
|
|
31
31
|
defaultAccountOverrideFile: {
|
|
32
|
-
header: i18n(`lib.doctor.diagnosis.defaultAccountOverrideFile.header`),
|
|
32
|
+
header: (0, lang_1.i18n)(`lib.doctor.diagnosis.defaultAccountOverrideFile.header`),
|
|
33
33
|
sections: [],
|
|
34
34
|
},
|
|
35
35
|
project: {
|
|
36
|
-
header: i18n(`lib.doctor.diagnosis.projectConfig.header`),
|
|
36
|
+
header: (0, lang_1.i18n)(`lib.doctor.diagnosis.projectConfig.header`),
|
|
37
37
|
subheaders: [
|
|
38
|
-
i18n(`lib.doctor.diagnosis.projectConfig.projectDirSubHeader`, {
|
|
38
|
+
(0, lang_1.i18n)(`lib.doctor.diagnosis.projectConfig.projectDirSubHeader`, {
|
|
39
39
|
projectDir: diagnosticInfo.project?.config?.projectDir,
|
|
40
40
|
}),
|
|
41
|
-
i18n(`lib.doctor.diagnosis.projectConfig.projectNameSubHeader`, {
|
|
41
|
+
(0, lang_1.i18n)(`lib.doctor.diagnosis.projectConfig.projectNameSubHeader`, {
|
|
42
42
|
projectName: diagnosticInfo.project?.config?.projectConfig?.name,
|
|
43
43
|
}),
|
|
44
44
|
],
|
|
@@ -47,10 +47,10 @@ class Diagnosis {
|
|
|
47
47
|
};
|
|
48
48
|
if (diagnosticInfo.config) {
|
|
49
49
|
this.diagnosis.cliConfig.subheaders = [
|
|
50
|
-
i18n(`lib.doctor.diagnosis.cliConfig.configFileSubHeader`, {
|
|
50
|
+
(0, lang_1.i18n)(`lib.doctor.diagnosis.cliConfig.configFileSubHeader`, {
|
|
51
51
|
filename: diagnosticInfo.config,
|
|
52
52
|
}),
|
|
53
|
-
i18n(`lib.doctor.diagnosis.cliConfig.defaultAccountSubHeader`, {
|
|
53
|
+
(0, lang_1.i18n)(`lib.doctor.diagnosis.cliConfig.defaultAccountSubHeader`, {
|
|
54
54
|
accountDetails: (0, ui_1.uiAccountDescription)(accountId),
|
|
55
55
|
}),
|
|
56
56
|
];
|
|
@@ -86,10 +86,10 @@ class Diagnosis {
|
|
|
86
86
|
return '';
|
|
87
87
|
}
|
|
88
88
|
output.push('');
|
|
89
|
-
output.push(i18n(`lib.doctor.diagnosis.counts.errors`, {
|
|
89
|
+
output.push((0, lang_1.i18n)(`lib.doctor.diagnosis.counts.errors`, {
|
|
90
90
|
count: this.errorCount,
|
|
91
91
|
}));
|
|
92
|
-
output.push(i18n(`lib.doctor.diagnosis.counts.warnings`, {
|
|
92
|
+
output.push((0, lang_1.i18n)(`lib.doctor.diagnosis.counts.warnings`, {
|
|
93
93
|
count: this.warningCount,
|
|
94
94
|
}));
|
|
95
95
|
output.push('');
|
package/lib/doctor/Doctor.js
CHANGED
|
@@ -21,8 +21,8 @@ const index_1 = require("@hubspot/local-dev-lib/errors/index");
|
|
|
21
21
|
const urls_1 = require("@hubspot/local-dev-lib/urls");
|
|
22
22
|
const ui_1 = require("../ui");
|
|
23
23
|
const package_json_1 = __importDefault(require("../../package.json"));
|
|
24
|
-
const
|
|
25
|
-
const
|
|
24
|
+
const lang_1 = require("../lang");
|
|
25
|
+
const ui_2 = require("../ui");
|
|
26
26
|
const minMajorNodeVersion = 18;
|
|
27
27
|
class Doctor {
|
|
28
28
|
accountId;
|
|
@@ -37,7 +37,7 @@ class Doctor {
|
|
|
37
37
|
}
|
|
38
38
|
async diagnose() {
|
|
39
39
|
SpinniesManager_1.default.add('runningDiagnostics', {
|
|
40
|
-
text: i18n(`lib.doctor.runningDiagnostics`),
|
|
40
|
+
text: (0, lang_1.i18n)(`lib.doctor.runningDiagnostics`),
|
|
41
41
|
});
|
|
42
42
|
this.diagnosticInfo =
|
|
43
43
|
await this.diagnosticInfoBuilder.generateDiagnosticInfo();
|
|
@@ -54,7 +54,7 @@ class Doctor {
|
|
|
54
54
|
this.performDefaultAccountOverrideFileChecks();
|
|
55
55
|
this.performCliConfigSettingsChecks();
|
|
56
56
|
SpinniesManager_1.default.succeed('runningDiagnostics', {
|
|
57
|
-
text: i18n(`lib.doctor.diagnosticsComplete`),
|
|
57
|
+
text: (0, lang_1.i18n)(`lib.doctor.diagnosticsComplete`),
|
|
58
58
|
succeedColor: 'white',
|
|
59
59
|
});
|
|
60
60
|
this.diagnosticInfo.diagnosis = this.diagnosis.toString();
|
|
@@ -80,8 +80,8 @@ class Doctor {
|
|
|
80
80
|
if (!this.diagnosticInfo?.config) {
|
|
81
81
|
this.diagnosis?.addCLIConfigSection({
|
|
82
82
|
type: 'error',
|
|
83
|
-
message: i18n(`lib.doctor.diagnosis.cliConfig.noConfigFile`),
|
|
84
|
-
secondaryMessaging: i18n(`lib.doctor.diagnosis.cliConfig.noConfigFileSecondary`, {
|
|
83
|
+
message: (0, lang_1.i18n)(`lib.doctor.diagnosis.cliConfig.noConfigFile`),
|
|
84
|
+
secondaryMessaging: (0, lang_1.i18n)(`lib.doctor.diagnosis.cliConfig.noConfigFileSecondary`, {
|
|
85
85
|
command: (0, ui_1.uiCommandReference)('hs init'),
|
|
86
86
|
}),
|
|
87
87
|
});
|
|
@@ -93,13 +93,13 @@ class Doctor {
|
|
|
93
93
|
if (this.diagnosticInfo?.defaultAccountOverrideFile) {
|
|
94
94
|
this.diagnosis?.addDefaultAccountOverrideFileSection({
|
|
95
95
|
type: 'warning',
|
|
96
|
-
message: i18n(`lib.doctor.defaultAccountOverrideFileChecks.overrideActive`, {
|
|
96
|
+
message: (0, lang_1.i18n)(`lib.doctor.defaultAccountOverrideFileChecks.overrideActive`, {
|
|
97
97
|
defaultAccountOverrideFile: this.diagnosticInfo.defaultAccountOverrideFile,
|
|
98
98
|
}),
|
|
99
99
|
});
|
|
100
100
|
this.diagnosis?.addDefaultAccountOverrideFileSection({
|
|
101
101
|
type: 'warning',
|
|
102
|
-
message: i18n(`lib.doctor.defaultAccountOverrideFileChecks.overrideAccountId`, {
|
|
102
|
+
message: (0, lang_1.i18n)(`lib.doctor.defaultAccountOverrideFileChecks.overrideAccountId`, {
|
|
103
103
|
overrideAccountId: (0, config_1.getCWDAccountOverride)(),
|
|
104
104
|
}),
|
|
105
105
|
});
|
|
@@ -109,8 +109,8 @@ class Doctor {
|
|
|
109
109
|
if (this.diagnosticInfo?.configSettings.httpUseLocalhost) {
|
|
110
110
|
this.diagnosis?.addCLIConfigSection({
|
|
111
111
|
type: 'warning',
|
|
112
|
-
message: i18n(`lib.doctor.diagnosis.cliConfig.settings.httpUseLocalhost`),
|
|
113
|
-
secondaryMessaging: i18n(`lib.doctor.diagnosis.cliConfig.settings.httpUseLocalhostSecondary`),
|
|
112
|
+
message: (0, lang_1.i18n)(`lib.doctor.diagnosis.cliConfig.settings.httpUseLocalhost`),
|
|
113
|
+
secondaryMessaging: (0, lang_1.i18n)(`lib.doctor.diagnosis.cliConfig.settings.httpUseLocalhostSecondary`),
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
116
|
}
|
|
@@ -121,14 +121,14 @@ class Doctor {
|
|
|
121
121
|
const missingScopes = (await (0, personalAccessKey_1.authorizedScopesForPortalAndUser)(this.accountId)).filter((data) => data.userAuthorized && !pakScopes.has(data.scopeGroup.name));
|
|
122
122
|
this.diagnosis?.addCLIConfigSection({
|
|
123
123
|
type: 'success',
|
|
124
|
-
message: i18n(`lib.doctor.accountChecks.active`),
|
|
124
|
+
message: (0, lang_1.i18n)(`lib.doctor.accountChecks.active`),
|
|
125
125
|
});
|
|
126
|
-
const linkToPakUI = uiLink(i18n(`lib.doctor.accountChecks.pak.viewScopes`), `${(0, urls_1.getHubSpotWebsiteOrigin)(this.diagnosticInfoBuilder?.env || 'PROD')}/personal-access-key/${this.diagnosticInfo?.account.accountId}`);
|
|
126
|
+
const linkToPakUI = (0, ui_2.uiLink)((0, lang_1.i18n)(`lib.doctor.accountChecks.pak.viewScopes`), `${(0, urls_1.getHubSpotWebsiteOrigin)(this.diagnosticInfoBuilder?.env || 'PROD')}/personal-access-key/${this.diagnosticInfo?.account.accountId}`);
|
|
127
127
|
if (missingScopes.length > 0) {
|
|
128
128
|
this.diagnosis?.addCLIConfigSection({
|
|
129
129
|
type: 'warning',
|
|
130
|
-
message: i18n(`lib.doctor.accountChecks.pak.incomplete`),
|
|
131
|
-
secondaryMessaging: i18n(`lib.doctor.accountChecks.pak.incompleteSecondary`, {
|
|
130
|
+
message: (0, lang_1.i18n)(`lib.doctor.accountChecks.pak.incomplete`),
|
|
131
|
+
secondaryMessaging: (0, lang_1.i18n)(`lib.doctor.accountChecks.pak.incompleteSecondary`, {
|
|
132
132
|
command: (0, ui_1.uiCommandReference)(`hs auth`),
|
|
133
133
|
link: linkToPakUI,
|
|
134
134
|
}),
|
|
@@ -137,7 +137,7 @@ class Doctor {
|
|
|
137
137
|
else {
|
|
138
138
|
this.diagnosis?.addCLIConfigSection({
|
|
139
139
|
type: 'success',
|
|
140
|
-
message: i18n(`lib.doctor.accountChecks.pak.valid`, {
|
|
140
|
+
message: (0, lang_1.i18n)(`lib.doctor.accountChecks.pak.valid`, {
|
|
141
141
|
link: linkToPakUI,
|
|
142
142
|
}),
|
|
143
143
|
});
|
|
@@ -157,8 +157,8 @@ class Doctor {
|
|
|
157
157
|
if (portalNotActive) {
|
|
158
158
|
this.diagnosis?.addCLIConfigSection({
|
|
159
159
|
type: 'error',
|
|
160
|
-
message: i18n(`lib.doctor.accountChecks.inactive`),
|
|
161
|
-
secondaryMessaging: i18n(`lib.doctor.accountChecks.inactiveSecondary`, {
|
|
160
|
+
message: (0, lang_1.i18n)(`lib.doctor.accountChecks.inactive`),
|
|
161
|
+
secondaryMessaging: (0, lang_1.i18n)(`lib.doctor.accountChecks.inactiveSecondary`, {
|
|
162
162
|
command: (0, ui_1.uiCommandReference)(`hs accounts clean`),
|
|
163
163
|
}),
|
|
164
164
|
});
|
|
@@ -170,12 +170,12 @@ class Doctor {
|
|
|
170
170
|
})) {
|
|
171
171
|
this.diagnosis?.addCLIConfigSection({
|
|
172
172
|
type: 'success',
|
|
173
|
-
message: i18n(`lib.doctor.accountChecks.active`),
|
|
173
|
+
message: (0, lang_1.i18n)(`lib.doctor.accountChecks.active`),
|
|
174
174
|
});
|
|
175
175
|
this.diagnosis?.addCLIConfigSection({
|
|
176
176
|
type: 'error',
|
|
177
|
-
message: i18n(`lib.doctor.accountChecks.pak.invalid`),
|
|
178
|
-
secondaryMessaging: i18n(`lib.doctor.accountChecks.pak.invalidSecondary`, {
|
|
177
|
+
message: (0, lang_1.i18n)(`lib.doctor.accountChecks.pak.invalid`),
|
|
178
|
+
secondaryMessaging: (0, lang_1.i18n)(`lib.doctor.accountChecks.pak.invalidSecondary`, {
|
|
179
179
|
command: (0, ui_1.uiCommandReference)(`hs auth`),
|
|
180
180
|
}),
|
|
181
181
|
});
|
|
@@ -183,7 +183,7 @@ class Doctor {
|
|
|
183
183
|
else {
|
|
184
184
|
this.diagnosis?.addCLIConfigSection({
|
|
185
185
|
type: 'error',
|
|
186
|
-
message: i18n(`lib.doctor.accountChecks.unableToDetermine`),
|
|
186
|
+
message: (0, lang_1.i18n)(`lib.doctor.accountChecks.unableToDetermine`),
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
189
|
}
|
|
@@ -192,7 +192,7 @@ class Doctor {
|
|
|
192
192
|
if (!this.diagnosticInfo?.versions.node) {
|
|
193
193
|
return this.diagnosis?.addCliSection({
|
|
194
194
|
type: 'error',
|
|
195
|
-
message: i18n(`lib.doctor.nodeChecks.unableToDetermine`),
|
|
195
|
+
message: (0, lang_1.i18n)(`lib.doctor.nodeChecks.unableToDetermine`),
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
198
|
const nodeVersion = this.diagnosticInfo?.versions.node?.split('.');
|
|
@@ -200,14 +200,14 @@ class Doctor {
|
|
|
200
200
|
if (!currentNodeMajor || parseInt(currentNodeMajor) < minMajorNodeVersion) {
|
|
201
201
|
return this.diagnosis?.addCliSection({
|
|
202
202
|
type: 'warning',
|
|
203
|
-
message: i18n(`lib.doctor.nodeChecks.minimumNotMet`, {
|
|
203
|
+
message: (0, lang_1.i18n)(`lib.doctor.nodeChecks.minimumNotMet`, {
|
|
204
204
|
nodeVersion: this.diagnosticInfo?.versions.node,
|
|
205
205
|
}),
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
208
|
this.diagnosis?.addCliSection({
|
|
209
209
|
type: 'success',
|
|
210
|
-
message: i18n(`lib.doctor.nodeChecks.success`, {
|
|
210
|
+
message: (0, lang_1.i18n)(`lib.doctor.nodeChecks.success`, {
|
|
211
211
|
nodeVersion: this.diagnosticInfo?.versions.node,
|
|
212
212
|
}),
|
|
213
213
|
});
|
|
@@ -217,12 +217,12 @@ class Doctor {
|
|
|
217
217
|
if (!npmVersion) {
|
|
218
218
|
return this.diagnosis?.addCliSection({
|
|
219
219
|
type: 'error',
|
|
220
|
-
message: i18n(`lib.doctor.npmChecks.notInstalled`),
|
|
220
|
+
message: (0, lang_1.i18n)(`lib.doctor.npmChecks.notInstalled`),
|
|
221
221
|
});
|
|
222
222
|
}
|
|
223
223
|
this.diagnosis?.addCliSection({
|
|
224
224
|
type: 'success',
|
|
225
|
-
message: i18n(`lib.doctor.npmChecks.installed`, {
|
|
225
|
+
message: (0, lang_1.i18n)(`lib.doctor.npmChecks.installed`, {
|
|
226
226
|
npmVersion,
|
|
227
227
|
}),
|
|
228
228
|
});
|
|
@@ -238,10 +238,10 @@ class Doctor {
|
|
|
238
238
|
catch (e) {
|
|
239
239
|
return this.diagnosis?.addCliSection({
|
|
240
240
|
type: 'error',
|
|
241
|
-
message: i18n(`lib.doctor.hsChecks.unableToDetermine`),
|
|
242
|
-
secondaryMessaging: i18n(`lib.doctor.hsChecks.unableToDetermineSecondary`, {
|
|
241
|
+
message: (0, lang_1.i18n)(`lib.doctor.hsChecks.unableToDetermine`),
|
|
242
|
+
secondaryMessaging: (0, lang_1.i18n)(`lib.doctor.hsChecks.unableToDetermineSecondary`, {
|
|
243
243
|
command: (0, ui_1.uiCommandReference)(`hs --version`),
|
|
244
|
-
link: uiLink(i18n(`lib.doctor.hsChecks.unableToDetermineSecondaryLink`), `https://www.npmjs.com/package/${package_json_1.default.name}?activeTab=versions`),
|
|
244
|
+
link: (0, ui_2.uiLink)((0, lang_1.i18n)(`lib.doctor.hsChecks.unableToDetermineSecondaryLink`), `https://www.npmjs.com/package/${package_json_1.default.name}?activeTab=versions`),
|
|
245
245
|
}),
|
|
246
246
|
});
|
|
247
247
|
}
|
|
@@ -249,10 +249,10 @@ class Doctor {
|
|
|
249
249
|
const onNextTag = package_json_1.default.version.includes('beta');
|
|
250
250
|
this.diagnosis?.addCliSection({
|
|
251
251
|
type: 'warning',
|
|
252
|
-
message: i18n(`lib.doctor.hsChecks.notLatest`, {
|
|
252
|
+
message: (0, lang_1.i18n)(`lib.doctor.hsChecks.notLatest`, {
|
|
253
253
|
hsVersion: package_json_1.default.version,
|
|
254
254
|
}),
|
|
255
|
-
secondaryMessaging: i18n(`lib.doctor.hsChecks.notLatestSecondary`, {
|
|
255
|
+
secondaryMessaging: (0, lang_1.i18n)(`lib.doctor.hsChecks.notLatestSecondary`, {
|
|
256
256
|
hsVersion: onNextTag ? nextCliVersion : latestCLIVersion,
|
|
257
257
|
command: (0, ui_1.uiCommandReference)(`npm install -g ${package_json_1.default.name}`),
|
|
258
258
|
}),
|
|
@@ -261,7 +261,7 @@ class Doctor {
|
|
|
261
261
|
else {
|
|
262
262
|
this.diagnosis?.addCliSection({
|
|
263
263
|
type: 'success',
|
|
264
|
-
message: i18n(`lib.doctor.hsChecks.latest`, {
|
|
264
|
+
message: (0, lang_1.i18n)(`lib.doctor.hsChecks.latest`, {
|
|
265
265
|
hsVersion: package_json_1.default.version,
|
|
266
266
|
}),
|
|
267
267
|
});
|
|
@@ -277,10 +277,10 @@ class Doctor {
|
|
|
277
277
|
foundError = true;
|
|
278
278
|
this.diagnosis?.addProjectSection({
|
|
279
279
|
type: 'warning',
|
|
280
|
-
message: i18n(`lib.doctor.projectDependenciesChecks.missingDependencies`, {
|
|
280
|
+
message: (0, lang_1.i18n)(`lib.doctor.projectDependenciesChecks.missingDependencies`, {
|
|
281
281
|
dir: packageDirName,
|
|
282
282
|
}),
|
|
283
|
-
secondaryMessaging: i18n(`lib.doctor.projectDependenciesChecks.missingDependenciesSecondary`, {
|
|
283
|
+
secondaryMessaging: (0, lang_1.i18n)(`lib.doctor.projectDependenciesChecks.missingDependenciesSecondary`, {
|
|
284
284
|
command: (0, ui_1.uiCommandReference)('hs project install-deps'),
|
|
285
285
|
}),
|
|
286
286
|
});
|
|
@@ -291,7 +291,7 @@ class Doctor {
|
|
|
291
291
|
if (!(await this.isValidJsonFile(packageFile))) {
|
|
292
292
|
this.diagnosis?.addProjectSection({
|
|
293
293
|
type: 'error',
|
|
294
|
-
message: i18n(`lib.doctor.files.invalidJson`, {
|
|
294
|
+
message: (0, lang_1.i18n)(`lib.doctor.files.invalidJson`, {
|
|
295
295
|
filename: packageFile,
|
|
296
296
|
}),
|
|
297
297
|
});
|
|
@@ -299,7 +299,7 @@ class Doctor {
|
|
|
299
299
|
else {
|
|
300
300
|
this.diagnosis?.addProjectSection({
|
|
301
301
|
type: 'error',
|
|
302
|
-
message: i18n(`lib.doctor.projectDependenciesChecks.unableToDetermine`, {
|
|
302
|
+
message: (0, lang_1.i18n)(`lib.doctor.projectDependenciesChecks.unableToDetermine`, {
|
|
303
303
|
dir: packageDirName,
|
|
304
304
|
}),
|
|
305
305
|
});
|
|
@@ -310,7 +310,7 @@ class Doctor {
|
|
|
310
310
|
if (!foundError) {
|
|
311
311
|
this.diagnosis?.addProjectSection({
|
|
312
312
|
type: 'success',
|
|
313
|
-
message: i18n(`lib.doctor.projectDependenciesChecks.success`),
|
|
313
|
+
message: (0, lang_1.i18n)(`lib.doctor.projectDependenciesChecks.success`),
|
|
314
314
|
});
|
|
315
315
|
}
|
|
316
316
|
}
|
|
@@ -333,7 +333,7 @@ class Doctor {
|
|
|
333
333
|
foundError = true;
|
|
334
334
|
this.diagnosis?.addProjectSection({
|
|
335
335
|
type: 'error',
|
|
336
|
-
message: i18n(`lib.doctor.files.invalidJson`, {
|
|
336
|
+
message: (0, lang_1.i18n)(`lib.doctor.files.invalidJson`, {
|
|
337
337
|
filename: jsonFile,
|
|
338
338
|
}),
|
|
339
339
|
});
|
|
@@ -342,7 +342,7 @@ class Doctor {
|
|
|
342
342
|
if (!foundError) {
|
|
343
343
|
this.diagnosis?.addProjectSection({
|
|
344
344
|
type: 'success',
|
|
345
|
-
message: i18n(`lib.doctor.files.validJson`),
|
|
345
|
+
message: (0, lang_1.i18n)(`lib.doctor.files.validJson`),
|
|
346
346
|
});
|
|
347
347
|
}
|
|
348
348
|
}
|
|
@@ -350,7 +350,7 @@ class Doctor {
|
|
|
350
350
|
if (await (0, portManager_1.isPortManagerPortAvailable)()) {
|
|
351
351
|
this.diagnosis?.addProjectSection({
|
|
352
352
|
type: 'success',
|
|
353
|
-
message: i18n(`lib.doctor.port.available`, {
|
|
353
|
+
message: (0, lang_1.i18n)(`lib.doctor.port.available`, {
|
|
354
354
|
port: ports_1.PORT_MANAGER_SERVER_PORT,
|
|
355
355
|
}),
|
|
356
356
|
});
|
|
@@ -358,10 +358,10 @@ class Doctor {
|
|
|
358
358
|
}
|
|
359
359
|
this.diagnosis?.addProjectSection({
|
|
360
360
|
type: 'warning',
|
|
361
|
-
message: i18n(`lib.doctor.port.inUse`, {
|
|
361
|
+
message: (0, lang_1.i18n)(`lib.doctor.port.inUse`, {
|
|
362
362
|
port: ports_1.PORT_MANAGER_SERVER_PORT,
|
|
363
363
|
}),
|
|
364
|
-
secondaryMessaging: i18n(`lib.doctor.port.inUseSecondary`, {
|
|
364
|
+
secondaryMessaging: (0, lang_1.i18n)(`lib.doctor.port.inUseSecondary`, {
|
|
365
365
|
command: (0, ui_1.uiCommandReference)('hs project dev'),
|
|
366
366
|
}),
|
|
367
367
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
+
vi.mock('@hubspot/local-dev-lib/config');
|
|
7
|
+
const Diagnosis_1 = require("../Diagnosis");
|
|
8
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
9
|
+
const strip_ansi_1 = __importDefault(require("strip-ansi"));
|
|
10
|
+
const getAccountConfig = config_1.getAccountConfig;
|
|
11
|
+
describe('lib/doctor/Diagnosis', () => {
|
|
12
|
+
const diagnosticInfo = {
|
|
13
|
+
account: {},
|
|
14
|
+
arch: process.arch,
|
|
15
|
+
config: 'path/to/config.json',
|
|
16
|
+
defaultAccountOverrideFile: 'path/to/default/account/override/.hsaccount',
|
|
17
|
+
configSettings: { httpUseLocalhost: false },
|
|
18
|
+
configFiles: [],
|
|
19
|
+
envFiles: [],
|
|
20
|
+
files: [],
|
|
21
|
+
jsonFiles: [],
|
|
22
|
+
packageFiles: [],
|
|
23
|
+
packageLockFiles: [],
|
|
24
|
+
platform: process.platform,
|
|
25
|
+
project: {
|
|
26
|
+
config: {
|
|
27
|
+
projectDir: 'project-dir',
|
|
28
|
+
projectConfig: {
|
|
29
|
+
name: 'Super cool project',
|
|
30
|
+
srcDir: 'project-dir',
|
|
31
|
+
platformVersion: 'test',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
versions: { '@hubspot/cli': '123', node: '18.0.1', npm: '8.0.0' },
|
|
36
|
+
};
|
|
37
|
+
const accountId = 123456;
|
|
38
|
+
beforeEach(() => {
|
|
39
|
+
getAccountConfig.mockReturnValue({
|
|
40
|
+
accountType: 'STANDARD',
|
|
41
|
+
name: 'Standard Account',
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
describe('toString', () => {
|
|
45
|
+
it('should return an empty diagnosis when no sections have been added', () => {
|
|
46
|
+
const diagnosis = new Diagnosis_1.Diagnosis({ diagnosticInfo, accountId });
|
|
47
|
+
const output = diagnosis.toString();
|
|
48
|
+
expect(output).toEqual('');
|
|
49
|
+
});
|
|
50
|
+
it('should generate the diagnosis output', () => {
|
|
51
|
+
const diagnosis = new Diagnosis_1.Diagnosis({ diagnosticInfo, accountId });
|
|
52
|
+
const cliMessage = 'Important CLI Message';
|
|
53
|
+
const cliSecondaryMessage = 'The CLI Section is Showing';
|
|
54
|
+
diagnosis.addCliSection({
|
|
55
|
+
type: 'success',
|
|
56
|
+
message: cliMessage,
|
|
57
|
+
secondaryMessaging: cliSecondaryMessage,
|
|
58
|
+
});
|
|
59
|
+
const cliConfigMessage = 'Important CLI Config Message';
|
|
60
|
+
const cliConfigSecondaryMessage = 'The CLI Config Section is Showing';
|
|
61
|
+
diagnosis.addCLIConfigSection({
|
|
62
|
+
type: 'error',
|
|
63
|
+
message: cliConfigMessage,
|
|
64
|
+
secondaryMessaging: cliConfigSecondaryMessage,
|
|
65
|
+
});
|
|
66
|
+
const projectMessage = 'Important Project Message';
|
|
67
|
+
const projectSecondaryMessage = 'The Project Section is Showing';
|
|
68
|
+
diagnosis.addProjectSection({
|
|
69
|
+
type: 'warning',
|
|
70
|
+
message: projectMessage,
|
|
71
|
+
secondaryMessaging: projectSecondaryMessage,
|
|
72
|
+
});
|
|
73
|
+
expect((0, strip_ansi_1.default)(diagnosis.toString())).toMatchSnapshot();
|
|
74
|
+
});
|
|
75
|
+
it('should generate categories that have sections', () => {
|
|
76
|
+
const diagnosis = new Diagnosis_1.Diagnosis({ diagnosticInfo, accountId });
|
|
77
|
+
const cliMessage = 'Important CLI Message';
|
|
78
|
+
const cliSecondaryMessage = 'The CLI Section is Showing';
|
|
79
|
+
diagnosis.addCliSection({
|
|
80
|
+
type: 'success',
|
|
81
|
+
message: cliMessage,
|
|
82
|
+
secondaryMessaging: cliSecondaryMessage,
|
|
83
|
+
});
|
|
84
|
+
expect((0, strip_ansi_1.default)(diagnosis.toString())).toMatchSnapshot();
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|