@hubspot/cli 7.8.11-experimental.0 → 7.8.12-experimental.1
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/bin/cli.js +31 -25
- package/commands/__tests__/auth.test.js +5 -0
- package/commands/__tests__/doctor.test.js +16 -16
- package/commands/account/clean.js +18 -27
- package/commands/account/createOverride.js +13 -31
- package/commands/account/info.js +20 -31
- package/commands/account/list.js +16 -22
- package/commands/account/remove.js +12 -20
- package/commands/account/removeOverride.js +11 -21
- package/commands/account/rename.js +6 -9
- package/commands/account/use.js +12 -26
- package/commands/account.js +2 -2
- package/commands/app/__tests__/migrate.test.js +5 -5
- package/commands/app/migrate.js +13 -18
- package/commands/auth.d.ts +1 -0
- package/commands/auth.js +16 -7
- package/commands/cms/convertFields.js +7 -9
- package/commands/cms/getReactModule.js +9 -14
- package/commands/cms/lighthouseScore.js +33 -36
- package/commands/cms.js +2 -2
- package/commands/completion.js +3 -3
- package/commands/config/set.d.ts +1 -1
- package/commands/config/set.js +64 -36
- package/commands/config.js +2 -2
- package/commands/create.js +2 -2
- package/commands/customObject/create.js +10 -12
- package/commands/customObject/schema/create.js +9 -11
- package/commands/customObject/schema/delete.js +16 -16
- package/commands/customObject/schema/fetch-all.js +12 -11
- package/commands/customObject/schema/fetch.js +15 -15
- package/commands/customObject/schema/list.js +4 -4
- package/commands/customObject/schema/update.js +13 -13
- package/commands/customObject/schema.js +2 -2
- package/commands/customObject.js +6 -7
- package/commands/doctor.js +8 -11
- package/commands/feedback.js +6 -11
- package/commands/fetch.js +8 -8
- package/commands/filemanager/fetch.js +7 -7
- package/commands/filemanager/upload.js +15 -34
- package/commands/filemanager.js +2 -2
- package/commands/function/deploy.js +11 -29
- package/commands/function/list.js +8 -8
- package/commands/function/server.js +9 -11
- package/commands/function.d.ts +1 -1
- package/commands/function.js +2 -2
- package/commands/getStarted.js +2 -2
- package/commands/hubdb/clear.js +7 -15
- package/commands/hubdb/create.js +9 -15
- package/commands/hubdb/delete.js +8 -15
- package/commands/hubdb/fetch.js +6 -9
- package/commands/hubdb.d.ts +1 -1
- package/commands/hubdb.js +2 -2
- package/commands/init.js +2 -3
- package/commands/lint.js +16 -16
- package/commands/list.js +8 -14
- package/commands/logs.js +14 -20
- package/commands/mv.js +6 -17
- package/commands/open.js +5 -5
- package/commands/project/__tests__/add.test.js +4 -2
- package/commands/project/__tests__/deploy.test.js +3 -4
- package/commands/project/__tests__/installDeps.test.js +8 -8
- package/commands/project/__tests__/logs.test.js +1 -1
- package/commands/project/__tests__/migrate.test.js +5 -5
- package/commands/project/__tests__/migrateApp.test.js +2 -5
- package/commands/project/__tests__/validate.test.js +98 -0
- package/commands/project/add.js +3 -3
- package/commands/project/cloneApp.js +14 -19
- package/commands/project/create.js +0 -1
- package/commands/project/deploy.js +3 -3
- package/commands/project/dev/deprecatedFlow.js +7 -16
- package/commands/project/dev/index.js +14 -12
- package/commands/project/dev/unifiedFlow.js +3 -1
- package/commands/project/download.js +10 -13
- package/commands/project/installDeps.js +8 -8
- package/commands/project/listBuilds.js +11 -20
- package/commands/project/logs.js +21 -24
- package/commands/project/migrate.js +14 -16
- package/commands/project/migrateApp.js +9 -15
- package/commands/project/open.js +6 -13
- package/commands/project/upload.js +16 -25
- package/commands/project/validate.js +6 -6
- package/commands/project/watch.js +13 -22
- package/commands/project.js +2 -2
- package/commands/sandbox/__tests__/create.test.js +5 -5
- package/commands/sandbox/create.js +22 -32
- package/commands/sandbox/delete.js +38 -63
- package/commands/sandbox.js +2 -2
- package/commands/secret/addSecret.js +7 -17
- package/commands/secret/deleteSecret.js +10 -20
- package/commands/secret/listSecret.js +8 -10
- package/commands/secret/updateSecret.js +9 -17
- package/commands/secret.js +2 -2
- package/commands/testAccount/__tests__/delete.test.js +2 -4
- package/commands/testAccount/delete.d.ts +4 -3
- package/commands/testAccount/delete.js +155 -14
- package/commands/theme/preview.js +1 -4
- package/lang/en.d.ts +310 -102
- package/lang/en.js +351 -147
- package/lang/en.lyaml +2 -2
- package/lib/__tests__/buildAccount.test.js +2 -1
- package/lib/__tests__/commonOpts.test.js +1 -1
- package/lib/__tests__/dependencyManagement.test.js +1 -1
- package/lib/__tests__/developerTestAccounts.test.js +3 -3
- package/lib/__tests__/npm.test.js +1 -1
- package/lib/__tests__/oauth.test.js +4 -4
- package/lib/__tests__/process.test.js +10 -5
- package/lib/__tests__/sandboxSync.test.js +8 -8
- package/lib/__tests__/sandboxes.test.js +8 -8
- package/lib/__tests__/serverlessLogs.test.js +1 -1
- package/lib/__tests__/usageTracking.test.js +5 -5
- package/lib/__tests__/validation.test.js +2 -1
- package/lib/__tests__/yargsUtils.test.js +83 -9
- package/lib/app/__tests__/migrate.test.js +5 -5
- package/lib/app/__tests__/migrate_legacy.test.js +1 -1
- package/lib/app/migrate.js +1 -1
- package/lib/app/migrate_legacy.js +20 -24
- package/lib/buildAccount.js +25 -57
- package/lib/commonOpts.d.ts +1 -1
- package/lib/commonOpts.js +25 -22
- package/lib/configOptions.js +7 -0
- package/lib/constants.d.ts +6 -1
- package/lib/constants.js +10 -1
- package/lib/dependencyManagement.js +9 -27
- package/lib/developerTestAccounts.js +9 -23
- package/lib/doctor/Diagnosis.js +11 -23
- package/lib/doctor/DiagnosticInfoBuilder.js +12 -11
- package/lib/doctor/Doctor.js +42 -90
- package/lib/doctor/__tests__/Doctor.test.js +4 -4
- package/lib/errorHandlers/index.js +12 -20
- package/lib/errorHandlers/suppressError.js +11 -18
- package/lib/lang.js +6 -5
- package/lib/links.js +4 -4
- package/lib/middleware/__test__/commandTargetingUtils.test.d.ts +1 -0
- package/lib/middleware/__test__/commandTargetingUtils.test.js +99 -0
- package/lib/middleware/__test__/configMiddleware.test.js +11 -11
- package/lib/middleware/__test__/yargsChecksMiddleware.test.js +6 -8
- package/lib/middleware/commandTargetingUtils.d.ts +8 -0
- package/lib/middleware/commandTargetingUtils.js +78 -0
- package/lib/middleware/configMiddleware.d.ts +1 -1
- package/lib/middleware/configMiddleware.js +21 -81
- package/lib/middleware/fireAlarmMiddleware.js +15 -17
- package/lib/middleware/gitMiddleware.js +5 -1
- package/lib/middleware/notificationsMiddleware.js +5 -11
- package/lib/middleware/yargsChecksMiddleware.js +6 -9
- package/lib/npm.js +2 -2
- package/lib/oauth.js +5 -5
- package/lib/process.js +5 -4
- package/lib/projects/__tests__/AppDevModeInterface.test.js +14 -34
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +70 -39
- package/lib/projects/__tests__/localDevProjectHelpers.test.js +2 -0
- package/lib/projects/__tests__/platformVersion.test.js +8 -8
- package/lib/projects/__tests__/projects.test.js +12 -12
- package/lib/projects/__tests__/structure.test.js +3 -3
- package/lib/projects/__tests__/upload.test.d.ts +1 -0
- package/lib/projects/__tests__/upload.test.js +82 -0
- package/lib/projects/add/__tests__/legacyAddComponent.test.js +6 -6
- package/lib/projects/add/__tests__/v3AddComponent.test.js +4 -4
- package/lib/projects/create/__tests__/legacy.test.js +5 -5
- package/lib/projects/create/__tests__/v3.test.js +1 -1
- package/lib/projects/create/index.js +2 -2
- package/lib/projects/create/legacy.js +2 -2
- package/lib/projects/create/v3.js +2 -2
- package/lib/projects/localDev/AppDevModeInterface.d.ts +2 -0
- package/lib/projects/localDev/AppDevModeInterface.js +22 -20
- package/lib/projects/localDev/LocalDevLogger.js +10 -11
- package/lib/projects/localDev/LocalDevManager.js +4 -5
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +0 -1
- package/lib/projects/localDev/LocalDevWebsocketServer.js +7 -10
- package/lib/projects/localDev/helpers/project.d.ts +1 -0
- package/lib/projects/localDev/helpers/project.js +37 -0
- package/lib/projects/platformVersion.d.ts +1 -1
- package/lib/projects/platformVersion.js +1 -1
- package/lib/projects/structure.js +6 -6
- package/lib/projects/upload.d.ts +1 -1
- package/lib/projects/upload.js +17 -8
- package/lib/prompts/__tests__/downloadProjectPrompt.test.js +1 -0
- package/lib/prompts/accountNamePrompt.js +14 -19
- package/lib/prompts/accountsPrompt.js +2 -2
- package/lib/prompts/cmsFieldPrompt.js +2 -2
- package/lib/prompts/createApiSamplePrompt.js +5 -5
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +10 -1
- package/lib/prompts/createFunctionPrompt.js +14 -14
- package/lib/prompts/createModulePrompt.js +9 -9
- package/lib/prompts/createTemplatePrompt.js +2 -2
- package/lib/prompts/downloadProjectPrompt.js +5 -8
- package/lib/prompts/personalAccessKeyPrompt.js +3 -3
- package/lib/prompts/previewPrompt.js +6 -6
- package/lib/prompts/projectAddPrompt.js +6 -0
- package/lib/prompts/projectDevTargetAccountPrompt.js +20 -32
- package/lib/prompts/projectNamePrompt.js +4 -8
- package/lib/prompts/projectsLogsPrompt.js +2 -4
- package/lib/prompts/promptUtils.js +27 -9
- package/lib/prompts/sandboxesPrompt.js +7 -7
- package/lib/prompts/secretPrompt.js +3 -3
- package/lib/prompts/selectAppPrompt.js +3 -3
- package/lib/prompts/selectHubDBTablePrompt.js +9 -13
- package/lib/prompts/selectPublicAppForMigrationPrompt.js +15 -19
- package/lib/prompts/setAsDefaultAccountPrompt.js +4 -8
- package/lib/prompts/uploadPrompt.js +5 -5
- package/lib/sandboxSync.js +24 -41
- package/lib/sandboxes.js +19 -47
- package/lib/schema.js +3 -3
- package/lib/serverlessLogs.js +11 -13
- package/lib/theme/__tests__/migrate.test.js +3 -3
- package/lib/theme/migrate.js +2 -2
- package/lib/ui/SpinniesManager.d.ts +2 -0
- package/lib/ui/SpinniesManager.js +7 -0
- package/lib/ui/boxen.js +1 -2
- package/lib/ui/git.js +13 -10
- package/lib/ui/index.d.ts +4 -0
- package/lib/ui/index.js +47 -38
- package/lib/ui/serverlessFunctionLogs.js +9 -7
- package/lib/ui/uiMessages.d.ts +68 -0
- package/lib/ui/uiMessages.js +71 -0
- package/lib/usageTracking.js +7 -7
- package/lib/validation.js +20 -23
- package/lib/yargsUtils.d.ts +1 -1
- package/lib/yargsUtils.js +12 -5
- package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +2 -2
- package/mcp-server/tools/index.js +4 -0
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +23 -0
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +68 -0
- package/mcp-server/tools/project/GetApplicationInfoTool.d.ts +11 -0
- package/mcp-server/tools/project/GetApplicationInfoTool.js +49 -0
- package/mcp-server/tools/project/GetConfigValuesTool.js +2 -2
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +2 -2
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.js +169 -0
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.js +115 -0
- package/mcp-server/utils/toolUsageTracking.js +2 -2
- package/package.json +7 -7
- package/ui/components/BoxWithTitle.d.ts +8 -0
- package/ui/components/BoxWithTitle.js +9 -0
- package/ui/components/HorizontalSelectPrompt.d.ts +8 -0
- package/ui/components/HorizontalSelectPrompt.js +30 -0
- package/ui/components/StatusMessageBoxes.d.ts +12 -0
- package/ui/components/StatusMessageBoxes.js +31 -0
- package/ui/index.d.ts +1 -0
- package/ui/index.js +6 -0
- package/ui/lib/ui-testing-utils.d.ts +9 -0
- package/ui/lib/ui-testing-utils.js +47 -0
- package/ui/lib/useTerminalSize.d.ts +13 -0
- package/ui/lib/useTerminalSize.js +31 -0
- package/ui/styles.d.ts +18 -0
- package/ui/styles.js +18 -0
- package/ui/views/UiSandbox.d.ts +5 -0
- package/ui/views/UiSandbox.js +25 -0
- package/lib/middleware/__test__/utils.test.js +0 -51
- package/lib/middleware/utils.d.ts +0 -8
- package/lib/middleware/utils.js +0 -14
- /package/{lib/middleware/__test__/utils.test.d.ts → commands/project/__tests__/validate.test.d.ts} +0 -0
|
@@ -2,22 +2,23 @@ import { getProjectConfig } from '../projects/config.js';
|
|
|
2
2
|
import { fetchProject } from '@hubspot/local-dev-lib/api/projects';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import pkg from '../../package.json' with { type: 'json' };
|
|
5
|
-
import {
|
|
5
|
+
import { uiLogger } from '../ui/logger.js';
|
|
6
6
|
import { getAccountId, getDefaultAccountOverrideFilePath, isConfigFlagEnabled, } from '@hubspot/local-dev-lib/config';
|
|
7
7
|
import { getAccountConfig, getConfigPath } from '@hubspot/local-dev-lib/config';
|
|
8
8
|
import { getAccessToken } from '@hubspot/local-dev-lib/personalAccessKey';
|
|
9
9
|
import { walk } from '@hubspot/local-dev-lib/fs';
|
|
10
10
|
import util from 'util';
|
|
11
11
|
import { exec as execAsync } from 'node:child_process';
|
|
12
|
+
import { CMS_ASSETS_FILE, LEGACY_PRIVATE_APP_FILE, LEGACY_PUBLIC_APP_FILE, LEGACY_SERVERLESS_FILE, PROJECT_CONFIG_FILE, THEME_FILE, } from '../constants.js';
|
|
12
13
|
// This needs to be hardcoded since we are using it in the TS type
|
|
13
14
|
const hubspotCli = '@hubspot/cli';
|
|
14
15
|
const configFiles = [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
LEGACY_SERVERLESS_FILE,
|
|
17
|
+
PROJECT_CONFIG_FILE,
|
|
18
|
+
LEGACY_PRIVATE_APP_FILE,
|
|
19
|
+
LEGACY_PUBLIC_APP_FILE,
|
|
20
|
+
THEME_FILE,
|
|
21
|
+
CMS_ASSETS_FILE,
|
|
21
22
|
];
|
|
22
23
|
export class DiagnosticInfoBuilder {
|
|
23
24
|
accountId;
|
|
@@ -89,7 +90,7 @@ export class DiagnosticInfoBuilder {
|
|
|
89
90
|
this.projectDetails = data;
|
|
90
91
|
}
|
|
91
92
|
catch (e) {
|
|
92
|
-
|
|
93
|
+
uiLogger.debug(e);
|
|
93
94
|
}
|
|
94
95
|
}
|
|
95
96
|
async fetchAccessToken() {
|
|
@@ -97,7 +98,7 @@ export class DiagnosticInfoBuilder {
|
|
|
97
98
|
this.accessToken = await getAccessToken(this.personalAccessKey, this.env, this.accountId);
|
|
98
99
|
}
|
|
99
100
|
catch (e) {
|
|
100
|
-
|
|
101
|
+
uiLogger.debug(e);
|
|
101
102
|
}
|
|
102
103
|
return this.accessToken;
|
|
103
104
|
}
|
|
@@ -109,7 +110,7 @@ export class DiagnosticInfoBuilder {
|
|
|
109
110
|
.map(filename => path.relative(this._projectConfig.projectDir, filename));
|
|
110
111
|
}
|
|
111
112
|
catch (e) {
|
|
112
|
-
|
|
113
|
+
uiLogger.debug(e);
|
|
113
114
|
}
|
|
114
115
|
}
|
|
115
116
|
async getNpmVersion() {
|
|
@@ -119,7 +120,7 @@ export class DiagnosticInfoBuilder {
|
|
|
119
120
|
return stdout.toString().trim();
|
|
120
121
|
}
|
|
121
122
|
catch (e) {
|
|
122
|
-
|
|
123
|
+
uiLogger.debug(e);
|
|
123
124
|
return null;
|
|
124
125
|
}
|
|
125
126
|
}
|
package/lib/doctor/Doctor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { uiLogger } from '../ui/logger.js';
|
|
2
2
|
import { getAccountId, getCWDAccountOverride, } from '@hubspot/local-dev-lib/config';
|
|
3
3
|
import SpinniesManager from '../ui/SpinniesManager.js';
|
|
4
4
|
import { hasMissingPackages } from '../dependencyManagement.js';
|
|
@@ -13,9 +13,8 @@ import { PORT_MANAGER_SERVER_PORT } from '@hubspot/local-dev-lib/constants/ports
|
|
|
13
13
|
import { accessTokenForPersonalAccessKey, authorizedScopesForPortalAndUser, scopesOnAccessToken, } from '@hubspot/local-dev-lib/personalAccessKey';
|
|
14
14
|
import { isSpecifiedError } from '@hubspot/local-dev-lib/errors/index';
|
|
15
15
|
import { getHubSpotWebsiteOrigin } from '@hubspot/local-dev-lib/urls';
|
|
16
|
-
import { uiCommandReference } from '../ui/index.js';
|
|
17
16
|
import pkg from '../../package.json' with { type: 'json' };
|
|
18
|
-
import {
|
|
17
|
+
import { lib } from '../../lang/en.js';
|
|
19
18
|
import { uiLink } from '../ui/index.js';
|
|
20
19
|
const minMajorNodeVersion = 18;
|
|
21
20
|
export class Doctor {
|
|
@@ -31,7 +30,7 @@ export class Doctor {
|
|
|
31
30
|
}
|
|
32
31
|
async diagnose() {
|
|
33
32
|
SpinniesManager.add('runningDiagnostics', {
|
|
34
|
-
text:
|
|
33
|
+
text: lib.doctor.runningDiagnostics,
|
|
35
34
|
});
|
|
36
35
|
this.diagnosticInfo =
|
|
37
36
|
await this.diagnosticInfoBuilder.generateDiagnosticInfo();
|
|
@@ -48,7 +47,7 @@ export class Doctor {
|
|
|
48
47
|
this.performDefaultAccountOverrideFileChecks();
|
|
49
48
|
this.performCliConfigSettingsChecks();
|
|
50
49
|
SpinniesManager.succeed('runningDiagnostics', {
|
|
51
|
-
text:
|
|
50
|
+
text: lib.doctor.diagnosticsComplete,
|
|
52
51
|
succeedColor: 'white',
|
|
53
52
|
});
|
|
54
53
|
this.diagnosticInfo.diagnosis = this.diagnosis.toString();
|
|
@@ -74,10 +73,8 @@ export class Doctor {
|
|
|
74
73
|
if (!this.diagnosticInfo?.config) {
|
|
75
74
|
this.diagnosis?.addCLIConfigSection({
|
|
76
75
|
type: 'error',
|
|
77
|
-
message:
|
|
78
|
-
secondaryMessaging:
|
|
79
|
-
command: uiCommandReference('hs init'),
|
|
80
|
-
}),
|
|
76
|
+
message: lib.doctor.diagnosis.cliConfig.noConfigFile,
|
|
77
|
+
secondaryMessaging: lib.doctor.diagnosis.cliConfig.noConfigFileSecondary('hs init'),
|
|
81
78
|
});
|
|
82
79
|
return [];
|
|
83
80
|
}
|
|
@@ -87,15 +84,11 @@ export class Doctor {
|
|
|
87
84
|
if (this.diagnosticInfo?.defaultAccountOverrideFile) {
|
|
88
85
|
this.diagnosis?.addDefaultAccountOverrideFileSection({
|
|
89
86
|
type: 'warning',
|
|
90
|
-
message:
|
|
91
|
-
defaultAccountOverrideFile: this.diagnosticInfo.defaultAccountOverrideFile,
|
|
92
|
-
}),
|
|
87
|
+
message: lib.doctor.defaultAccountOverrideFileChecks.overrideActive(this.diagnosticInfo.defaultAccountOverrideFile),
|
|
93
88
|
});
|
|
94
89
|
this.diagnosis?.addDefaultAccountOverrideFileSection({
|
|
95
90
|
type: 'warning',
|
|
96
|
-
message:
|
|
97
|
-
overrideAccountId: getCWDAccountOverride(),
|
|
98
|
-
}),
|
|
91
|
+
message: lib.doctor.defaultAccountOverrideFileChecks.overrideAccountId(getCWDAccountOverride()),
|
|
99
92
|
});
|
|
100
93
|
}
|
|
101
94
|
}
|
|
@@ -103,8 +96,8 @@ export class Doctor {
|
|
|
103
96
|
if (this.diagnosticInfo?.configSettings.httpUseLocalhost) {
|
|
104
97
|
this.diagnosis?.addCLIConfigSection({
|
|
105
98
|
type: 'warning',
|
|
106
|
-
message:
|
|
107
|
-
secondaryMessaging:
|
|
99
|
+
message: lib.doctor.diagnosis.cliConfig.settings.httpUseLocalhost,
|
|
100
|
+
secondaryMessaging: lib.doctor.diagnosis.cliConfig.settings.httpUseLocalhostSecondary,
|
|
108
101
|
});
|
|
109
102
|
}
|
|
110
103
|
}
|
|
@@ -115,25 +108,20 @@ export class Doctor {
|
|
|
115
108
|
const missingScopes = (await authorizedScopesForPortalAndUser(this.accountId)).filter((data) => data.userAuthorized && !pakScopes.has(data.scopeGroup.name));
|
|
116
109
|
this.diagnosis?.addCLIConfigSection({
|
|
117
110
|
type: 'success',
|
|
118
|
-
message:
|
|
111
|
+
message: lib.doctor.accountChecks.active,
|
|
119
112
|
});
|
|
120
|
-
const linkToPakUI = uiLink(
|
|
113
|
+
const linkToPakUI = uiLink(lib.doctor.accountChecks.pak.viewScopes, `${getHubSpotWebsiteOrigin(this.diagnosticInfoBuilder?.env || 'PROD')}/personal-access-key/${this.diagnosticInfo?.account.accountId}`);
|
|
121
114
|
if (missingScopes.length > 0) {
|
|
122
115
|
this.diagnosis?.addCLIConfigSection({
|
|
123
116
|
type: 'warning',
|
|
124
|
-
message:
|
|
125
|
-
secondaryMessaging:
|
|
126
|
-
command: uiCommandReference(`hs auth`),
|
|
127
|
-
link: linkToPakUI,
|
|
128
|
-
}),
|
|
117
|
+
message: lib.doctor.accountChecks.pak.incomplete,
|
|
118
|
+
secondaryMessaging: lib.doctor.accountChecks.pak.incompleteSecondary(linkToPakUI),
|
|
129
119
|
});
|
|
130
120
|
}
|
|
131
121
|
else {
|
|
132
122
|
this.diagnosis?.addCLIConfigSection({
|
|
133
123
|
type: 'success',
|
|
134
|
-
message:
|
|
135
|
-
link: linkToPakUI,
|
|
136
|
-
}),
|
|
124
|
+
message: lib.doctor.accountChecks.pak.valid(linkToPakUI),
|
|
137
125
|
});
|
|
138
126
|
}
|
|
139
127
|
}
|
|
@@ -151,10 +139,8 @@ export class Doctor {
|
|
|
151
139
|
if (portalNotActive) {
|
|
152
140
|
this.diagnosis?.addCLIConfigSection({
|
|
153
141
|
type: 'error',
|
|
154
|
-
message:
|
|
155
|
-
secondaryMessaging:
|
|
156
|
-
command: uiCommandReference(`hs accounts clean`),
|
|
157
|
-
}),
|
|
142
|
+
message: lib.doctor.accountChecks.inactive,
|
|
143
|
+
secondaryMessaging: lib.doctor.accountChecks.inactiveSecondary('hs accounts clean'),
|
|
158
144
|
});
|
|
159
145
|
}
|
|
160
146
|
else if (isSpecifiedError(error, {
|
|
@@ -164,20 +150,18 @@ export class Doctor {
|
|
|
164
150
|
})) {
|
|
165
151
|
this.diagnosis?.addCLIConfigSection({
|
|
166
152
|
type: 'success',
|
|
167
|
-
message:
|
|
153
|
+
message: lib.doctor.accountChecks.active,
|
|
168
154
|
});
|
|
169
155
|
this.diagnosis?.addCLIConfigSection({
|
|
170
156
|
type: 'error',
|
|
171
|
-
message:
|
|
172
|
-
secondaryMessaging:
|
|
173
|
-
command: uiCommandReference(`hs auth`),
|
|
174
|
-
}),
|
|
157
|
+
message: lib.doctor.accountChecks.pak.invalid,
|
|
158
|
+
secondaryMessaging: lib.doctor.accountChecks.pak.invalidSecondary,
|
|
175
159
|
});
|
|
176
160
|
}
|
|
177
161
|
else {
|
|
178
162
|
this.diagnosis?.addCLIConfigSection({
|
|
179
163
|
type: 'error',
|
|
180
|
-
message:
|
|
164
|
+
message: lib.doctor.accountChecks.unableToDetermine,
|
|
181
165
|
});
|
|
182
166
|
}
|
|
183
167
|
}
|
|
@@ -186,7 +170,7 @@ export class Doctor {
|
|
|
186
170
|
if (!this.diagnosticInfo?.versions.node) {
|
|
187
171
|
return this.diagnosis?.addCliSection({
|
|
188
172
|
type: 'error',
|
|
189
|
-
message:
|
|
173
|
+
message: lib.doctor.nodeChecks.unableToDetermine,
|
|
190
174
|
});
|
|
191
175
|
}
|
|
192
176
|
const nodeVersion = this.diagnosticInfo?.versions.node?.split('.');
|
|
@@ -194,16 +178,12 @@ export class Doctor {
|
|
|
194
178
|
if (!currentNodeMajor || parseInt(currentNodeMajor) < minMajorNodeVersion) {
|
|
195
179
|
return this.diagnosis?.addCliSection({
|
|
196
180
|
type: 'warning',
|
|
197
|
-
message:
|
|
198
|
-
nodeVersion: this.diagnosticInfo?.versions.node,
|
|
199
|
-
}),
|
|
181
|
+
message: lib.doctor.nodeChecks.minimumNotMet(this.diagnosticInfo?.versions.node),
|
|
200
182
|
});
|
|
201
183
|
}
|
|
202
184
|
this.diagnosis?.addCliSection({
|
|
203
185
|
type: 'success',
|
|
204
|
-
message:
|
|
205
|
-
nodeVersion: this.diagnosticInfo?.versions.node,
|
|
206
|
-
}),
|
|
186
|
+
message: lib.doctor.nodeChecks.success(this.diagnosticInfo?.versions.node),
|
|
207
187
|
});
|
|
208
188
|
}
|
|
209
189
|
async checkIfNpmIsInstalled() {
|
|
@@ -211,14 +191,12 @@ export class Doctor {
|
|
|
211
191
|
if (!npmVersion) {
|
|
212
192
|
return this.diagnosis?.addCliSection({
|
|
213
193
|
type: 'error',
|
|
214
|
-
message:
|
|
194
|
+
message: lib.doctor.npmChecks.notInstalled,
|
|
215
195
|
});
|
|
216
196
|
}
|
|
217
197
|
this.diagnosis?.addCliSection({
|
|
218
198
|
type: 'success',
|
|
219
|
-
message:
|
|
220
|
-
npmVersion,
|
|
221
|
-
}),
|
|
199
|
+
message: lib.doctor.npmChecks.installed(npmVersion),
|
|
222
200
|
});
|
|
223
201
|
}
|
|
224
202
|
async checkCLIVersion() {
|
|
@@ -232,32 +210,22 @@ export class Doctor {
|
|
|
232
210
|
catch (e) {
|
|
233
211
|
return this.diagnosis?.addCliSection({
|
|
234
212
|
type: 'error',
|
|
235
|
-
message:
|
|
236
|
-
secondaryMessaging:
|
|
237
|
-
command: uiCommandReference(`hs --version`),
|
|
238
|
-
link: uiLink(i18n(`lib.doctor.hsChecks.unableToDetermineSecondaryLink`), `https://www.npmjs.com/package/${pkg.name}?activeTab=versions`),
|
|
239
|
-
}),
|
|
213
|
+
message: lib.doctor.hsChecks.unableToDetermine,
|
|
214
|
+
secondaryMessaging: lib.doctor.hsChecks.unableToDetermineSecondary('hs --version', `https://www.npmjs.com/package/${pkg.name}?activeTab=versions`),
|
|
240
215
|
});
|
|
241
216
|
}
|
|
242
217
|
if (latestCLIVersion !== pkg.version && nextCliVersion !== pkg.version) {
|
|
243
218
|
const onNextTag = pkg.version.includes('beta');
|
|
244
219
|
this.diagnosis?.addCliSection({
|
|
245
220
|
type: 'warning',
|
|
246
|
-
message:
|
|
247
|
-
|
|
248
|
-
}),
|
|
249
|
-
secondaryMessaging: i18n(`lib.doctor.hsChecks.notLatestSecondary`, {
|
|
250
|
-
hsVersion: onNextTag ? nextCliVersion : latestCLIVersion,
|
|
251
|
-
command: uiCommandReference(`npm install -g ${pkg.name}`),
|
|
252
|
-
}),
|
|
221
|
+
message: lib.doctor.hsChecks.notLatest(pkg.version),
|
|
222
|
+
secondaryMessaging: lib.doctor.hsChecks.notLatestSecondary(`npm install -g ${pkg.name}`, onNextTag ? nextCliVersion : latestCLIVersion),
|
|
253
223
|
});
|
|
254
224
|
}
|
|
255
225
|
else {
|
|
256
226
|
this.diagnosis?.addCliSection({
|
|
257
227
|
type: 'success',
|
|
258
|
-
message:
|
|
259
|
-
hsVersion: pkg.version,
|
|
260
|
-
}),
|
|
228
|
+
message: lib.doctor.hsChecks.latest(pkg.version),
|
|
261
229
|
});
|
|
262
230
|
}
|
|
263
231
|
}
|
|
@@ -271,12 +239,8 @@ export class Doctor {
|
|
|
271
239
|
foundError = true;
|
|
272
240
|
this.diagnosis?.addProjectSection({
|
|
273
241
|
type: 'warning',
|
|
274
|
-
message:
|
|
275
|
-
|
|
276
|
-
}),
|
|
277
|
-
secondaryMessaging: i18n(`lib.doctor.projectDependenciesChecks.missingDependenciesSecondary`, {
|
|
278
|
-
command: uiCommandReference('hs project install-deps'),
|
|
279
|
-
}),
|
|
242
|
+
message: lib.doctor.projectDependenciesChecks.missingDependencies(packageDirName),
|
|
243
|
+
secondaryMessaging: lib.doctor.projectDependenciesChecks.missingDependenciesSecondary('hs project install-deps'),
|
|
280
244
|
});
|
|
281
245
|
}
|
|
282
246
|
}
|
|
@@ -285,26 +249,22 @@ export class Doctor {
|
|
|
285
249
|
if (!(await this.isValidJsonFile(packageFile))) {
|
|
286
250
|
this.diagnosis?.addProjectSection({
|
|
287
251
|
type: 'error',
|
|
288
|
-
message:
|
|
289
|
-
filename: packageFile,
|
|
290
|
-
}),
|
|
252
|
+
message: lib.doctor.files.invalidJson(packageFile),
|
|
291
253
|
});
|
|
292
254
|
}
|
|
293
255
|
else {
|
|
294
256
|
this.diagnosis?.addProjectSection({
|
|
295
257
|
type: 'error',
|
|
296
|
-
message:
|
|
297
|
-
dir: packageDirName,
|
|
298
|
-
}),
|
|
258
|
+
message: lib.doctor.projectDependenciesChecks.unableToDetermine(packageDirName),
|
|
299
259
|
});
|
|
300
260
|
}
|
|
301
|
-
|
|
261
|
+
uiLogger.debug(e instanceof Error ? e.message : String(e));
|
|
302
262
|
}
|
|
303
263
|
}
|
|
304
264
|
if (!foundError) {
|
|
305
265
|
this.diagnosis?.addProjectSection({
|
|
306
266
|
type: 'success',
|
|
307
|
-
message:
|
|
267
|
+
message: lib.doctor.projectDependenciesChecks.success,
|
|
308
268
|
});
|
|
309
269
|
}
|
|
310
270
|
}
|
|
@@ -327,16 +287,14 @@ export class Doctor {
|
|
|
327
287
|
foundError = true;
|
|
328
288
|
this.diagnosis?.addProjectSection({
|
|
329
289
|
type: 'error',
|
|
330
|
-
message:
|
|
331
|
-
filename: jsonFile,
|
|
332
|
-
}),
|
|
290
|
+
message: lib.doctor.files.invalidJson(jsonFile),
|
|
333
291
|
});
|
|
334
292
|
}
|
|
335
293
|
}
|
|
336
294
|
if (!foundError) {
|
|
337
295
|
this.diagnosis?.addProjectSection({
|
|
338
296
|
type: 'success',
|
|
339
|
-
message:
|
|
297
|
+
message: lib.doctor.files.validJson,
|
|
340
298
|
});
|
|
341
299
|
}
|
|
342
300
|
}
|
|
@@ -344,20 +302,14 @@ export class Doctor {
|
|
|
344
302
|
if (await isPortManagerPortAvailable()) {
|
|
345
303
|
this.diagnosis?.addProjectSection({
|
|
346
304
|
type: 'success',
|
|
347
|
-
message:
|
|
348
|
-
port: PORT_MANAGER_SERVER_PORT,
|
|
349
|
-
}),
|
|
305
|
+
message: lib.doctor.port.available(PORT_MANAGER_SERVER_PORT),
|
|
350
306
|
});
|
|
351
307
|
return;
|
|
352
308
|
}
|
|
353
309
|
this.diagnosis?.addProjectSection({
|
|
354
310
|
type: 'warning',
|
|
355
|
-
message:
|
|
356
|
-
|
|
357
|
-
}),
|
|
358
|
-
secondaryMessaging: i18n(`lib.doctor.port.inUseSecondary`, {
|
|
359
|
-
command: uiCommandReference('hs project dev'),
|
|
360
|
-
}),
|
|
311
|
+
message: lib.doctor.port.inUse(PORT_MANAGER_SERVER_PORT),
|
|
312
|
+
secondaryMessaging: lib.doctor.port.inUseSecondary('hs project dev'),
|
|
361
313
|
});
|
|
362
314
|
}
|
|
363
315
|
}
|
|
@@ -6,7 +6,7 @@ import { HubSpotHttpError } from '@hubspot/local-dev-lib/models/HubSpotHttpError
|
|
|
6
6
|
import { AxiosError } from 'axios';
|
|
7
7
|
import { isSpecifiedError as _isSpecifiedError } from '@hubspot/local-dev-lib/errors/index';
|
|
8
8
|
import { promisify as _promisify } from 'util';
|
|
9
|
-
vi.mock('
|
|
9
|
+
vi.mock('../../ui/logger.js');
|
|
10
10
|
vi.mock('../Diagnosis');
|
|
11
11
|
vi.mock('../../ui/SpinniesManager');
|
|
12
12
|
vi.mock('../DiagnosticInfoBuilder');
|
|
@@ -336,7 +336,7 @@ describe('lib/doctor/Doctor', () => {
|
|
|
336
336
|
// @ts-expect-error Testing private method
|
|
337
337
|
expect(doctor.diagnosis.addProjectSection).toHaveBeenCalledWith({
|
|
338
338
|
type: 'error',
|
|
339
|
-
message: expect.stringMatching(/
|
|
339
|
+
message: expect.stringMatching(/Invalid JSON in/),
|
|
340
340
|
});
|
|
341
341
|
});
|
|
342
342
|
it('should add error section if it is unable to determine if dependencies need installed', async () => {
|
|
@@ -359,7 +359,7 @@ describe('lib/doctor/Doctor', () => {
|
|
|
359
359
|
expect(doctor.diagnosis?.addProjectSection).toHaveBeenCalledWith({
|
|
360
360
|
type: 'warning',
|
|
361
361
|
message: 'Port 8080 is in use',
|
|
362
|
-
secondaryMessaging: expect.stringMatching(/Make sure it is available
|
|
362
|
+
secondaryMessaging: expect.stringMatching(/Make sure it is available before running `hs project dev`/),
|
|
363
363
|
});
|
|
364
364
|
});
|
|
365
365
|
it('should add success section if port is available', async () => {
|
|
@@ -388,7 +388,7 @@ describe('lib/doctor/Doctor', () => {
|
|
|
388
388
|
// @ts-expect-error Testing private method
|
|
389
389
|
expect(doctor.diagnosis.addProjectSection).toHaveBeenCalledWith({
|
|
390
390
|
type: 'error',
|
|
391
|
-
message: expect.stringMatching(/
|
|
391
|
+
message: expect.stringMatching(/Invalid JSON in/),
|
|
392
392
|
});
|
|
393
393
|
});
|
|
394
394
|
});
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { uiLogger } from '../ui/logger.js';
|
|
2
2
|
import { isHubSpotHttpError, isValidationError, } from '@hubspot/local-dev-lib/errors/index';
|
|
3
3
|
import { getConfig } from '@hubspot/local-dev-lib/config';
|
|
4
4
|
import { shouldSuppressError } from './suppressError.js';
|
|
5
|
-
import {
|
|
5
|
+
import { lib } from '../../lang/en.js';
|
|
6
6
|
import util from 'util';
|
|
7
|
-
import { uiCommandReference } from '../ui/index.js';
|
|
8
7
|
import { isProjectValidationError } from '../errors/ProjectValidationError.js';
|
|
9
8
|
export function logError(error, context) {
|
|
10
9
|
debugError(error, context);
|
|
11
10
|
if (isProjectValidationError(error)) {
|
|
12
|
-
|
|
11
|
+
uiLogger.error(error.message);
|
|
13
12
|
return;
|
|
14
13
|
}
|
|
15
14
|
if (shouldSuppressError(error, context)) {
|
|
@@ -24,7 +23,7 @@ export function logError(error, context) {
|
|
|
24
23
|
error.updateContext(context);
|
|
25
24
|
}
|
|
26
25
|
if (isHubSpotHttpError(error) && isValidationError(error)) {
|
|
27
|
-
|
|
26
|
+
uiLogger.error(error.formattedValidationErrors());
|
|
28
27
|
}
|
|
29
28
|
else if (isErrorWithMessageOrReason(error)) {
|
|
30
29
|
const message = [];
|
|
@@ -33,44 +32,37 @@ export function logError(error, context) {
|
|
|
33
32
|
message.push(msg);
|
|
34
33
|
}
|
|
35
34
|
});
|
|
36
|
-
|
|
35
|
+
uiLogger.error(message.join(' '));
|
|
37
36
|
}
|
|
38
37
|
else {
|
|
39
38
|
// Unknown errors
|
|
40
|
-
|
|
39
|
+
uiLogger.error(lib.errorHandlers.index.unknownErrorOccurred);
|
|
41
40
|
}
|
|
42
41
|
if (isHubSpotHttpError(error) && error.code === 'ETIMEDOUT') {
|
|
43
42
|
const config = getConfig();
|
|
44
43
|
const defaultTimeout = config?.httpTimeout;
|
|
45
44
|
// Timeout was caused by the default timeout
|
|
46
45
|
if (error.timeout && defaultTimeout === error.timeout) {
|
|
47
|
-
|
|
48
|
-
timeout: error.timeout,
|
|
49
|
-
configSetCommand: uiCommandReference('hs config set'),
|
|
50
|
-
}));
|
|
46
|
+
uiLogger.error(lib.errorHandlers.index.configTimeoutErrorOccurred(error.timeout, 'hs config set'));
|
|
51
47
|
}
|
|
52
48
|
// Timeout was caused by a custom timeout set by the CLI or LDL
|
|
53
49
|
else {
|
|
54
|
-
|
|
50
|
+
uiLogger.error(lib.errorHandlers.index.genericTimeoutErrorOccurred);
|
|
55
51
|
}
|
|
56
52
|
}
|
|
57
53
|
}
|
|
58
54
|
export function debugError(error, context) {
|
|
59
55
|
if (isHubSpotHttpError(error)) {
|
|
60
|
-
|
|
56
|
+
uiLogger.debug(error.toString());
|
|
61
57
|
}
|
|
62
58
|
else {
|
|
63
|
-
|
|
59
|
+
uiLogger.debug(lib.errorHandlers.index.errorOccurred(String(error)));
|
|
64
60
|
}
|
|
65
61
|
if (error instanceof Error && error.cause && !isHubSpotHttpError(error)) {
|
|
66
|
-
|
|
67
|
-
cause: util.inspect(error.cause, false, null, true),
|
|
68
|
-
}));
|
|
62
|
+
uiLogger.debug(lib.errorHandlers.index.errorCause(util.inspect(error.cause, false, null, true)));
|
|
69
63
|
}
|
|
70
64
|
if (context) {
|
|
71
|
-
|
|
72
|
-
context: util.inspect(context, false, null, true),
|
|
73
|
-
}));
|
|
65
|
+
uiLogger.debug(lib.errorHandlers.index.errorContext(util.inspect(context, false, null, true)));
|
|
74
66
|
}
|
|
75
67
|
}
|
|
76
68
|
export class ApiErrorContext {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isSpecifiedError, isMissingScopeError, } from '@hubspot/local-dev-lib/errors/index';
|
|
2
|
-
import {
|
|
2
|
+
import { uiLogger } from '../ui/logger.js';
|
|
3
3
|
import { PLATFORM_VERSION_ERROR_TYPES } from '../constants.js';
|
|
4
|
-
import {
|
|
5
|
-
import { uiAccountDescription, uiLine, uiLink
|
|
4
|
+
import { lib } from '../../lang/en.js';
|
|
5
|
+
import { uiAccountDescription, uiLine, uiLink } from '../ui/index.js';
|
|
6
6
|
function createPlatformVersionError(err, subCategory) {
|
|
7
7
|
let translationKey = 'unspecifiedPlatformVersion';
|
|
8
8
|
let platformVersion = 'unspecified platformVersion';
|
|
@@ -17,25 +17,18 @@ function createPlatformVersionError(err, subCategory) {
|
|
|
17
17
|
translationKey = 'nonExistentPlatformVersion';
|
|
18
18
|
}
|
|
19
19
|
uiLine();
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}));
|
|
20
|
+
uiLogger.error(lib.errorHandlers.suppressErrors.platformVersionErrors.header);
|
|
21
|
+
const errorMessage = lib.errorHandlers.suppressErrors.platformVersionErrors[translationKey];
|
|
22
|
+
uiLogger.log(typeof errorMessage === 'function'
|
|
23
|
+
? errorMessage(platformVersion)
|
|
24
|
+
: errorMessage);
|
|
25
|
+
uiLogger.log(lib.errorHandlers.suppressErrors.platformVersionErrors.updateProject);
|
|
26
|
+
uiLogger.log(lib.errorHandlers.suppressErrors.platformVersionErrors.betaLink(uiLink(lib.errorHandlers.suppressErrors.platformVersionErrors.docsLink, 'https://developers.hubspot.com/docs/developer-tooling/platform/versioning')));
|
|
28
27
|
uiLine();
|
|
29
28
|
}
|
|
30
29
|
export function shouldSuppressError(err, context) {
|
|
31
30
|
if (isMissingScopeError(err)) {
|
|
32
|
-
|
|
33
|
-
accountName: context?.accountId
|
|
34
|
-
? uiAccountDescription(context.accountId)
|
|
35
|
-
: '',
|
|
36
|
-
request: context?.request || 'request',
|
|
37
|
-
authCommand: uiCommandReference('hs auth'),
|
|
38
|
-
}));
|
|
31
|
+
uiLogger.error(lib.errorHandlers.suppressErrors.missingScopeError(context?.request || 'request', context?.accountId ? uiAccountDescription(context.accountId) : ''));
|
|
39
32
|
return true;
|
|
40
33
|
}
|
|
41
34
|
if (isSpecifiedError(err, {
|
package/lib/lang.js
CHANGED
|
@@ -2,7 +2,7 @@ import util from 'util';
|
|
|
2
2
|
import path, { dirname } from 'path';
|
|
3
3
|
import fs from 'fs-extra';
|
|
4
4
|
import yaml from 'js-yaml';
|
|
5
|
-
import {
|
|
5
|
+
import { uiLogger } from './ui/logger.js';
|
|
6
6
|
import { interpolate } from './interpolation.js';
|
|
7
7
|
import { fileURLToPath } from 'url';
|
|
8
8
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -22,10 +22,11 @@ function loadLanguageFromYaml() {
|
|
|
22
22
|
// Fall back to using the default language file
|
|
23
23
|
locale = languageFileExists ? nodeLocale : 'en';
|
|
24
24
|
languageObj = yaml.load(fs.readFileSync(path.join(__dirname, `../lang/${locale}.lyaml`), 'utf8'));
|
|
25
|
-
|
|
25
|
+
uiLogger.debug('Loaded language data: ' + util.inspect(languageObj, true, 999, true));
|
|
26
26
|
}
|
|
27
27
|
catch (e) {
|
|
28
|
-
|
|
28
|
+
uiLogger.error('Error loading language data: ' +
|
|
29
|
+
(e instanceof Error ? e.message : String(e)));
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
function getTextValue(lookupDotNotation) {
|
|
@@ -42,8 +43,8 @@ function getTextValue(lookupDotNotation) {
|
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
45
|
catch (e) {
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
uiLogger.debug(`Unable to access language property: ${lookupProps.join('.')}. Failed to access prop "${previouslyCheckedProp}".`);
|
|
47
|
+
uiLogger.error('Unable to access language property.');
|
|
47
48
|
return missingTextData;
|
|
48
49
|
}
|
|
49
50
|
if (!textValue) {
|
package/lib/links.js
CHANGED
|
@@ -2,7 +2,7 @@ import open from 'open';
|
|
|
2
2
|
import { getEnv } from '@hubspot/local-dev-lib/config';
|
|
3
3
|
import { ENVIRONMENTS } from '@hubspot/local-dev-lib/constants/environments';
|
|
4
4
|
import { getHubSpotWebsiteOrigin } from '@hubspot/local-dev-lib/urls';
|
|
5
|
-
import {
|
|
5
|
+
import { uiLogger } from './ui/logger.js';
|
|
6
6
|
import { getTableContents, getTableHeader } from './ui/table.js';
|
|
7
7
|
const COMMON_SITE_LINKS = {
|
|
8
8
|
APPS_MARKETPLACE: {
|
|
@@ -87,17 +87,17 @@ export function logSiteLinks(accountId) {
|
|
|
87
87
|
l.url,
|
|
88
88
|
]);
|
|
89
89
|
linksAsArray.unshift(getTableHeader(['Shortcut', '', 'Url']));
|
|
90
|
-
|
|
90
|
+
uiLogger.log(getTableContents(linksAsArray));
|
|
91
91
|
}
|
|
92
92
|
export function openLink(accountId, shortcut) {
|
|
93
93
|
const match = Object.values(COMMON_SITE_LINKS).find(l => l.shortcut === shortcut || (l.alias && l.alias === shortcut));
|
|
94
94
|
if (!match) {
|
|
95
|
-
|
|
95
|
+
uiLogger.error(`We couldn't find a shortcut matching ${shortcut}. Type 'hs open list' to see a list of available shortcuts`);
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
98
|
const baseUrl = getHubSpotWebsiteOrigin(getEnv() === 'qa' ? ENVIRONMENTS.QA : ENVIRONMENTS.PROD);
|
|
99
99
|
open(match.getUrl(accountId, baseUrl), { url: true });
|
|
100
|
-
|
|
100
|
+
uiLogger.success(`We opened ${match.getUrl(accountId, baseUrl)} in your browser`);
|
|
101
101
|
}
|
|
102
102
|
export function getProductUpdatesUrl(rolloutId, accountId) {
|
|
103
103
|
const baseUrl = getHubSpotWebsiteOrigin(getEnv() === 'qa' ? ENVIRONMENTS.QA : ENVIRONMENTS.PROD);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|