@hubspot/cli 7.10.0 → 7.11.0-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/bin/cli.js +5 -4
- package/commands/__tests__/getStarted.test.js +10 -0
- package/commands/__tests__/project.test.js +3 -0
- package/commands/account/__tests__/rename.test.js +10 -3
- package/commands/account/auth.js +10 -14
- package/commands/account/clean.js +11 -19
- package/commands/account/createOverride.js +15 -11
- package/commands/account/info.js +8 -5
- package/commands/account/list.js +15 -19
- package/commands/account/remove.js +23 -22
- package/commands/account/removeOverride.js +6 -6
- package/commands/account/rename.js +2 -2
- package/commands/account/use.js +19 -8
- package/commands/app/__tests__/migrate.test.js +8 -4
- package/commands/app/migrate.js +2 -2
- package/commands/auth.js +18 -14
- package/commands/config/migrate.js +5 -5
- package/commands/customObject/createSchema.js +2 -3
- package/commands/customObject/updateSchema.js +2 -3
- package/commands/getStarted.js +2 -3
- package/commands/hubdb/__tests__/list.test.js +1 -0
- package/commands/hubdb/list.js +2 -2
- package/commands/init.js +36 -32
- package/commands/project/__tests__/deploy.test.js +15 -10
- package/commands/project/__tests__/devUnifiedFlow.test.js +6 -4
- package/commands/project/__tests__/lint.test.js +709 -0
- package/commands/project/__tests__/logs.test.js +4 -0
- package/commands/project/__tests__/validate.test.js +2 -2
- package/commands/project/cloneApp.js +2 -2
- package/commands/project/create.js +20 -14
- package/commands/project/deploy.js +2 -2
- package/commands/project/dev/deprecatedFlow.js +4 -5
- package/commands/project/dev/index.js +6 -3
- package/commands/project/dev/unifiedFlow.js +11 -6
- package/commands/project/lint.d.ts +6 -0
- package/commands/project/lint.js +178 -0
- package/commands/project/logs.js +2 -3
- package/commands/project/migrate.js +4 -13
- package/commands/project/profile/add.js +6 -7
- package/commands/project/profile/delete.js +2 -2
- package/commands/project/upload.js +2 -2
- package/commands/project/validate.js +2 -2
- package/commands/project.js +2 -0
- package/commands/sandbox/__tests__/create.test.js +14 -5
- package/commands/sandbox/create.js +4 -5
- package/commands/sandbox/delete.js +23 -20
- package/commands/testAccount/create.js +2 -2
- package/commands/testAccount/delete.js +9 -8
- package/lang/en.d.ts +53 -12
- package/lang/en.js +63 -16
- package/lib/__tests__/buildAccount.test.js +22 -30
- package/lib/__tests__/commonOpts.test.js +9 -13
- package/lib/__tests__/developerTestAccounts.test.js +29 -17
- package/lib/__tests__/importData.test.js +20 -10
- package/lib/__tests__/oauth.test.js +19 -8
- package/lib/__tests__/sandboxSync.test.js +33 -11
- package/lib/__tests__/sandboxes.test.js +30 -19
- package/lib/__tests__/usageTracking.test.js +10 -10
- package/lib/__tests__/validation.test.js +32 -32
- package/lib/accountTypes.d.ts +9 -9
- package/lib/accountTypes.js +2 -4
- package/lib/app/__tests__/migrate.test.js +15 -0
- package/lib/app/__tests__/migrate_legacy.test.js +9 -0
- package/lib/app/migrate_legacy.d.ts +2 -2
- package/lib/buildAccount.d.ts +4 -4
- package/lib/buildAccount.js +7 -14
- package/lib/commonOpts.js +3 -3
- package/lib/configMigrate.d.ts +2 -2
- package/lib/configMigrate.js +42 -18
- package/lib/configOptions.js +3 -2
- package/lib/developerTestAccounts.d.ts +3 -3
- package/lib/developerTestAccounts.js +4 -7
- package/lib/doctor/DiagnosticInfoBuilder.d.ts +1 -1
- package/lib/doctor/DiagnosticInfoBuilder.js +9 -6
- package/lib/doctor/Doctor.js +4 -3
- package/lib/doctor/__tests__/Diagnosis.test.js +4 -3
- package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.js +17 -9
- package/lib/doctor/__tests__/Doctor.test.js +14 -0
- package/lib/errorHandlers/index.js +8 -3
- package/lib/importData.js +8 -7
- package/lib/links.js +5 -5
- package/lib/middleware/{__test__ → __tests__}/commandTargetingUtils.test.js +3 -3
- package/lib/middleware/{__test__ → __tests__}/configMiddleware.test.js +23 -22
- package/lib/middleware/{__test__ → __tests__}/gitMiddleware.test.js +9 -7
- package/lib/middleware/autoUpdateMiddleware.js +34 -23
- package/lib/middleware/commandTargetingUtils.js +3 -2
- package/lib/middleware/configMiddleware.d.ts +6 -1
- package/lib/middleware/configMiddleware.js +36 -15
- package/lib/middleware/fireAlarmMiddleware.js +4 -15
- package/lib/middleware/gitMiddleware.js +8 -4
- package/lib/oauth.d.ts +2 -2
- package/lib/oauth.js +8 -10
- package/lib/projects/__tests__/AppDevModeInterface.test.js +17 -6
- package/lib/projects/__tests__/DevServerManager.test.js +1 -0
- package/lib/projects/__tests__/LocalDevProcess.test.js +1 -0
- package/lib/projects/__tests__/components.test.js +2 -22
- package/lib/projects/__tests__/deploy.test.js +16 -13
- package/lib/projects/__tests__/uieLinting.test.js +640 -0
- package/lib/projects/add/__tests__/legacyAddComponent.test.js +1 -1
- package/lib/projects/add/__tests__/v2AddComponent.test.js +30 -4
- package/lib/projects/add/legacyAddComponent.js +1 -1
- package/lib/projects/add/v2AddComponent.js +16 -5
- package/lib/projects/components.d.ts +8 -1
- package/lib/projects/components.js +91 -8
- package/lib/projects/create/__tests__/v2.test.js +11 -0
- package/lib/projects/deploy.js +21 -8
- package/lib/projects/localDev/AppDevModeInterface.js +2 -2
- package/lib/projects/localDev/DevServerManager_DEPRECATED.js +11 -3
- package/lib/projects/localDev/LocalDevLogger.js +4 -4
- package/lib/projects/localDev/LocalDevManager_DEPRECATED.js +3 -3
- package/lib/projects/localDev/helpers/account.d.ts +10 -10
- package/lib/projects/localDev/helpers/account.js +6 -11
- package/lib/projects/localDev/helpers/process.js +5 -3
- package/lib/projects/uieLinting.d.ts +33 -0
- package/lib/projects/uieLinting.js +222 -0
- package/lib/projects/urls.js +5 -6
- package/lib/prompts/__tests__/downloadProjectPrompt.test.js +7 -5
- package/lib/prompts/accountNamePrompt.js +3 -3
- package/lib/prompts/accountsPrompt.d.ts +1 -1
- package/lib/prompts/accountsPrompt.js +6 -7
- package/lib/prompts/confirmImportDataPrompt.js +2 -2
- package/lib/prompts/downloadProjectPrompt.d.ts +1 -0
- package/lib/prompts/downloadProjectPrompt.js +5 -2
- package/lib/prompts/importDataTestAccountSelectPrompt.js +4 -5
- package/lib/prompts/personalAccessKeyPrompt.js +2 -2
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +3 -3
- package/lib/prompts/projectDevTargetAccountPrompt.js +5 -7
- package/lib/prompts/sandboxesPrompt.js +7 -8
- package/lib/prompts/setAsDefaultAccountPrompt.js +7 -6
- package/lib/sandboxSync.d.ts +2 -2
- package/lib/sandboxSync.js +3 -9
- package/lib/sandboxes.d.ts +4 -4
- package/lib/sandboxes.js +6 -11
- package/lib/serverlessLogs.js +2 -2
- package/lib/theme/__tests__/migrate.test.js +15 -0
- package/lib/ui/SpinniesManager.d.ts +5 -7
- package/lib/ui/SpinniesManager.js +9 -12
- package/lib/ui/__tests__/SpinniesManager.test.d.ts +1 -0
- package/lib/ui/__tests__/SpinniesManager.test.js +489 -0
- package/lib/ui/index.js +6 -3
- package/lib/usageTracking.js +15 -8
- package/lib/validation.js +13 -11
- package/mcp-server/tools/cms/HsCreateFunctionTool.js +4 -2
- package/mcp-server/tools/cms/HsCreateModuleTool.js +4 -2
- package/mcp-server/tools/cms/HsCreateTemplateTool.js +4 -2
- package/mcp-server/tools/cms/HsFunctionLogsTool.js +4 -2
- package/mcp-server/tools/cms/HsListFunctionsTool.js +3 -1
- package/mcp-server/tools/cms/HsListTool.js +3 -1
- package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.js +1 -0
- package/mcp-server/tools/index.js +4 -0
- package/mcp-server/tools/project/AddFeatureToProjectTool.js +4 -2
- package/mcp-server/tools/project/CreateProjectTool.js +4 -2
- package/mcp-server/tools/project/CreateTestAccountTool.js +17 -7
- package/mcp-server/tools/project/DeployProjectTool.js +3 -1
- package/mcp-server/tools/project/DocFetchTool.js +6 -4
- package/mcp-server/tools/project/DocsSearchTool.d.ts +1 -1
- package/mcp-server/tools/project/DocsSearchTool.js +10 -8
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +1 -1
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +9 -7
- package/mcp-server/tools/project/GetApplicationInfoTool.js +8 -6
- package/mcp-server/tools/project/GetBuildLogsTool.d.ts +26 -0
- package/mcp-server/tools/project/GetBuildLogsTool.js +125 -0
- package/mcp-server/tools/project/GetBuildStatusTool.d.ts +26 -0
- package/mcp-server/tools/project/GetBuildStatusTool.js +166 -0
- package/mcp-server/tools/project/GetConfigValuesTool.d.ts +1 -1
- package/mcp-server/tools/project/GetConfigValuesTool.js +9 -7
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +1 -1
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +5 -3
- package/mcp-server/tools/project/UploadProjectTools.js +3 -1
- package/mcp-server/tools/project/ValidateProjectTool.js +4 -2
- package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.js +12 -2
- package/mcp-server/tools/project/__tests__/DocFetchTool.test.js +5 -1
- package/mcp-server/tools/project/__tests__/DocsSearchTool.test.js +23 -11
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.js +7 -5
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.js +7 -5
- package/mcp-server/tools/project/__tests__/GetBuildLogsTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetBuildLogsTool.test.js +305 -0
- package/mcp-server/tools/project/__tests__/GetBuildStatusTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetBuildStatusTool.test.js +240 -0
- package/mcp-server/tools/project/__tests__/GetConfigValuesTool.test.js +8 -6
- package/mcp-server/utils/__tests__/content.test.js +21 -20
- package/mcp-server/utils/__tests__/feedbackTracking.test.js +34 -28
- package/mcp-server/utils/config.d.ts +1 -0
- package/mcp-server/utils/config.js +10 -0
- package/mcp-server/utils/content.d.ts +1 -1
- package/mcp-server/utils/content.js +2 -2
- package/mcp-server/utils/feedbackTracking.d.ts +1 -1
- package/mcp-server/utils/feedbackTracking.js +3 -3
- package/mcp-server/utils/toolUsageTracking.js +4 -3
- package/package.json +9 -9
- package/ui/components/BoxWithTitle.d.ts +2 -1
- package/ui/components/BoxWithTitle.js +2 -2
- package/ui/components/StatusMessageBoxes.d.ts +5 -4
- package/ui/components/StatusMessageBoxes.js +8 -8
- package/lib/middleware/__test__/notificationsMiddleware.test.js +0 -8
- package/lib/middleware/notificationsMiddleware.d.ts +0 -1
- package/lib/middleware/notificationsMiddleware.js +0 -28
- package/lib/ui/boxen.d.ts +0 -5
- package/lib/ui/boxen.js +0 -26
- package/mcp-server/utils/__tests__/cliConfig.test.js +0 -110
- package/mcp-server/utils/cliConfig.d.ts +0 -1
- package/mcp-server/utils/cliConfig.js +0 -12
- /package/{lib/middleware/__test__/commandTargetingUtils.test.d.ts → commands/project/__tests__/lint.test.d.ts} +0 -0
- /package/lib/middleware/{__test__/configMiddleware.test.d.ts → __tests__/commandTargetingUtils.test.d.ts} +0 -0
- /package/lib/middleware/{__test__/gitMiddleware.test.d.ts → __tests__/configMiddleware.test.d.ts} +0 -0
- /package/lib/middleware/{__test__/notificationsMiddleware.test.d.ts → __tests__/gitMiddleware.test.d.ts} +0 -0
- /package/lib/middleware/{__test__ → __tests__}/requestMiddleware.test.d.ts +0 -0
- /package/lib/middleware/{__test__ → __tests__}/requestMiddleware.test.js +0 -0
- /package/lib/middleware/{__test__ → __tests__}/yargsChecksMiddleware.test.d.ts +0 -0
- /package/lib/middleware/{__test__ → __tests__}/yargsChecksMiddleware.test.js +0 -0
- /package/{mcp-server/utils/__tests__/cliConfig.test.d.ts → lib/projects/__tests__/uieLinting.test.d.ts} +0 -0
|
@@ -14,6 +14,7 @@ import { uiLogger } from '../../../lib/ui/logger.js';
|
|
|
14
14
|
import * as sandboxesLib from '../../../lib/sandboxes.js';
|
|
15
15
|
import * as sandboxSync from '../../../lib/sandboxSync.js';
|
|
16
16
|
import { vi } from 'vitest';
|
|
17
|
+
import { ENVIRONMENTS } from '@hubspot/local-dev-lib/constants/environments';
|
|
17
18
|
vi.mock('../../../lib/ui/logger.js');
|
|
18
19
|
vi.mock('@hubspot/local-dev-lib/config');
|
|
19
20
|
vi.mock('../../../lib/commonOpts');
|
|
@@ -26,12 +27,13 @@ vi.mock('../../../lib/usageTracking');
|
|
|
26
27
|
vi.mock('../../../lib/buildAccount');
|
|
27
28
|
vi.mock('../../../lib/sandboxes');
|
|
28
29
|
vi.mock('../../../lib/commonOpts');
|
|
29
|
-
const
|
|
30
|
+
const getConfigAccountByIdSpy = vi.spyOn(configUtils, 'getConfigAccountById');
|
|
30
31
|
const promptUserSpy = vi.spyOn(promptUtils, 'promptUser');
|
|
31
32
|
const sandboxTypePromptSpy = vi.spyOn(sandboxPrompts, 'sandboxTypePrompt');
|
|
32
33
|
const processExitSpy = vi.spyOn(process, 'exit');
|
|
33
34
|
const buildSandboxSpy = vi.spyOn(buildAccount, 'buildSandbox');
|
|
34
35
|
const buildV2SandboxSpy = vi.spyOn(buildAccount, 'buildV2Sandbox');
|
|
36
|
+
const getConfigAccountEnvironmentSpy = vi.spyOn(configUtils, 'getConfigAccountEnvironment');
|
|
35
37
|
const getAvailableSyncTypesSpy = vi.spyOn(sandboxesLib, 'getAvailableSyncTypes');
|
|
36
38
|
const syncSandboxSpy = vi.spyOn(sandboxSync, 'syncSandbox');
|
|
37
39
|
const validateSandboxUsageLimitsSpy = vi.spyOn(sandboxesLib, 'validateSandboxUsageLimits');
|
|
@@ -88,7 +90,8 @@ describe('commands/sandbox/create', () => {
|
|
|
88
90
|
args = {
|
|
89
91
|
derivedAccountId: 1234567890,
|
|
90
92
|
};
|
|
91
|
-
|
|
93
|
+
getConfigAccountByIdSpy.mockReturnValue({
|
|
94
|
+
accountId: 1234567890,
|
|
92
95
|
accountType: HUBSPOT_ACCOUNT_TYPES.STANDARD,
|
|
93
96
|
env: 'prod',
|
|
94
97
|
});
|
|
@@ -104,6 +107,7 @@ describe('commands/sandbox/create', () => {
|
|
|
104
107
|
validateSandboxUsageLimitsSpy.mockResolvedValue(undefined);
|
|
105
108
|
mockedHasFeatureV2Sandboxes.mockResolvedValue(false);
|
|
106
109
|
mockedHasFeatureV2Cli.mockResolvedValue(false);
|
|
110
|
+
getConfigAccountEnvironmentSpy.mockReturnValue(ENVIRONMENTS.PROD);
|
|
107
111
|
buildSandboxSpy.mockResolvedValue({
|
|
108
112
|
sandbox: mockSandbox,
|
|
109
113
|
personalAccessKey: 'mock-personal-access-key',
|
|
@@ -123,8 +127,8 @@ describe('commands/sandbox/create', () => {
|
|
|
123
127
|
});
|
|
124
128
|
it('should load the account config for the correct account id', async () => {
|
|
125
129
|
await sandboxCreateCommand.handler(args);
|
|
126
|
-
expect(
|
|
127
|
-
expect(
|
|
130
|
+
expect(getConfigAccountByIdSpy).toHaveBeenCalledTimes(2); // 1st is for parent account, 2nd is for sandbox account
|
|
131
|
+
expect(getConfigAccountByIdSpy).toHaveBeenCalledWith(args.derivedAccountId);
|
|
128
132
|
});
|
|
129
133
|
it('should track the command usage', async () => {
|
|
130
134
|
await sandboxCreateCommand.handler(args);
|
|
@@ -135,6 +139,7 @@ describe('commands/sandbox/create', () => {
|
|
|
135
139
|
await sandboxCreateCommand.handler(args);
|
|
136
140
|
expect(validateSandboxUsageLimitsSpy).toHaveBeenCalledTimes(1);
|
|
137
141
|
expect(validateSandboxUsageLimitsSpy).toHaveBeenCalledWith({
|
|
142
|
+
accountId: 1234567890,
|
|
138
143
|
accountType: HUBSPOT_ACCOUNT_TYPES.STANDARD,
|
|
139
144
|
env: 'prod',
|
|
140
145
|
}, HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX, 'prod');
|
|
@@ -168,6 +173,7 @@ describe('commands/sandbox/create', () => {
|
|
|
168
173
|
await sandboxCreateCommand.handler(args);
|
|
169
174
|
expect(buildSandboxSpy).toHaveBeenCalledTimes(1);
|
|
170
175
|
expect(buildSandboxSpy).toHaveBeenCalledWith(sandboxNameFromPrompt, {
|
|
176
|
+
accountId: 1234567890,
|
|
171
177
|
accountType: HUBSPOT_ACCOUNT_TYPES.STANDARD,
|
|
172
178
|
env: 'prod',
|
|
173
179
|
}, HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX, 'prod', undefined // force
|
|
@@ -181,6 +187,7 @@ describe('commands/sandbox/create', () => {
|
|
|
181
187
|
await sandboxCreateCommand.handler(args);
|
|
182
188
|
expect(buildSandboxSpy).toHaveBeenCalledTimes(1);
|
|
183
189
|
expect(buildSandboxSpy).toHaveBeenCalledWith(sandboxNameFromPrompt, {
|
|
190
|
+
accountId: 1234567890,
|
|
184
191
|
accountType: HUBSPOT_ACCOUNT_TYPES.STANDARD,
|
|
185
192
|
env: 'prod',
|
|
186
193
|
}, HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX, 'prod', undefined // force
|
|
@@ -194,6 +201,7 @@ describe('commands/sandbox/create', () => {
|
|
|
194
201
|
await sandboxCreateCommand.handler(args);
|
|
195
202
|
expect(buildV2SandboxSpy).toHaveBeenCalledTimes(1);
|
|
196
203
|
expect(buildV2SandboxSpy).toHaveBeenCalledWith(sandboxNameFromPrompt, {
|
|
204
|
+
accountId: 1234567890,
|
|
197
205
|
accountType: HUBSPOT_ACCOUNT_TYPES.STANDARD,
|
|
198
206
|
env: 'prod',
|
|
199
207
|
}, HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX, false, // syncObjectRecords
|
|
@@ -222,7 +230,8 @@ describe('commands/sandbox/create', () => {
|
|
|
222
230
|
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
223
231
|
});
|
|
224
232
|
it('should error out if the default account type is not standard', async () => {
|
|
225
|
-
|
|
233
|
+
getConfigAccountByIdSpy.mockReturnValue({
|
|
234
|
+
accountId: 1234567890,
|
|
226
235
|
accountType: HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX,
|
|
227
236
|
env: 'prod',
|
|
228
237
|
});
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getConfigAccountById, getConfigAccountEnvironment, } from '@hubspot/local-dev-lib/config';
|
|
2
2
|
import { uiLogger } from '../../lib/ui/logger.js';
|
|
3
3
|
import { isMissingScopeError } from '@hubspot/local-dev-lib/errors/index';
|
|
4
4
|
import { getHubSpotWebsiteOrigin } from '@hubspot/local-dev-lib/urls';
|
|
5
5
|
import { HUBSPOT_ACCOUNT_TYPES, HUBSPOT_ACCOUNT_TYPE_STRINGS, } from '@hubspot/local-dev-lib/constants/config';
|
|
6
|
-
import { getValidEnv } from '@hubspot/local-dev-lib/environment';
|
|
7
6
|
import { commands, lib } from '../../lang/en.js';
|
|
8
7
|
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
9
8
|
import { uiFeatureHighlight, uiBetaTag } from '../../lib/ui/index.js';
|
|
@@ -22,8 +21,8 @@ const command = 'create';
|
|
|
22
21
|
const describe = uiBetaTag(commands.sandbox.subcommands.create.describe, false);
|
|
23
22
|
async function handler(args) {
|
|
24
23
|
const { name, type, force, derivedAccountId } = args;
|
|
25
|
-
const accountConfig =
|
|
26
|
-
const env =
|
|
24
|
+
const accountConfig = getConfigAccountById(derivedAccountId);
|
|
25
|
+
const env = getConfigAccountEnvironment(derivedAccountId);
|
|
27
26
|
trackCommandUsage('sandbox-create', {}, derivedAccountId);
|
|
28
27
|
// Check if account config exists
|
|
29
28
|
if (!accountConfig) {
|
|
@@ -111,7 +110,7 @@ async function handler(args) {
|
|
|
111
110
|
else {
|
|
112
111
|
result = await buildSandbox(sandboxName, accountConfig, sandboxType, env, force);
|
|
113
112
|
}
|
|
114
|
-
const sandboxAccountConfig =
|
|
113
|
+
const sandboxAccountConfig = getConfigAccountById(result.sandbox.sandboxHubId);
|
|
115
114
|
// Check if sandbox account config exists
|
|
116
115
|
if (!sandboxAccountConfig) {
|
|
117
116
|
uiLogger.error(commands.sandbox.subcommands.create.failure.noSandboxAccountConfig(result.sandbox.sandboxHubId));
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { uiLogger } from '../../lib/ui/logger.js';
|
|
2
2
|
import { isSpecifiedError } from '@hubspot/local-dev-lib/errors/index';
|
|
3
3
|
import { deleteSandbox } from '@hubspot/local-dev-lib/api/sandboxHubs';
|
|
4
|
-
import {
|
|
5
|
-
import { getAccountIdentifier } from '@hubspot/local-dev-lib/config/getAccountIdentifier';
|
|
4
|
+
import { getConfigAccountEnvironment, removeAccountFromConfig, setConfigAccountAsDefault, getAllConfigAccounts, getConfigAccountIfExists, getConfigDefaultAccountIfExists, } from '@hubspot/local-dev-lib/config';
|
|
6
5
|
import { getHubSpotWebsiteOrigin } from '@hubspot/local-dev-lib/urls';
|
|
7
6
|
import { getValidEnv } from '@hubspot/local-dev-lib/environment';
|
|
8
7
|
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
@@ -36,17 +35,20 @@ async function handler(args) {
|
|
|
36
35
|
process.exit(EXIT_CODES.ERROR);
|
|
37
36
|
}
|
|
38
37
|
}
|
|
39
|
-
const
|
|
40
|
-
|
|
38
|
+
const accountIdentifier = userProvidedAccount || accountPrompt.account;
|
|
39
|
+
const sandboxAccount = getConfigAccountIfExists(accountIdentifier);
|
|
40
|
+
if (!sandboxAccount) {
|
|
41
41
|
uiLogger.error(commands.sandbox.subcommands.delete.failure.noSandboxAccountId);
|
|
42
42
|
process.exit(EXIT_CODES.ERROR);
|
|
43
43
|
}
|
|
44
|
-
const
|
|
45
|
-
const
|
|
44
|
+
const sandboxAccountId = sandboxAccount.accountId;
|
|
45
|
+
const defaultAccount = getConfigDefaultAccountIfExists();
|
|
46
|
+
const isDefaultAccount = sandboxAccountId === defaultAccount?.accountId;
|
|
47
|
+
const baseUrl = getHubSpotWebsiteOrigin(getValidEnv(getConfigAccountEnvironment(sandboxAccountId)));
|
|
46
48
|
let parentAccountId;
|
|
47
|
-
const accountsList =
|
|
49
|
+
const accountsList = getAllConfigAccounts() || [];
|
|
48
50
|
for (const portal of accountsList) {
|
|
49
|
-
if (
|
|
51
|
+
if (portal.accountId === sandboxAccountId) {
|
|
50
52
|
if (portal.parentAccountId) {
|
|
51
53
|
parentAccountId = portal.parentAccountId;
|
|
52
54
|
}
|
|
@@ -56,7 +58,8 @@ async function handler(args) {
|
|
|
56
58
|
uiLogger.error(commands.sandbox.subcommands.delete.failure.noParentAccount);
|
|
57
59
|
process.exit(EXIT_CODES.ERROR);
|
|
58
60
|
}
|
|
59
|
-
|
|
61
|
+
const parentAccount = getConfigAccountIfExists(parentAccountPrompt.account);
|
|
62
|
+
parentAccountId = parentAccount?.accountId;
|
|
60
63
|
}
|
|
61
64
|
else {
|
|
62
65
|
uiLogger.error(commands.sandbox.subcommands.delete.failure.noParentAccount);
|
|
@@ -67,9 +70,9 @@ async function handler(args) {
|
|
|
67
70
|
const url = `${baseUrl}/sandboxes/${parentAccountId}`;
|
|
68
71
|
const command = uiAuthCommandReference({
|
|
69
72
|
accountId: parentAccountId || undefined,
|
|
70
|
-
qa:
|
|
73
|
+
qa: getConfigAccountEnvironment(sandboxAccountId) === 'qa',
|
|
71
74
|
});
|
|
72
|
-
if (parentAccountId && !
|
|
75
|
+
if (parentAccountId && !getConfigAccountIfExists(parentAccountId)) {
|
|
73
76
|
uiLogger.log('');
|
|
74
77
|
uiLogger.error(commands.sandbox.subcommands.delete.failure.noParentPortalAvailable(command, url));
|
|
75
78
|
uiLogger.log('');
|
|
@@ -99,14 +102,14 @@ async function handler(args) {
|
|
|
99
102
|
? commands.sandbox.subcommands.delete.success.deleteDefault(userProvidedAccount || accountPrompt.account, sandboxAccountId)
|
|
100
103
|
: commands.sandbox.subcommands.delete.success.delete(userProvidedAccount || accountPrompt.account, sandboxAccountId));
|
|
101
104
|
uiLogger.log('');
|
|
102
|
-
|
|
103
|
-
if (
|
|
105
|
+
removeAccountFromConfig(sandboxAccountId);
|
|
106
|
+
if (isDefaultAccount && !force) {
|
|
104
107
|
const newDefaultAccount = await selectAccountFromConfig();
|
|
105
|
-
|
|
108
|
+
setConfigAccountAsDefault(newDefaultAccount);
|
|
106
109
|
}
|
|
107
110
|
else if (isDefaultAccount && force) {
|
|
108
111
|
// If force is specified, skip prompt and set the parent account id as the default account
|
|
109
|
-
|
|
112
|
+
setConfigAccountAsDefault(parentAccountId);
|
|
110
113
|
}
|
|
111
114
|
process.exit(EXIT_CODES.SUCCESS);
|
|
112
115
|
}
|
|
@@ -135,14 +138,14 @@ async function handler(args) {
|
|
|
135
138
|
uiLogger.log('');
|
|
136
139
|
uiLogger.warn(commands.sandbox.subcommands.delete.failure.objectNotFound(sandboxAccountId));
|
|
137
140
|
uiLogger.log('');
|
|
138
|
-
|
|
139
|
-
if (
|
|
141
|
+
removeAccountFromConfig(sandboxAccountId);
|
|
142
|
+
if (isDefaultAccount && !force) {
|
|
140
143
|
const newDefaultAccount = await selectAccountFromConfig();
|
|
141
|
-
|
|
144
|
+
setConfigAccountAsDefault(newDefaultAccount);
|
|
142
145
|
}
|
|
143
|
-
else {
|
|
146
|
+
else if (isDefaultAccount) {
|
|
144
147
|
// If force is specified, skip prompt and set the parent account id as the default account
|
|
145
|
-
|
|
148
|
+
setConfigAccountAsDefault(parentAccountId);
|
|
146
149
|
}
|
|
147
150
|
process.exit(EXIT_CODES.SUCCESS);
|
|
148
151
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { getValidEnv } from '@hubspot/local-dev-lib/environment';
|
|
4
|
-
import {
|
|
4
|
+
import { getConfigAccountEnvironment } from '@hubspot/local-dev-lib/config';
|
|
5
5
|
import { getCwd } from '@hubspot/local-dev-lib/path';
|
|
6
6
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
7
7
|
import { promptUser, listPrompt } from '../../lib/prompts/promptUtils.js';
|
|
@@ -89,7 +89,7 @@ async function buildTestAccountConfig(args) {
|
|
|
89
89
|
async function handler(args) {
|
|
90
90
|
const { derivedAccountId, formatOutputAsJson } = args;
|
|
91
91
|
trackCommandUsage('test-account-create', {}, derivedAccountId);
|
|
92
|
-
const env = getValidEnv(
|
|
92
|
+
const env = getValidEnv(getConfigAccountEnvironment(derivedAccountId));
|
|
93
93
|
const testAccountConfig = await buildTestAccountConfig(args);
|
|
94
94
|
const resultJson = {};
|
|
95
95
|
SpinniesManager.init({
|
|
@@ -4,7 +4,7 @@ import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
|
4
4
|
import { uiLogger } from '../../lib/ui/logger.js';
|
|
5
5
|
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
6
6
|
import { commands } from '../../lang/en.js';
|
|
7
|
-
import {
|
|
7
|
+
import { removeAccountFromConfig, getConfigAccountById, getConfigAccountIfExists, setConfigAccountAsDefault, getConfigDefaultAccountIfExists, } from '@hubspot/local-dev-lib/config';
|
|
8
8
|
import { promptUser } from '../../lib/prompts/promptUtils.js';
|
|
9
9
|
import { debugError } from '../../lib/errorHandlers/index.js';
|
|
10
10
|
const command = 'delete [test-account]';
|
|
@@ -64,12 +64,12 @@ async function deleteTestAccountFromConfig(testAccountId, parentAccountName, acc
|
|
|
64
64
|
// If the account isn't in the local config then it wasn't auth'd on the local machine
|
|
65
65
|
if (account && account.name && account.accountType) {
|
|
66
66
|
// If the deleted test account was the default account, replace the default account with the parent account
|
|
67
|
-
|
|
68
|
-
const defaultAccountId =
|
|
69
|
-
|
|
67
|
+
const defaultAccount = getConfigDefaultAccountIfExists();
|
|
68
|
+
const defaultAccountId = defaultAccount?.accountId;
|
|
69
|
+
removeAccountFromConfig(account.accountId);
|
|
70
70
|
uiLogger.success(commands.testAccount.delete.success.testAccountDeletedFromConfig(testAccountId));
|
|
71
71
|
if (testAccountId === defaultAccountId) {
|
|
72
|
-
|
|
72
|
+
setConfigAccountAsDefault(parentAccountName);
|
|
73
73
|
uiLogger.info(commands.testAccount.delete.info.replaceDefaultAccount(testAccountId, parentAccountName));
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -84,12 +84,12 @@ async function validateTestAccountConfigs(testAccountId) {
|
|
|
84
84
|
uiLogger.error(commands.testAccount.delete.errors.testAccountNotFound(testAccountId));
|
|
85
85
|
process.exit(EXIT_CODES.ERROR);
|
|
86
86
|
}
|
|
87
|
-
const testAccountConfig =
|
|
87
|
+
const testAccountConfig = getConfigAccountById(testAccountId);
|
|
88
88
|
if (!testAccountConfig) {
|
|
89
89
|
uiLogger.error(commands.testAccount.delete.errors.testAccountNotFound(testAccountId));
|
|
90
90
|
process.exit(EXIT_CODES.ERROR);
|
|
91
91
|
}
|
|
92
|
-
const parentAccountConfig =
|
|
92
|
+
const parentAccountConfig = getConfigAccountById(testAccountConfig.parentAccountId);
|
|
93
93
|
if (!parentAccountConfig) {
|
|
94
94
|
uiLogger.error(commands.testAccount.delete.errors.parentAccountNotFound(testAccountId));
|
|
95
95
|
process.exit(EXIT_CODES.ERROR);
|
|
@@ -103,7 +103,8 @@ async function handler(args) {
|
|
|
103
103
|
let testAccountIdToDelete = 0;
|
|
104
104
|
// See if the account exists
|
|
105
105
|
if (testAccount) {
|
|
106
|
-
const
|
|
106
|
+
const account = getConfigAccountIfExists(testAccount);
|
|
107
|
+
const accountId = account?.accountId || null;
|
|
107
108
|
await validateTestAccountConfigs(accountId);
|
|
108
109
|
if (accountId) {
|
|
109
110
|
testAccountIdToDelete = accountId;
|
package/lang/en.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HubSpotConfigAccount } from '@hubspot/local-dev-lib/types/Accounts';
|
|
2
2
|
export declare const commands: {
|
|
3
3
|
generalErrors: {
|
|
4
4
|
srcIsProject: (src: string, command: string) => string;
|
|
5
5
|
handleDeprecatedEnvVariables: {
|
|
6
6
|
portalEnvVarDeprecated: string;
|
|
7
7
|
};
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
validateConfigMiddleware: {
|
|
9
|
+
missingConfigFile: string;
|
|
10
|
+
configValidationFailed: (errors: string[]) => string;
|
|
10
11
|
};
|
|
11
12
|
};
|
|
12
13
|
getStarted: {
|
|
@@ -86,12 +87,11 @@ export declare const commands: {
|
|
|
86
87
|
list: {
|
|
87
88
|
accounts: string;
|
|
88
89
|
defaultAccountTitle: string;
|
|
89
|
-
|
|
90
|
+
currentResolvedDefaultAccount: (accountId: number) => string;
|
|
90
91
|
describe: string;
|
|
91
92
|
configPath: (configPath: string) => string;
|
|
92
93
|
overrideFilePathTitle: string;
|
|
93
94
|
overrideFilePath: (overrideFilePath: string) => string;
|
|
94
|
-
overrideAccount: (account: string) => string;
|
|
95
95
|
labels: {
|
|
96
96
|
accountId: string;
|
|
97
97
|
authType: string;
|
|
@@ -1366,8 +1366,10 @@ export declare const commands: {
|
|
|
1366
1366
|
};
|
|
1367
1367
|
logs: {
|
|
1368
1368
|
success: (projectName: string, projectDest: string) => string;
|
|
1369
|
-
welcomeMessage: string;
|
|
1370
1369
|
};
|
|
1370
|
+
creatingComponent: (isProjectEmpty: boolean, projectName: string) => string;
|
|
1371
|
+
success: (isProjectEmpty: boolean, projectName: string) => string;
|
|
1372
|
+
failure: (isProjectEmpty: boolean, projectName: string) => string;
|
|
1371
1373
|
prompts: {
|
|
1372
1374
|
parentComponents: string;
|
|
1373
1375
|
emptyProject: string;
|
|
@@ -1508,7 +1510,8 @@ export declare const commands: {
|
|
|
1508
1510
|
};
|
|
1509
1511
|
};
|
|
1510
1512
|
creatingComponent: (projectName: string) => string;
|
|
1511
|
-
success: (
|
|
1513
|
+
success: (projectName: string) => string;
|
|
1514
|
+
failure: (projectName: string) => string;
|
|
1512
1515
|
error: {
|
|
1513
1516
|
failedToDownloadComponent: string;
|
|
1514
1517
|
invalidComponentType: (componentType: string) => string;
|
|
@@ -1752,6 +1755,32 @@ export declare const commands: {
|
|
|
1752
1755
|
noPackageJsonInProject: (projectName: string) => string;
|
|
1753
1756
|
packageManagerNotInstalled: (packageManager: string) => string;
|
|
1754
1757
|
};
|
|
1758
|
+
lint: {
|
|
1759
|
+
help: {
|
|
1760
|
+
describe: string;
|
|
1761
|
+
lintProjectExample: string;
|
|
1762
|
+
lintProjectWithInstallExample: string;
|
|
1763
|
+
lintProjectWithoutInstallExample: string;
|
|
1764
|
+
installMissingDeps: string;
|
|
1765
|
+
};
|
|
1766
|
+
loading: {
|
|
1767
|
+
checking: string;
|
|
1768
|
+
creatingConfig: string;
|
|
1769
|
+
linting: string;
|
|
1770
|
+
};
|
|
1771
|
+
noProjectConfig: string;
|
|
1772
|
+
failedToReadPackageJson: (packageJsonPath: string) => string;
|
|
1773
|
+
installLintPackagesPrompt: (directories: string[], missingPackages: string[]) => string;
|
|
1774
|
+
skippingDirectoriesWarning: (directories: string[]) => string;
|
|
1775
|
+
deprecatedEslintConfigWarning: (details: {
|
|
1776
|
+
path: string;
|
|
1777
|
+
files: string[];
|
|
1778
|
+
}[]) => string;
|
|
1779
|
+
createEslintConfigPrompt: (directories: string[]) => string;
|
|
1780
|
+
eslintConfigCreated: (configPath: string) => string;
|
|
1781
|
+
failedToCreateEslintConfig: (configPath: string) => string;
|
|
1782
|
+
eslintConfigRequired: string;
|
|
1783
|
+
};
|
|
1755
1784
|
updateDeps: {
|
|
1756
1785
|
help: {
|
|
1757
1786
|
describe: string;
|
|
@@ -2930,7 +2959,7 @@ export declare const lib: {
|
|
|
2930
2959
|
updateNotification: {
|
|
2931
2960
|
notifyTitle: string;
|
|
2932
2961
|
cmsUpdateNotification: (packageName: string) => string;
|
|
2933
|
-
cliUpdateNotification: string;
|
|
2962
|
+
cliUpdateNotification: (currentVersion: string, updateCommand: string, latestVersion: string) => string;
|
|
2934
2963
|
};
|
|
2935
2964
|
autoUpdateCLI: {
|
|
2936
2965
|
updateAvailable: (latestVersion: string) => string;
|
|
@@ -3012,6 +3041,18 @@ export declare const lib: {
|
|
|
3012
3041
|
feedbackHeader: string;
|
|
3013
3042
|
feedbackMessage: string;
|
|
3014
3043
|
};
|
|
3044
|
+
components: {
|
|
3045
|
+
unableToGetUidFromHsmeta: string;
|
|
3046
|
+
buildSuccessMessage: {
|
|
3047
|
+
seeOurDocs: string;
|
|
3048
|
+
docsUrl: string;
|
|
3049
|
+
headerCreated: (projectName: string, projectDest: string) => string;
|
|
3050
|
+
headerAdded: (featureText: string, uid: string, plural: boolean) => string;
|
|
3051
|
+
docsDetails: (docsLink: string) => string;
|
|
3052
|
+
uploadPrompt: string;
|
|
3053
|
+
devPrompt: string;
|
|
3054
|
+
};
|
|
3055
|
+
};
|
|
3015
3056
|
};
|
|
3016
3057
|
projectBuildAndDeploy: {
|
|
3017
3058
|
makePollTaskStatusFunc: {
|
|
@@ -3046,9 +3087,6 @@ export declare const lib: {
|
|
|
3046
3087
|
legacyFileDetected: (filename: string, platformVersion: string) => string;
|
|
3047
3088
|
};
|
|
3048
3089
|
};
|
|
3049
|
-
boxen: {
|
|
3050
|
-
failedToLoad: string;
|
|
3051
|
-
};
|
|
3052
3090
|
importData: {
|
|
3053
3091
|
errors: {
|
|
3054
3092
|
incorrectAccountType: (derivedAccountId: number) => string;
|
|
@@ -3237,6 +3275,9 @@ export declare const lib: {
|
|
|
3237
3275
|
skippedExistingAccounts: (accountIds: (string | number)[]) => string;
|
|
3238
3276
|
success: string;
|
|
3239
3277
|
};
|
|
3278
|
+
errors: {
|
|
3279
|
+
archive: (deprecatedConfigPath: string) => string;
|
|
3280
|
+
};
|
|
3240
3281
|
};
|
|
3241
3282
|
prompts: {
|
|
3242
3283
|
promptUtils: {
|
|
@@ -3249,7 +3290,7 @@ export declare const lib: {
|
|
|
3249
3290
|
promptMessage: string;
|
|
3250
3291
|
};
|
|
3251
3292
|
confirmImportDataPrompt: {
|
|
3252
|
-
message: (dataFileNames: string[], cliAccount:
|
|
3293
|
+
message: (dataFileNames: string[], cliAccount: HubSpotConfigAccount | null) => string;
|
|
3253
3294
|
};
|
|
3254
3295
|
importDataTestAccountSelectPrompt: {
|
|
3255
3296
|
errors: {
|
package/lang/en.js
CHANGED
|
@@ -7,15 +7,15 @@ import { uiAccountDescription, uiBetaTag, uiCommandReference, uiLink, UI_COLORS,
|
|
|
7
7
|
import { getProjectDetailUrl, getProjectSettingsUrl, getLocalDevUiUrl, } from '../lib/projects/urls.js';
|
|
8
8
|
import { getProductUpdatesUrl } from '../lib/links.js';
|
|
9
9
|
import { APP_DISTRIBUTION_TYPES, APP_AUTH_TYPES, PROJECT_CONFIG_FILE, PROJECT_WITH_APP, LEGACY_PUBLIC_APP_FILE, } from '../lib/constants.js';
|
|
10
|
-
import { getAccountIdentifier } from '@hubspot/local-dev-lib/config/getAccountIdentifier';
|
|
11
10
|
export const commands = {
|
|
12
11
|
generalErrors: {
|
|
13
12
|
srcIsProject: (src, command) => `"${src}" is in a project folder. Did you mean "hs project ${command}"?`,
|
|
14
13
|
handleDeprecatedEnvVariables: {
|
|
15
14
|
portalEnvVarDeprecated: 'The HUBSPOT_PORTAL_ID environment variable is deprecated. Please use HUBSPOT_ACCOUNT_ID instead.',
|
|
16
15
|
},
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
validateConfigMiddleware: {
|
|
17
|
+
missingConfigFile: `A HubSpot config file is required to run this command, but none was found. To create a new config file and authenticate a HubSpot account, run ${uiCommandReference('hs account auth')}`,
|
|
18
|
+
configValidationFailed: (errors) => `Your HubSpot config file is invalid. Please fix the following errors:\n - ${errors.join('\n- ')}`,
|
|
19
19
|
},
|
|
20
20
|
},
|
|
21
21
|
getStarted: {
|
|
@@ -95,12 +95,11 @@ export const commands = {
|
|
|
95
95
|
list: {
|
|
96
96
|
accounts: `${chalk.bold('Accounts')}:`,
|
|
97
97
|
defaultAccountTitle: `${chalk.bold('Default Account')}`,
|
|
98
|
-
|
|
98
|
+
currentResolvedDefaultAccount: (accountId) => `Account: ${uiAccountDescription(accountId)}`,
|
|
99
99
|
describe: 'List names of accounts defined in config.',
|
|
100
100
|
configPath: (configPath) => `Source: ${configPath}`,
|
|
101
101
|
overrideFilePathTitle: `${chalk.bold('Default Account Override')}`,
|
|
102
102
|
overrideFilePath: (overrideFilePath) => `Source: ${overrideFilePath}`,
|
|
103
|
-
overrideAccount: (account) => `Account: ${account}`,
|
|
104
103
|
labels: {
|
|
105
104
|
accountId: 'Account ID',
|
|
106
105
|
authType: 'Auth Type',
|
|
@@ -1382,8 +1381,10 @@ export const commands = {
|
|
|
1382
1381
|
},
|
|
1383
1382
|
logs: {
|
|
1384
1383
|
success: (projectName, projectDest) => `Project ${chalk.bold(projectName)} was successfully created in ${projectDest}`,
|
|
1385
|
-
welcomeMessage: `\n${chalk.bold('Welcome to HubSpot Developer Projects!')}`,
|
|
1386
1384
|
},
|
|
1385
|
+
creatingComponent: (isProjectEmpty, projectName) => `${isProjectEmpty ? `Creating empty project [${chalk.bold(projectName)}]` : `Adding feature(s) to app [${chalk.bold(projectName)}]`}\n`,
|
|
1386
|
+
success: (isProjectEmpty, projectName) => `${isProjectEmpty ? `Created empty project [${chalk.bold(projectName)}]` : `Added feature(s) to app [${chalk.bold(projectName)}]`}\n`,
|
|
1387
|
+
failure: (isProjectEmpty, projectName) => `${isProjectEmpty ? `Failed to create project [${chalk.bold(projectName)}]` : `Failed to add feature(s) to app [${chalk.bold(projectName)}]`}\n`,
|
|
1387
1388
|
prompts: {
|
|
1388
1389
|
parentComponents: '[--project-base] Choose what to include in your project:',
|
|
1389
1390
|
emptyProject: 'Empty Project',
|
|
@@ -1523,8 +1524,9 @@ export const commands = {
|
|
|
1523
1524
|
describe: 'Which features to include with the application.',
|
|
1524
1525
|
},
|
|
1525
1526
|
},
|
|
1526
|
-
creatingComponent: (projectName) =>
|
|
1527
|
-
success: (
|
|
1527
|
+
creatingComponent: (projectName) => `Adding feature(s) to app [${chalk.bold(projectName)}]\n`,
|
|
1528
|
+
success: (projectName) => `Added feature(s) to app [${chalk.bold(projectName)}]\n`,
|
|
1529
|
+
failure: (projectName) => `Failed to add feature(s) to app [${chalk.bold(projectName)}]\n`,
|
|
1528
1530
|
error: {
|
|
1529
1531
|
failedToDownloadComponent: 'Failed to download project. Please try again later.',
|
|
1530
1532
|
invalidComponentType: (componentType) => `'${componentType}' is not a valid project component type.`,
|
|
@@ -1552,7 +1554,7 @@ export const commands = {
|
|
|
1552
1554
|
noBuilds: 'Deploy error: no builds for this project were found.',
|
|
1553
1555
|
noBuildId: 'You must specify a build to deploy',
|
|
1554
1556
|
projectNotFound: (accountId, projectName) => `The project ${chalk.bold(projectName)} does not exist in account ${uiAccountDescription(accountId)}. Run ${uiCommandReference('hs project upload')} to upload your project files to HubSpot.`,
|
|
1555
|
-
buildIdDoesNotExist: (accountId, buildId, projectName) => `Build ${buildId} does not exist for project ${chalk.bold(projectName)}. ${
|
|
1557
|
+
buildIdDoesNotExist: (accountId, buildId, projectName) => `Build ${buildId} does not exist for project ${chalk.bold(projectName)}. Run ${uiCommandReference('hs project list-builds')} to view existing builds for this project.`,
|
|
1556
1558
|
buildAlreadyDeployed: (accountId, buildId, projectName) => `Build ${buildId} is already deployed. ${uiLink('View project builds in HubSpot', getProjectDetailUrl(projectName, accountId))}`,
|
|
1557
1559
|
deployContainsRemovals: (componentName) => `- This deploy would remove the ${chalk.bold(componentName)} component. To proceed, run the deploy command with the ${uiCommandReference('--force')} flag`,
|
|
1558
1560
|
deployBlockedHeader: "This build couldn't be deployed because it will be too disruptive for existing users. Fix the following issues and try again:",
|
|
@@ -1768,6 +1770,39 @@ export const commands = {
|
|
|
1768
1770
|
noPackageJsonInProject: (projectName) => `No dependencies to install. The project ${projectName} folder might be missing component or subcomponent files. ${uiLink('Learn how to create a project from scratch', 'https://developers.hubspot.com/docs/apps/developer-platform/build-apps/create-an-app#customize-a-new-project-using-the-cli')}`,
|
|
1769
1771
|
packageManagerNotInstalled: (packageManager) => `This command depends on ${packageManager}, install ${uiLink(packageManager, 'https://docs.npmjs.com/downloading-and-installing-node-js-and-npm')}`,
|
|
1770
1772
|
},
|
|
1773
|
+
lint: {
|
|
1774
|
+
help: {
|
|
1775
|
+
describe: 'Lint the UI Extensions components in your project.',
|
|
1776
|
+
lintProjectExample: 'Lint the UI Extensions components in your project.',
|
|
1777
|
+
lintProjectWithInstallExample: 'Lint the UI Extensions components in the project and automatically install missing dependencies.',
|
|
1778
|
+
lintProjectWithoutInstallExample: 'Lint the UI Extensions components in the project without installing missing dependencies.',
|
|
1779
|
+
installMissingDeps: 'Automatically install missing linting dependencies for the UI Extensions components in the project without prompting.',
|
|
1780
|
+
},
|
|
1781
|
+
loading: {
|
|
1782
|
+
checking: 'Checking lint packages and configuration…',
|
|
1783
|
+
creatingConfig: 'Creating ESLint configuration files…',
|
|
1784
|
+
linting: 'Linting…',
|
|
1785
|
+
},
|
|
1786
|
+
noProjectConfig: 'No project detected. Run this command from a project directory.',
|
|
1787
|
+
failedToReadPackageJson: (packageJsonPath) => `Failed to read package.json at ${packageJsonPath}`,
|
|
1788
|
+
installLintPackagesPrompt: (directories, missingPackages) => {
|
|
1789
|
+
const uniquePackages = Array.from(new Set(missingPackages)).sort();
|
|
1790
|
+
return `The dependencies required for linting are missing or outdated.\n\nDependencies:\n${uniquePackages.map(p => ` - ${p}`).join('\n')}\n\n${directories.length === 1 ? 'Directory' : 'Directories'}:\n${directories.map(d => ` - ${d}`).join('\n')}\n\nWould you like to install the required dependencies?`;
|
|
1791
|
+
},
|
|
1792
|
+
skippingDirectoriesWarning: (directories) => `Skipping linting for the following ${directories.length === 1 ? 'directory' : 'directories'}:\n${directories.map(d => ` - ${d}`).join('\n')}`,
|
|
1793
|
+
deprecatedEslintConfigWarning: (details) => {
|
|
1794
|
+
const dirCount = details.length;
|
|
1795
|
+
const header = `Deprecated ESLint configuration file${dirCount === 1 ? '' : 's'} detected in the following ${dirCount === 1 ? 'directory' : 'directories'}:`;
|
|
1796
|
+
const dirList = details
|
|
1797
|
+
.map(d => ` - ${d.path}: ${d.files.join(', ')}`)
|
|
1798
|
+
.join('\n');
|
|
1799
|
+
return `${header}\n${dirList}\n`;
|
|
1800
|
+
},
|
|
1801
|
+
createEslintConfigPrompt: (directories) => `ESLint configuration file not found in the following ${directories.length === 1 ? 'directory' : 'directories'}:\n${directories.map(d => ` - ${d}`).join('\n')}\n\nWould you like to set up the required ESLint configuration?`,
|
|
1802
|
+
eslintConfigCreated: (configPath) => `ESLint configuration created at ${configPath}`,
|
|
1803
|
+
failedToCreateEslintConfig: (configPath) => `Failed to create ESLint configuration at ${configPath}`,
|
|
1804
|
+
eslintConfigRequired: 'ESLint configuration is required to run the lint command. Run the command again to create the configuration.',
|
|
1805
|
+
},
|
|
1771
1806
|
updateDeps: {
|
|
1772
1807
|
help: {
|
|
1773
1808
|
describe: 'Update the npm dependencies for your project, or update specific dependencies in a subcomponent of a project.',
|
|
@@ -2946,7 +2981,7 @@ export const lib = {
|
|
|
2946
2981
|
updateNotification: {
|
|
2947
2982
|
notifyTitle: chalk.bold('CLI update available'),
|
|
2948
2983
|
cmsUpdateNotification: (packageName) => `${chalk.bold('The CMS CLI is now the HubSpot CLI')}\n\nTo upgrade, uninstall ${chalk.bold(packageName)}\nand then run ${uiCommandReference('{updateCommand}')}`,
|
|
2949
|
-
cliUpdateNotification: `HubSpot CLI version ${chalk.cyan(chalk.bold(
|
|
2984
|
+
cliUpdateNotification: (currentVersion, updateCommand, latestVersion) => `HubSpot CLI version ${chalk.cyan(chalk.bold(`${currentVersion}`))} is outdated.\nRun ${uiCommandReference(`${updateCommand}`)} to upgrade to version ${chalk.cyan(chalk.bold(`${latestVersion}`))}`,
|
|
2950
2985
|
},
|
|
2951
2986
|
autoUpdateCLI: {
|
|
2952
2987
|
updateAvailable: (latestVersion) => `There's a new HubSpot CLI version available! Updating to version ${chalk.bold(latestVersion)}`,
|
|
@@ -3028,6 +3063,18 @@ export const lib = {
|
|
|
3028
3063
|
feedbackHeader: "We'd love to hear your feedback!",
|
|
3029
3064
|
feedbackMessage: `How are you liking the new projects and developer tools? \n > Run ${uiCommandReference('hs feedback')} to let us know what you think!\n`,
|
|
3030
3065
|
},
|
|
3066
|
+
components: {
|
|
3067
|
+
unableToGetUidFromHsmeta: 'Unable to get UID from hsmeta',
|
|
3068
|
+
buildSuccessMessage: {
|
|
3069
|
+
seeOurDocs: 'See our docs',
|
|
3070
|
+
docsUrl: 'https://developers.hubspot.com/docs/apps/developer-platform/build-apps/overview',
|
|
3071
|
+
headerCreated: (projectName, projectDest) => `${chalk.bold(projectName)} was successfully created in ${projectDest}`,
|
|
3072
|
+
headerAdded: (featureText, uid, plural) => `${featureText} ${plural ? 'were' : 'was'} successfully added to ${uid}:`,
|
|
3073
|
+
docsDetails: (docsLink) => `📖 ${docsLink} for more details about building and testing these features.`,
|
|
3074
|
+
uploadPrompt: `🚀 Run ${uiCommandReference('hs project upload')} when you're ready to deploy.`,
|
|
3075
|
+
devPrompt: `🧪 Run ${uiCommandReference('hs project dev')} to start local development.`,
|
|
3076
|
+
},
|
|
3077
|
+
},
|
|
3031
3078
|
},
|
|
3032
3079
|
projectBuildAndDeploy: {
|
|
3033
3080
|
makePollTaskStatusFunc: {
|
|
@@ -3062,9 +3109,6 @@ export const lib = {
|
|
|
3062
3109
|
legacyFileDetected: (filename, platformVersion) => `The ${chalk.bold(filename)} file is not supported on platform version ${chalk.bold(platformVersion)} and will be ignored.`,
|
|
3063
3110
|
},
|
|
3064
3111
|
},
|
|
3065
|
-
boxen: {
|
|
3066
|
-
failedToLoad: 'Failed to load boxen util.',
|
|
3067
|
-
},
|
|
3068
3112
|
importData: {
|
|
3069
3113
|
errors: {
|
|
3070
3114
|
incorrectAccountType: (derivedAccountId) => `The account ${uiAccountDescription(derivedAccountId)} is not a standard account, developer test account, or app developer account.`,
|
|
@@ -3253,6 +3297,9 @@ export const lib = {
|
|
|
3253
3297
|
skippedExistingAccounts: (accountIds) => `The following accounts were not merged because they already exist in the global config:${accountIds.map(id => `\n- ${uiAccountDescription(Number(id))}`).join('')}`,
|
|
3254
3298
|
success: 'Your deprecated config file has been successfully merged with the global config file.',
|
|
3255
3299
|
},
|
|
3300
|
+
errors: {
|
|
3301
|
+
archive: (deprecatedConfigPath) => `The config migration was successful, but an error occurred when archiving config file at ${deprecatedConfigPath}. You may need to manually delete or rename this config file.`,
|
|
3302
|
+
},
|
|
3256
3303
|
},
|
|
3257
3304
|
prompts: {
|
|
3258
3305
|
promptUtils: {
|
|
@@ -3265,7 +3312,7 @@ export const lib = {
|
|
|
3265
3312
|
promptMessage: '[--file-path] Select the JSON file that will be used to import your data.',
|
|
3266
3313
|
},
|
|
3267
3314
|
confirmImportDataPrompt: {
|
|
3268
|
-
message: (dataFileNames, cliAccount) => `You are importing [${dataFileNames.join(', ')}] into ${uiAccountDescription(
|
|
3315
|
+
message: (dataFileNames, cliAccount) => `You are importing [${dataFileNames.join(', ')}] into ${uiAccountDescription(cliAccount?.accountId)}. Continue?`,
|
|
3269
3316
|
},
|
|
3270
3317
|
importDataTestAccountSelectPrompt: {
|
|
3271
3318
|
errors: {
|
|
@@ -3617,7 +3664,7 @@ export const lib = {
|
|
|
3617
3664
|
},
|
|
3618
3665
|
failure: {
|
|
3619
3666
|
syncTypeFetch: 'Unable to fetch available sandbox sync types. Please try again.',
|
|
3620
|
-
invalidUser: (accountName, parentAccountName) => `Couldn't sync ${chalk.bold(accountName)} because your account has been removed from ${chalk.bold(parentAccountName)} or your permission set doesn't allow you to sync the sandbox. To update your permissions, contact a super admin in ${chalk.bold(parentAccountName)}.`,
|
|
3667
|
+
invalidUser: (accountName, parentAccountName) => `Couldn't sync sandbox ${chalk.bold(accountName)} because your account has been removed from parent account${chalk.bold(parentAccountName)} or your permission set doesn't allow you to sync the sandbox. To update your permissions, contact a super admin in ${chalk.bold(parentAccountName)}.`,
|
|
3621
3668
|
syncInProgress: (url) => `Couldn't run the sync because there's another sync in progress. Wait for the current sync to finish and then try again. To check the sync status, visit the sync activity log: ${url}.`,
|
|
3622
3669
|
notSuperAdmin: (accountId) => `Couldn't run the sync because you are not a super admin in ${uiAccountDescription(accountId)}. Ask the account owner for super admin access to the sandbox.`,
|
|
3623
3670
|
objectNotFound: (accountId) => `Couldn't sync the sandbox because ${uiAccountDescription(accountId)} may have been deleted through the UI. Run ${uiCommandReference('hs sandbox delete')} to remove this account from the config.`,
|
|
@@ -3745,7 +3792,7 @@ export const lib = {
|
|
|
3745
3792
|
},
|
|
3746
3793
|
validation: {
|
|
3747
3794
|
accountNotFoundInConfig: (userProvidedAccount) => `The account "${userProvidedAccount}" could not be found in the config`,
|
|
3748
|
-
accountRequired: 'An account needs to be supplied either via "--account" or through setting a "
|
|
3795
|
+
accountRequired: 'An account needs to be supplied either via "--account" or through setting a "defaultAccount"',
|
|
3749
3796
|
userProvidedAccount: 'Cannot specify an account when environment variables are supplied. Please unset the environment variables or do not use the "--account" flag.',
|
|
3750
3797
|
accountNotConfigured: (accountId) => `The account ${uiAccountDescription(accountId)} has not been configured`,
|
|
3751
3798
|
invalidAuthType: (authType, accountId, configPath, validValues) => `Invalid "authType" value "${authType}" for account "${uiAccountDescription(accountId)}" in config file: ${configPath}. Valid values are ${validValues}.`,
|