@hubspot/cli 7.7.35-experimental.0 → 7.8.0-beta.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/bin/cli.js +31 -25
- package/commands/__tests__/auth.test.js +5 -0
- package/commands/__tests__/doctor.test.js +16 -16
- package/commands/__tests__/getStarted.test.js +2 -2
- package/commands/__tests__/mcp.test.js +1 -1
- package/commands/__tests__/project.test.js +0 -3
- 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 -6
- package/commands/app/migrate.js +13 -19
- package/commands/app/secret/add.js +2 -1
- package/commands/app/secret/delete.js +2 -1
- package/commands/app/secret/list.js +2 -1
- package/commands/app/secret/update.js +2 -1
- package/commands/app/secret.js +2 -1
- package/commands/app.js +2 -2
- 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 -37
- 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 +7 -12
- 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.d.ts +0 -2
- package/commands/getStarted.js +4 -4
- 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/mcp/__tests__/setup.test.js +2 -2
- package/commands/mcp/setup.js +11 -2
- package/commands/mcp.js +3 -3
- 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__/create.test.js +6 -6
- package/commands/project/__tests__/deploy.test.js +3 -7
- package/commands/project/__tests__/devUnifiedFlow.test.js +2 -4
- package/commands/project/__tests__/installDeps.test.js +8 -8
- package/commands/project/__tests__/logs.test.js +1 -4
- package/commands/project/__tests__/migrate.test.js +6 -7
- package/commands/project/__tests__/migrateApp.test.js +3 -7
- package/commands/project/__tests__/profile.test.js +1 -1
- package/commands/project/__tests__/validate.test.js +98 -0
- package/commands/project/add.js +4 -8
- package/commands/project/cloneApp.js +14 -19
- package/commands/project/create.js +2 -9
- package/commands/project/deploy.js +5 -5
- package/commands/project/dev/deprecatedFlow.js +7 -16
- package/commands/project/dev/index.js +16 -13
- package/commands/project/dev/unifiedFlow.js +8 -4
- package/commands/project/download.js +10 -14
- package/commands/project/installDeps.js +8 -9
- package/commands/project/listBuilds.js +12 -21
- package/commands/project/logs.js +21 -24
- package/commands/project/migrate.js +41 -13
- package/commands/project/migrateApp.js +10 -17
- package/commands/project/open.js +6 -14
- package/commands/project/profile/add.js +3 -3
- package/commands/project/profile/delete.js +1 -2
- package/commands/project/profile.js +2 -3
- package/commands/project/upload.js +16 -25
- package/commands/project/validate.js +7 -7
- package/commands/project/watch.js +13 -22
- package/commands/project.js +2 -3
- package/commands/sandbox/__tests__/create.test.js +5 -5
- package/commands/sandbox/create.js +22 -32
- package/commands/sandbox/delete.js +35 -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/testAccount/importData.d.ts +1 -1
- package/commands/testAccount/importData.js +1 -1
- package/commands/testAccount.js +1 -1
- package/lang/en.d.ts +317 -98
- package/lang/en.js +312 -96
- 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 +19 -56
- package/lib/app/__tests__/migrate_legacy.test.js +1 -1
- package/lib/app/migrate.d.ts +2 -8
- package/lib/app/migrate.js +5 -80
- 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 +13 -0
- package/lib/constants.js +17 -0
- 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 +10 -17
- package/lib/lang.js +6 -5
- package/lib/links.d.ts +1 -0
- package/lib/links.js +14 -7
- package/lib/mcp/setup.js +1 -1
- 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 -5
- 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 +2 -0
- package/lib/projects/__tests__/LocalDevProcess.test.js +227 -16
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +86 -60
- package/lib/projects/__tests__/deploy.test.js +71 -6
- package/lib/projects/__tests__/localDevProjectHelpers.test.js +6 -2
- 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 +80 -5
- package/lib/projects/create/index.js +2 -2
- package/lib/projects/create/legacy.js +2 -2
- package/lib/projects/create/v3.js +10 -8
- package/lib/projects/localDev/AppDevModeInterface.d.ts +2 -0
- package/lib/projects/localDev/AppDevModeInterface.js +21 -12
- package/lib/projects/localDev/LocalDevLogger.d.ts +4 -0
- package/lib/projects/localDev/LocalDevLogger.js +27 -6
- package/lib/projects/localDev/LocalDevManager.js +4 -5
- package/lib/projects/localDev/LocalDevProcess.d.ts +7 -5
- package/lib/projects/localDev/LocalDevProcess.js +90 -19
- package/lib/projects/localDev/LocalDevState.d.ts +9 -8
- package/lib/projects/localDev/LocalDevState.js +18 -17
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +2 -1
- package/lib/projects/localDev/LocalDevWebsocketServer.js +62 -33
- package/lib/projects/localDev/helpers/project.d.ts +1 -0
- package/lib/projects/localDev/helpers/project.js +42 -1
- package/lib/projects/localDev/localDevWebsocketServerUtils.d.ts +4 -0
- package/lib/projects/localDev/localDevWebsocketServerUtils.js +10 -0
- package/lib/projects/platformVersion.d.ts +1 -1
- package/lib/projects/platformVersion.js +1 -1
- package/lib/projects/pollProjectBuildAndDeploy.js +4 -4
- 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/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 +8 -1
- 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 +30 -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/selectProjectTemplatePrompt.js +2 -0
- 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.d.ts +1 -0
- package/lib/theme/__tests__/migrate.test.js +233 -0
- package/lib/theme/migrate.d.ts +13 -0
- package/lib/theme/migrate.js +90 -0
- 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.js +38 -37
- 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 +8 -8
- 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/AddFeatureToProjectTool.d.ts +2 -2
- package/mcp-server/tools/project/CreateProjectTool.d.ts +2 -2
- package/mcp-server/tools/project/DocsSearchTool.d.ts +4 -1
- package/mcp-server/tools/project/DocsSearchTool.js +5 -5
- 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.d.ts +4 -1
- package/mcp-server/tools/project/GetConfigValuesTool.js +12 -6
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +2 -2
- package/mcp-server/tools/project/__tests__/DocsSearchTool.test.js +12 -10
- 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/tools/project/__tests__/GetConfigValuesTool.test.js +8 -7
- package/mcp-server/utils/__tests__/cliConfig.test.d.ts +1 -0
- package/mcp-server/utils/__tests__/cliConfig.test.js +110 -0
- package/mcp-server/utils/cliConfig.d.ts +1 -0
- package/mcp-server/utils/cliConfig.js +12 -0
- package/mcp-server/utils/toolUsageTracking.js +2 -2
- package/package.json +4 -4
- package/types/LocalDev.d.ts +19 -3
- package/ui/index.js +1 -1
- 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
package/lib/constants.d.ts
CHANGED
|
@@ -82,17 +82,24 @@ export declare const FEATURES: {
|
|
|
82
82
|
readonly SANDBOXES_V2_CLI: "sandboxes:v2:cliEnabled";
|
|
83
83
|
readonly APP_EVENTS: "Developers:UnifiedApps:AppEventsAccess";
|
|
84
84
|
readonly APPS_HOME: "UIE:AppHome";
|
|
85
|
+
readonly MCP_ACCESS: "Developers:CLIMCPAccess";
|
|
86
|
+
readonly THEME_MIGRATION_2025_2: "Developers:ProjectThemeMigrations:2025.2";
|
|
87
|
+
readonly AGENT_TOOLS: "ThirdPartyAgentTools";
|
|
85
88
|
};
|
|
86
89
|
export declare const LOCAL_DEV_UI_MESSAGE_SEND_TYPES: {
|
|
87
90
|
UPLOAD_SUCCESS: string;
|
|
88
91
|
UPLOAD_FAILURE: string;
|
|
92
|
+
DEPLOY_SUCCESS: string;
|
|
93
|
+
DEPLOY_FAILURE: string;
|
|
89
94
|
UPDATE_PROJECT_NODES: string;
|
|
90
95
|
UPDATE_APP_DATA: string;
|
|
91
96
|
UPDATE_PROJECT_DATA: string;
|
|
92
97
|
UPDATE_UPLOAD_WARNINGS: string;
|
|
98
|
+
CLI_METADATA: string;
|
|
93
99
|
};
|
|
94
100
|
export declare const LOCAL_DEV_UI_MESSAGE_RECEIVE_TYPES: {
|
|
95
101
|
UPLOAD: string;
|
|
102
|
+
DEPLOY: string;
|
|
96
103
|
VIEWED_WELCOME_SCREEN: string;
|
|
97
104
|
};
|
|
98
105
|
export declare const APP_INSTALLATION_STATES: {
|
|
@@ -118,3 +125,9 @@ export declare const CONFIG_LOCAL_STATE_FLAGS: {
|
|
|
118
125
|
};
|
|
119
126
|
export declare const EMPTY_PROJECT = "empty";
|
|
120
127
|
export declare const PROJECT_WITH_APP = "app";
|
|
128
|
+
export declare const LEGACY_SERVERLESS_FILE = "serverless.json";
|
|
129
|
+
export declare const LEGACY_PUBLIC_APP_FILE = "public-app.json";
|
|
130
|
+
export declare const LEGACY_PRIVATE_APP_FILE = "app.json";
|
|
131
|
+
export declare const THEME_FILE = "theme.json";
|
|
132
|
+
export declare const CMS_ASSETS_FILE = "cms-assets.json";
|
|
133
|
+
export declare const LEGACY_CONFIG_FILES: string[];
|
package/lib/constants.js
CHANGED
|
@@ -74,17 +74,24 @@ export const FEATURES = {
|
|
|
74
74
|
SANDBOXES_V2_CLI: 'sandboxes:v2:cliEnabled',
|
|
75
75
|
APP_EVENTS: 'Developers:UnifiedApps:AppEventsAccess',
|
|
76
76
|
APPS_HOME: 'UIE:AppHome',
|
|
77
|
+
MCP_ACCESS: 'Developers:CLIMCPAccess',
|
|
78
|
+
THEME_MIGRATION_2025_2: 'Developers:ProjectThemeMigrations:2025.2',
|
|
79
|
+
AGENT_TOOLS: 'ThirdPartyAgentTools',
|
|
77
80
|
};
|
|
78
81
|
export const LOCAL_DEV_UI_MESSAGE_SEND_TYPES = {
|
|
79
82
|
UPLOAD_SUCCESS: 'server:uploadSuccess',
|
|
80
83
|
UPLOAD_FAILURE: 'server:uploadFailure',
|
|
84
|
+
DEPLOY_SUCCESS: 'server:deploySuccess',
|
|
85
|
+
DEPLOY_FAILURE: 'server:deployFailure',
|
|
81
86
|
UPDATE_PROJECT_NODES: 'server:updateProjectNodes',
|
|
82
87
|
UPDATE_APP_DATA: 'server:updateAppData',
|
|
83
88
|
UPDATE_PROJECT_DATA: 'server:updateProjectData',
|
|
84
89
|
UPDATE_UPLOAD_WARNINGS: 'server:updateUploadWarnings',
|
|
90
|
+
CLI_METADATA: 'server:cliMetadata',
|
|
85
91
|
};
|
|
86
92
|
export const LOCAL_DEV_UI_MESSAGE_RECEIVE_TYPES = {
|
|
87
93
|
UPLOAD: 'client:upload',
|
|
94
|
+
DEPLOY: 'client:deploy',
|
|
88
95
|
VIEWED_WELCOME_SCREEN: 'client:viewedWelcomeScreen',
|
|
89
96
|
};
|
|
90
97
|
export const APP_INSTALLATION_STATES = {
|
|
@@ -110,3 +117,13 @@ export const CONFIG_LOCAL_STATE_FLAGS = {
|
|
|
110
117
|
};
|
|
111
118
|
export const EMPTY_PROJECT = 'empty';
|
|
112
119
|
export const PROJECT_WITH_APP = 'app';
|
|
120
|
+
export const LEGACY_SERVERLESS_FILE = 'serverless.json';
|
|
121
|
+
export const LEGACY_PUBLIC_APP_FILE = 'public-app.json';
|
|
122
|
+
export const LEGACY_PRIVATE_APP_FILE = 'app.json';
|
|
123
|
+
export const THEME_FILE = 'theme.json';
|
|
124
|
+
export const CMS_ASSETS_FILE = 'cms-assets.json';
|
|
125
|
+
export const LEGACY_CONFIG_FILES = [
|
|
126
|
+
LEGACY_SERVERLESS_FILE,
|
|
127
|
+
LEGACY_PRIVATE_APP_FILE,
|
|
128
|
+
LEGACY_PUBLIC_APP_FILE,
|
|
129
|
+
];
|
|
@@ -4,16 +4,12 @@ import path from 'path';
|
|
|
4
4
|
import { exec as execAsync } from 'node:child_process';
|
|
5
5
|
import { walk } from '@hubspot/local-dev-lib/fs';
|
|
6
6
|
import { getProjectConfig } from './projects/config.js';
|
|
7
|
-
import {
|
|
8
|
-
import { i18n } from './lang.js';
|
|
7
|
+
import { commands } from '../lang/en.js';
|
|
9
8
|
import SpinniesManager from './ui/SpinniesManager.js';
|
|
10
9
|
import { isGloballyInstalled, executeInstall, DEFAULT_PACKAGE_MANAGER, } from './npm.js';
|
|
11
10
|
class NoPackageJsonFilesError extends Error {
|
|
12
11
|
constructor(projectName) {
|
|
13
|
-
super(
|
|
14
|
-
projectName,
|
|
15
|
-
link: uiLink('Learn how to create a project from scratch.', 'https://developers.hubspot.com/beta-docs/guides/crm/intro/create-a-project'),
|
|
16
|
-
}));
|
|
12
|
+
super(commands.project.installDeps.noPackageJsonInProject(projectName));
|
|
17
13
|
}
|
|
18
14
|
}
|
|
19
15
|
export async function installPackages({ packages, installLocations, }) {
|
|
@@ -28,31 +24,20 @@ async function installPackagesInDirectory(directory, packages) {
|
|
|
28
24
|
SpinniesManager.init();
|
|
29
25
|
SpinniesManager.add(spinner, {
|
|
30
26
|
text: packages && packages.length
|
|
31
|
-
?
|
|
32
|
-
|
|
33
|
-
directory: relativeDir,
|
|
34
|
-
})
|
|
35
|
-
: i18n(`commands.project.subcommands.installDeps.installingDependencies`, {
|
|
36
|
-
directory: relativeDir,
|
|
37
|
-
}),
|
|
27
|
+
? commands.project.installDeps.addingDependenciesToLocation(`[${packages.join(', ')}]`, relativeDir)
|
|
28
|
+
: commands.project.installDeps.installingDependencies(relativeDir),
|
|
38
29
|
});
|
|
39
30
|
try {
|
|
40
31
|
await executeInstall(packages, null, { cwd: directory });
|
|
41
32
|
SpinniesManager.succeed(spinner, {
|
|
42
|
-
text:
|
|
43
|
-
directory: relativeDir,
|
|
44
|
-
}),
|
|
33
|
+
text: commands.project.installDeps.installationSuccessful(relativeDir),
|
|
45
34
|
});
|
|
46
35
|
}
|
|
47
36
|
catch (e) {
|
|
48
37
|
SpinniesManager.fail(spinner, {
|
|
49
|
-
text:
|
|
50
|
-
directory: relativeDir,
|
|
51
|
-
}),
|
|
38
|
+
text: commands.project.installDeps.installingDependenciesFailed(relativeDir),
|
|
52
39
|
});
|
|
53
|
-
throw new Error(
|
|
54
|
-
directory: relativeDir,
|
|
55
|
-
}), {
|
|
40
|
+
throw new Error(commands.project.installDeps.installingDependenciesFailed(relativeDir), {
|
|
56
41
|
cause: e,
|
|
57
42
|
});
|
|
58
43
|
}
|
|
@@ -62,14 +47,11 @@ export async function getProjectPackageJsonLocations(dir) {
|
|
|
62
47
|
if (!projectConfig ||
|
|
63
48
|
!projectConfig.projectDir ||
|
|
64
49
|
!projectConfig.projectConfig) {
|
|
65
|
-
throw new Error(
|
|
50
|
+
throw new Error(commands.project.installDeps.noProjectConfig);
|
|
66
51
|
}
|
|
67
52
|
const { projectDir, projectConfig: { srcDir, name }, } = projectConfig;
|
|
68
53
|
if (!(await isGloballyInstalled(DEFAULT_PACKAGE_MANAGER))) {
|
|
69
|
-
throw new Error(
|
|
70
|
-
packageManager: DEFAULT_PACKAGE_MANAGER,
|
|
71
|
-
link: uiLink(DEFAULT_PACKAGE_MANAGER, 'https://docs.npmjs.com/downloading-and-installing-node-js-and-npm'),
|
|
72
|
-
}));
|
|
54
|
+
throw new Error(commands.project.installDeps.packageManagerNotInstalled(DEFAULT_PACKAGE_MANAGER));
|
|
73
55
|
}
|
|
74
56
|
if (!fs.existsSync(projectConfig.projectDir) ||
|
|
75
57
|
!fs.existsSync(path.join(projectDir, srcDir))) {
|
|
@@ -3,9 +3,9 @@ import { getAccountId, getConfigAccounts } from '@hubspot/local-dev-lib/config';
|
|
|
3
3
|
import { getAccountIdentifier } from '@hubspot/local-dev-lib/config/getAccountIdentifier';
|
|
4
4
|
import { fetchDeveloperTestAccounts } from '@hubspot/local-dev-lib/api/developerTestAccounts';
|
|
5
5
|
import { isMissingScopeError, isSpecifiedError, } from '@hubspot/local-dev-lib/errors/index';
|
|
6
|
-
import {
|
|
6
|
+
import { uiLogger } from './ui/logger.js';
|
|
7
7
|
import { getHubSpotWebsiteOrigin } from '@hubspot/local-dev-lib/urls';
|
|
8
|
-
import {
|
|
8
|
+
import { lib } from '../lang/en.js';
|
|
9
9
|
import { uiAccountDescription } from './ui/index.js';
|
|
10
10
|
import { logError } from './errorHandlers/index.js';
|
|
11
11
|
export function getHasDevTestAccounts(appDeveloperAccountConfig) {
|
|
@@ -39,42 +39,28 @@ export async function validateDevTestAccountUsageLimits(accountConfig) {
|
|
|
39
39
|
if (count >= limit) {
|
|
40
40
|
const hasDevTestAccounts = getHasDevTestAccounts(accountConfig);
|
|
41
41
|
if (hasDevTestAccounts) {
|
|
42
|
-
throw new Error(
|
|
43
|
-
accountName: accountConfig.name || accountId,
|
|
44
|
-
limit,
|
|
45
|
-
}));
|
|
42
|
+
throw new Error(lib.developerTestAccount.create.failure.alreadyInConfig(accountConfig.name || accountId, limit));
|
|
46
43
|
}
|
|
47
44
|
else {
|
|
48
|
-
throw new Error(
|
|
49
|
-
accountName: accountConfig.name || accountId,
|
|
50
|
-
limit,
|
|
51
|
-
}));
|
|
45
|
+
throw new Error(lib.developerTestAccount.create.failure.limit(accountConfig.name || accountId, limit));
|
|
52
46
|
}
|
|
53
47
|
}
|
|
54
48
|
return data;
|
|
55
49
|
}
|
|
56
50
|
export function handleDeveloperTestAccountCreateError(err, accountId, env, portalLimit) {
|
|
57
51
|
if (isMissingScopeError(err)) {
|
|
58
|
-
|
|
59
|
-
accountName: uiAccountDescription(accountId),
|
|
60
|
-
}));
|
|
52
|
+
uiLogger.error(lib.developerTestAccount.create.failure.scopes.message);
|
|
61
53
|
const websiteOrigin = getHubSpotWebsiteOrigin(env);
|
|
62
54
|
const url = `${websiteOrigin}/personal-access-key/${accountId}`;
|
|
63
|
-
|
|
64
|
-
accountName: uiAccountDescription(accountId),
|
|
65
|
-
url,
|
|
66
|
-
}));
|
|
55
|
+
uiLogger.info(lib.developerTestAccount.create.failure.scopes.instructions(uiAccountDescription(accountId), url));
|
|
67
56
|
}
|
|
68
57
|
else if (isSpecifiedError(err, {
|
|
69
58
|
statusCode: 400,
|
|
70
59
|
errorType: 'TEST_PORTAL_LIMIT_REACHED',
|
|
71
60
|
})) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
limit: portalLimit,
|
|
76
|
-
}));
|
|
77
|
-
logger.log('');
|
|
61
|
+
uiLogger.log('');
|
|
62
|
+
uiLogger.error(lib.developerTestAccount.create.failure.limit(uiAccountDescription(accountId), portalLimit));
|
|
63
|
+
uiLogger.log('');
|
|
78
64
|
}
|
|
79
65
|
else {
|
|
80
66
|
logError(err);
|
package/lib/doctor/Diagnosis.js
CHANGED
|
@@ -3,7 +3,7 @@ import chalk from 'chalk';
|
|
|
3
3
|
import { helpers } from '../interpolation.js';
|
|
4
4
|
import { uiAccountDescription } from '../ui/index.js';
|
|
5
5
|
import { indent } from '../ui/index.js';
|
|
6
|
-
import {
|
|
6
|
+
import { lib } from '../../lang/en.js';
|
|
7
7
|
export class Diagnosis {
|
|
8
8
|
prefixes;
|
|
9
9
|
diagnosis;
|
|
@@ -18,38 +18,30 @@ export class Diagnosis {
|
|
|
18
18
|
};
|
|
19
19
|
this.diagnosis = {
|
|
20
20
|
cli: {
|
|
21
|
-
header:
|
|
21
|
+
header: lib.doctor.diagnosis.cli.header,
|
|
22
22
|
sections: [],
|
|
23
23
|
},
|
|
24
24
|
cliConfig: {
|
|
25
|
-
header:
|
|
25
|
+
header: lib.doctor.diagnosis.cliConfig.header,
|
|
26
26
|
sections: [],
|
|
27
27
|
},
|
|
28
28
|
defaultAccountOverrideFile: {
|
|
29
|
-
header:
|
|
29
|
+
header: lib.doctor.diagnosis.defaultAccountOverrideFile.header,
|
|
30
30
|
sections: [],
|
|
31
31
|
},
|
|
32
32
|
project: {
|
|
33
|
-
header:
|
|
33
|
+
header: lib.doctor.diagnosis.projectConfig.header,
|
|
34
34
|
subheaders: [
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}),
|
|
38
|
-
i18n(`lib.doctor.diagnosis.projectConfig.projectNameSubHeader`, {
|
|
39
|
-
projectName: diagnosticInfo.project?.config?.projectConfig?.name,
|
|
40
|
-
}),
|
|
35
|
+
lib.doctor.diagnosis.projectConfig.projectDirSubHeader(diagnosticInfo.project?.config?.projectDir || ''),
|
|
36
|
+
lib.doctor.diagnosis.projectConfig.projectNameSubHeader(diagnosticInfo.project?.config?.projectConfig?.name || ''),
|
|
41
37
|
],
|
|
42
38
|
sections: [],
|
|
43
39
|
},
|
|
44
40
|
};
|
|
45
41
|
if (diagnosticInfo.config) {
|
|
46
42
|
this.diagnosis.cliConfig.subheaders = [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}),
|
|
50
|
-
i18n(`lib.doctor.diagnosis.cliConfig.defaultAccountSubHeader`, {
|
|
51
|
-
accountDetails: uiAccountDescription(accountId),
|
|
52
|
-
}),
|
|
43
|
+
lib.doctor.diagnosis.cliConfig.configFileSubHeader(diagnosticInfo.config),
|
|
44
|
+
lib.doctor.diagnosis.cliConfig.defaultAccountSubHeader(uiAccountDescription(accountId)),
|
|
53
45
|
];
|
|
54
46
|
}
|
|
55
47
|
}
|
|
@@ -83,12 +75,8 @@ export class Diagnosis {
|
|
|
83
75
|
return '';
|
|
84
76
|
}
|
|
85
77
|
output.push('');
|
|
86
|
-
output.push(
|
|
87
|
-
|
|
88
|
-
}));
|
|
89
|
-
output.push(i18n(`lib.doctor.diagnosis.counts.warnings`, {
|
|
90
|
-
count: this.warningCount,
|
|
91
|
-
}));
|
|
78
|
+
output.push(lib.doctor.diagnosis.counts.errors(this.errorCount));
|
|
79
|
+
output.push(lib.doctor.diagnosis.counts.warnings(this.warningCount));
|
|
92
80
|
output.push('');
|
|
93
81
|
return output.join('\n');
|
|
94
82
|
}
|
|
@@ -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('hs auth', 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('hs auth'),
|
|
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
|
}
|