@hubspot/cli 7.8.12-experimental.0 → 7.8.12-experimental.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +31 -25
- package/commands/__tests__/auth.test.js +5 -0
- package/commands/__tests__/doctor.test.js +16 -16
- package/commands/account/clean.js +18 -27
- package/commands/account/createOverride.js +13 -31
- package/commands/account/info.js +20 -31
- package/commands/account/list.js +16 -22
- package/commands/account/remove.js +12 -20
- package/commands/account/removeOverride.js +11 -21
- package/commands/account/rename.js +6 -9
- package/commands/account/use.js +12 -26
- package/commands/account.js +2 -2
- package/commands/app/__tests__/migrate.test.js +5 -5
- package/commands/app/migrate.js +13 -18
- package/commands/app.js +1 -6
- package/commands/auth.d.ts +1 -0
- package/commands/auth.js +16 -7
- package/commands/cms/convertFields.js +7 -9
- package/commands/cms/getReactModule.js +9 -14
- package/commands/cms/lighthouseScore.js +33 -36
- package/commands/cms.js +2 -2
- package/commands/completion.js +3 -3
- package/commands/config/set.d.ts +1 -1
- package/commands/config/set.js +64 -36
- package/commands/config.js +2 -2
- package/commands/create.js +2 -2
- package/commands/customObject/create.js +10 -12
- package/commands/customObject/schema/create.js +9 -11
- package/commands/customObject/schema/delete.js +16 -16
- package/commands/customObject/schema/fetch-all.js +12 -11
- package/commands/customObject/schema/fetch.js +15 -15
- package/commands/customObject/schema/list.js +4 -4
- package/commands/customObject/schema/update.js +13 -13
- package/commands/customObject/schema.js +2 -2
- package/commands/customObject.js +6 -7
- package/commands/doctor.js +8 -11
- package/commands/feedback.js +6 -11
- package/commands/fetch.js +8 -8
- package/commands/filemanager/fetch.js +7 -7
- package/commands/filemanager/upload.js +15 -34
- package/commands/filemanager.js +2 -2
- package/commands/function/deploy.js +11 -29
- package/commands/function/list.js +8 -8
- package/commands/function/server.js +9 -11
- package/commands/function.d.ts +1 -1
- package/commands/function.js +2 -2
- package/commands/getStarted.js +2 -2
- package/commands/hubdb/clear.js +7 -15
- package/commands/hubdb/create.js +9 -15
- package/commands/hubdb/delete.js +8 -15
- package/commands/hubdb/fetch.js +6 -9
- package/commands/hubdb.d.ts +1 -1
- package/commands/hubdb.js +2 -2
- package/commands/init.js +2 -3
- package/commands/lint.js +16 -16
- package/commands/list.js +8 -14
- package/commands/logs.js +14 -20
- package/commands/mv.js +6 -17
- package/commands/open.js +5 -5
- package/commands/project/__tests__/add.test.js +4 -2
- package/commands/project/__tests__/deploy.test.js +3 -4
- package/commands/project/__tests__/installDeps.test.js +8 -8
- package/commands/project/__tests__/logs.test.js +1 -1
- package/commands/project/__tests__/migrate.test.js +5 -5
- package/commands/project/__tests__/migrateApp.test.js +2 -5
- package/commands/project/__tests__/validate.test.js +98 -0
- package/commands/project/add.js +3 -3
- package/commands/project/cloneApp.js +14 -19
- package/commands/project/create.js +0 -1
- package/commands/project/deploy.js +3 -3
- package/commands/project/dev/deprecatedFlow.js +7 -16
- package/commands/project/dev/index.js +14 -12
- package/commands/project/dev/unifiedFlow.js +3 -1
- package/commands/project/download.js +10 -13
- package/commands/project/installDeps.js +8 -8
- package/commands/project/listBuilds.js +11 -20
- package/commands/project/logs.js +21 -24
- package/commands/project/migrateApp.js +9 -15
- package/commands/project/open.js +6 -13
- package/commands/project/upload.d.ts +2 -2
- package/commands/project/upload.js +17 -26
- package/commands/project/validate.js +6 -6
- package/commands/project/watch.js +13 -22
- package/commands/project.js +2 -2
- package/commands/sandbox/__tests__/create.test.js +5 -5
- package/commands/sandbox/create.js +22 -32
- package/commands/sandbox/delete.js +38 -63
- package/commands/sandbox.js +2 -2
- package/commands/secret/addSecret.js +7 -17
- package/commands/secret/deleteSecret.js +10 -20
- package/commands/secret/listSecret.js +8 -10
- package/commands/secret/updateSecret.js +9 -17
- package/commands/secret.js +2 -2
- package/commands/testAccount/__tests__/delete.test.js +2 -4
- package/commands/testAccount/create.js +0 -3
- package/commands/testAccount/delete.d.ts +4 -3
- package/commands/testAccount/delete.js +155 -14
- package/commands/theme/preview.js +1 -4
- package/lang/en.d.ts +310 -124
- package/lang/en.js +351 -169
- package/lang/en.lyaml +2 -2
- package/lib/__tests__/buildAccount.test.js +2 -1
- package/lib/__tests__/commonOpts.test.js +1 -1
- package/lib/__tests__/dependencyManagement.test.js +1 -1
- package/lib/__tests__/developerTestAccounts.test.js +3 -3
- package/lib/__tests__/npm.test.js +1 -1
- package/lib/__tests__/oauth.test.js +4 -4
- package/lib/__tests__/process.test.js +10 -5
- package/lib/__tests__/sandboxSync.test.js +8 -8
- package/lib/__tests__/sandboxes.test.js +8 -8
- package/lib/__tests__/serverlessLogs.test.js +1 -1
- package/lib/__tests__/usageTracking.test.js +5 -5
- package/lib/__tests__/validation.test.js +2 -1
- package/lib/__tests__/yargsUtils.test.js +83 -9
- package/lib/app/__tests__/migrate.test.js +5 -5
- package/lib/app/__tests__/migrate_legacy.test.js +1 -1
- package/lib/app/migrate.js +1 -1
- package/lib/app/migrate_legacy.js +20 -24
- package/lib/buildAccount.js +25 -57
- package/lib/commonOpts.d.ts +1 -1
- package/lib/commonOpts.js +25 -22
- package/lib/configOptions.js +7 -0
- package/lib/constants.d.ts +6 -1
- package/lib/constants.js +10 -1
- package/lib/dependencyManagement.js +9 -27
- package/lib/developerTestAccounts.js +9 -23
- package/lib/doctor/Diagnosis.js +11 -23
- package/lib/doctor/DiagnosticInfoBuilder.js +12 -11
- package/lib/doctor/Doctor.js +42 -90
- package/lib/doctor/__tests__/Doctor.test.js +4 -4
- package/lib/errorHandlers/index.js +12 -20
- package/lib/errorHandlers/suppressError.js +11 -18
- package/lib/lang.js +6 -5
- package/lib/links.js +4 -4
- package/lib/middleware/__test__/commandTargetingUtils.test.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/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/projectProfiles.d.ts +1 -1
- package/lib/projectProfiles.js +2 -10
- package/lib/projects/__tests__/AppDevModeInterface.test.js +14 -34
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +70 -39
- package/lib/projects/__tests__/localDevProjectHelpers.test.js +2 -0
- package/lib/projects/__tests__/platformVersion.test.js +8 -8
- package/lib/projects/__tests__/projects.test.js +12 -12
- package/lib/projects/__tests__/structure.test.js +3 -3
- package/lib/projects/__tests__/upload.test.d.ts +1 -0
- package/lib/projects/__tests__/upload.test.js +82 -0
- package/lib/projects/add/__tests__/legacyAddComponent.test.js +6 -6
- package/lib/projects/add/__tests__/v3AddComponent.test.js +4 -4
- package/lib/projects/create/__tests__/legacy.test.js +5 -5
- package/lib/projects/create/__tests__/v3.test.js +1 -1
- package/lib/projects/create/index.js +2 -2
- package/lib/projects/create/legacy.js +2 -2
- package/lib/projects/create/v3.js +2 -2
- package/lib/projects/localDev/AppDevModeInterface.d.ts +2 -0
- package/lib/projects/localDev/AppDevModeInterface.js +22 -20
- package/lib/projects/localDev/LocalDevLogger.js +10 -11
- package/lib/projects/localDev/LocalDevManager.js +4 -5
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +0 -1
- package/lib/projects/localDev/LocalDevWebsocketServer.js +7 -10
- package/lib/projects/localDev/helpers/project.d.ts +1 -0
- package/lib/projects/localDev/helpers/project.js +37 -0
- package/lib/projects/platformVersion.d.ts +1 -1
- package/lib/projects/platformVersion.js +1 -1
- package/lib/projects/structure.d.ts +2 -2
- package/lib/projects/structure.js +6 -6
- package/lib/projects/upload.d.ts +2 -3
- package/lib/projects/upload.js +17 -9
- package/lib/prompts/__tests__/downloadProjectPrompt.test.js +1 -0
- package/lib/prompts/accountNamePrompt.js +14 -19
- package/lib/prompts/accountsPrompt.js +2 -2
- package/lib/prompts/cmsFieldPrompt.js +2 -2
- package/lib/prompts/createApiSamplePrompt.js +5 -5
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +10 -1
- package/lib/prompts/createFunctionPrompt.js +14 -14
- package/lib/prompts/createModulePrompt.js +9 -9
- package/lib/prompts/createTemplatePrompt.js +2 -2
- package/lib/prompts/downloadProjectPrompt.js +5 -8
- package/lib/prompts/personalAccessKeyPrompt.js +3 -3
- package/lib/prompts/previewPrompt.js +6 -6
- package/lib/prompts/projectAddPrompt.js +6 -0
- package/lib/prompts/projectDevTargetAccountPrompt.js +20 -32
- package/lib/prompts/projectNamePrompt.js +4 -8
- package/lib/prompts/projectsLogsPrompt.js +2 -4
- package/lib/prompts/promptUtils.js +27 -9
- package/lib/prompts/sandboxesPrompt.js +7 -7
- package/lib/prompts/secretPrompt.js +3 -3
- package/lib/prompts/selectAppPrompt.js +3 -3
- package/lib/prompts/selectHubDBTablePrompt.js +9 -13
- package/lib/prompts/selectPublicAppForMigrationPrompt.js +15 -19
- package/lib/prompts/setAsDefaultAccountPrompt.js +4 -8
- package/lib/prompts/uploadPrompt.js +5 -5
- package/lib/sandboxSync.js +24 -41
- package/lib/sandboxes.js +19 -47
- package/lib/schema.js +3 -3
- package/lib/serverlessLogs.js +11 -13
- package/lib/theme/__tests__/migrate.test.js +3 -3
- package/lib/theme/migrate.js +2 -2
- package/lib/ui/SpinniesManager.d.ts +2 -0
- package/lib/ui/SpinniesManager.js +7 -0
- package/lib/ui/boxen.js +1 -2
- package/lib/ui/git.js +13 -10
- package/lib/ui/index.d.ts +4 -0
- package/lib/ui/index.js +47 -38
- package/lib/ui/serverlessFunctionLogs.js +9 -7
- package/lib/ui/uiMessages.d.ts +68 -0
- package/lib/ui/uiMessages.js +71 -0
- package/lib/usageTracking.js +7 -7
- package/lib/validation.js +20 -23
- package/lib/yargsUtils.d.ts +1 -1
- package/lib/yargsUtils.js +12 -5
- package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +2 -2
- package/mcp-server/tools/index.js +4 -0
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +23 -0
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +68 -0
- package/mcp-server/tools/project/GetApplicationInfoTool.d.ts +11 -0
- package/mcp-server/tools/project/GetApplicationInfoTool.js +49 -0
- package/mcp-server/tools/project/GetConfigValuesTool.js +2 -2
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +2 -2
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.js +169 -0
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.js +115 -0
- package/mcp-server/utils/toolUsageTracking.js +2 -2
- package/package.json +6 -6
- package/types/Yargs.d.ts +1 -1
- package/commands/app/__tests__/install.test.js +0 -47
- package/commands/app/install.d.ts +0 -8
- package/commands/app/install.js +0 -122
- 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/commands/{app/__tests__/install.test.d.ts → project/__tests__/validate.test.d.ts} +0 -0
- /package/lib/middleware/__test__/{utils.test.d.ts → commandTargetingUtils.test.d.ts} +0 -0
package/bin/cli.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import yargs from 'yargs';
|
|
3
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
4
3
|
import { logError } from '../lib/errorHandlers/index.js';
|
|
5
|
-
import {
|
|
4
|
+
import { setCLILogLevel, getCommandName } from '../lib/commonOpts.js';
|
|
6
5
|
import { trackHelpUsage, trackConvertFieldsUsage, } from '../lib/usageTracking.js';
|
|
7
6
|
import { EXIT_CODES } from '../lib/enums/exitCodes.js';
|
|
8
|
-
import {
|
|
7
|
+
import { loadAndValidateConfigMiddleware, injectAccountIdMiddleware, validateAccountOptions, handleDeprecatedEnvVariables, } from '../lib/middleware/configMiddleware.js';
|
|
9
8
|
import { autoUpdateCLI } from '../lib/middleware/autoUpdateMiddleware.js';
|
|
10
9
|
import { checkAndWarnGitInclusionMiddleware } from '../lib/middleware/gitMiddleware.js';
|
|
11
10
|
import { performChecks } from '../lib/middleware/yargsChecksMiddleware.js';
|
|
@@ -42,6 +41,7 @@ import appCommand from '../commands/app.js';
|
|
|
42
41
|
import testAccountCommands from '../commands/testAccount.js';
|
|
43
42
|
import getStartedCommand from '../commands/getStarted.js';
|
|
44
43
|
import mcpCommand from '../commands/mcp.js';
|
|
44
|
+
import { uiLogger } from '../lib/ui/logger.js';
|
|
45
45
|
function getTerminalWidth() {
|
|
46
46
|
const width = yargs().terminalWidth();
|
|
47
47
|
if (width >= 100)
|
|
@@ -50,7 +50,7 @@ function getTerminalWidth() {
|
|
|
50
50
|
}
|
|
51
51
|
function handleFailure(msg, err, yargs) {
|
|
52
52
|
if (msg) {
|
|
53
|
-
|
|
53
|
+
uiLogger.error(msg);
|
|
54
54
|
}
|
|
55
55
|
else if (err) {
|
|
56
56
|
logError(err);
|
|
@@ -67,10 +67,10 @@ const argv = yargs(process.argv.slice(2))
|
|
|
67
67
|
.usage('The command line interface to interact with HubSpot.')
|
|
68
68
|
// loadConfigMiddleware loads the new hidden config for all commands
|
|
69
69
|
.middleware([
|
|
70
|
-
|
|
70
|
+
setCLILogLevel,
|
|
71
71
|
setRequestHeaders,
|
|
72
72
|
handleDeprecatedEnvVariables,
|
|
73
|
-
|
|
73
|
+
loadAndValidateConfigMiddleware,
|
|
74
74
|
injectAccountIdMiddleware,
|
|
75
75
|
autoUpdateCLI,
|
|
76
76
|
checkAndWarnGitInclusionMiddleware,
|
|
@@ -92,36 +92,42 @@ const argv = yargs(process.argv.slice(2))
|
|
|
92
92
|
type: 'boolean',
|
|
93
93
|
})
|
|
94
94
|
.check(performChecks)
|
|
95
|
+
// Getting started / important
|
|
96
|
+
.command(getStartedCommand)
|
|
97
|
+
.command(feedbackCommand)
|
|
98
|
+
// Config/Account management
|
|
95
99
|
.command(authCommand)
|
|
96
100
|
.command(initCommand)
|
|
97
|
-
.command(
|
|
101
|
+
.command(configCommand)
|
|
102
|
+
.command(accountCommands)
|
|
103
|
+
.command(testAccountCommands)
|
|
104
|
+
.command(sandboxesCommand)
|
|
105
|
+
.command(secretCommands)
|
|
106
|
+
.command(openCommand)
|
|
107
|
+
// Project commands
|
|
108
|
+
.command(projectCommands)
|
|
109
|
+
.command(appCommand)
|
|
110
|
+
// CMS Design Manager
|
|
111
|
+
.command(watchCommand)
|
|
112
|
+
.command(listCommand)
|
|
113
|
+
.command(uploadCommand)
|
|
114
|
+
.command(fetchCommand)
|
|
115
|
+
.command(removeCommand)
|
|
116
|
+
.command(mvCommand)
|
|
117
|
+
// CMS Commands
|
|
98
118
|
.command(cmsCommand)
|
|
119
|
+
.command(logsCommand)
|
|
99
120
|
.command(lintCommand)
|
|
100
121
|
.command(hubdbCommand)
|
|
101
|
-
.command(watchCommand)
|
|
102
|
-
.command(removeCommand)
|
|
103
|
-
.command(uploadCommand)
|
|
104
122
|
.command(createCommand)
|
|
105
|
-
.command(fetchCommand)
|
|
106
123
|
.command(filemanagerCommand)
|
|
107
|
-
.command(secretCommands)
|
|
108
|
-
.command(customObjectCommand)
|
|
109
124
|
.command(functionCommands)
|
|
110
|
-
.command(listCommand)
|
|
111
|
-
.command(openCommand)
|
|
112
|
-
.command(mvCommand)
|
|
113
|
-
.command(projectCommands)
|
|
114
125
|
.command(themeCommand)
|
|
115
126
|
.command(moduleCommand)
|
|
116
|
-
|
|
117
|
-
.command(
|
|
118
|
-
.command(sandboxesCommand)
|
|
119
|
-
.command(feedbackCommand)
|
|
120
|
-
.command(doctorCommand)
|
|
127
|
+
// Misc commands
|
|
128
|
+
.command(customObjectCommand)
|
|
121
129
|
.command(completionCommand)
|
|
122
|
-
.command(
|
|
123
|
-
.command(testAccountCommands)
|
|
124
|
-
.command(getStartedCommand)
|
|
130
|
+
.command(doctorCommand)
|
|
125
131
|
.command(mcpCommand)
|
|
126
132
|
.help()
|
|
127
133
|
.alias('h', 'help')
|
|
@@ -28,6 +28,11 @@ describe('commands/auth', () => {
|
|
|
28
28
|
}),
|
|
29
29
|
account: expect.objectContaining({ type: 'string' }),
|
|
30
30
|
'personal-access-key': expect.objectContaining({ type: 'string' }),
|
|
31
|
+
'disable-tracking': expect.objectContaining({
|
|
32
|
+
type: 'boolean',
|
|
33
|
+
hidden: true,
|
|
34
|
+
default: false,
|
|
35
|
+
}),
|
|
31
36
|
});
|
|
32
37
|
expect(addConfigOptions).toHaveBeenCalledTimes(1);
|
|
33
38
|
expect(addConfigOptions).toHaveBeenCalledWith(yargs);
|
|
@@ -3,12 +3,12 @@ import yargs from 'yargs';
|
|
|
3
3
|
import doctorCommand from '../doctor.js';
|
|
4
4
|
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
5
5
|
import { Doctor } from '../../lib/doctor/Doctor.js';
|
|
6
|
-
import {
|
|
6
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
7
7
|
import fs from 'fs';
|
|
8
8
|
import { getCwd as __getCwd } from '@hubspot/local-dev-lib/path';
|
|
9
9
|
vi.mock('../../lib/usageTracking');
|
|
10
10
|
vi.mock('../../lib/doctor/Doctor');
|
|
11
|
-
vi.mock('
|
|
11
|
+
vi.mock('../../lib/ui/logger.js');
|
|
12
12
|
vi.mock('@hubspot/local-dev-lib/path');
|
|
13
13
|
vi.mock('fs');
|
|
14
14
|
// @ts-expect-error Doesn't match the actual signature because then the linter complains about unused variables
|
|
@@ -65,8 +65,8 @@ describe('doctor', () => {
|
|
|
65
65
|
});
|
|
66
66
|
it('should log the diagnosis if it is defined', async () => {
|
|
67
67
|
await doctorCommand.handler({});
|
|
68
|
-
expect(
|
|
69
|
-
expect(
|
|
68
|
+
expect(uiLogger.log).toHaveBeenCalledTimes(1);
|
|
69
|
+
expect(uiLogger.log).toHaveBeenCalledWith(diagnosis);
|
|
70
70
|
expect(processExitSpy).toHaveBeenCalledTimes(1);
|
|
71
71
|
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.SUCCESS);
|
|
72
72
|
});
|
|
@@ -78,8 +78,8 @@ describe('doctor', () => {
|
|
|
78
78
|
};
|
|
79
79
|
});
|
|
80
80
|
await doctorCommand.handler({});
|
|
81
|
-
expect(
|
|
82
|
-
expect(
|
|
81
|
+
expect(uiLogger.error).toHaveBeenCalledTimes(1);
|
|
82
|
+
expect(uiLogger.error).toHaveBeenCalledWith('Error generating diagnosis');
|
|
83
83
|
expect(processExitSpy).toHaveBeenCalledTimes(1);
|
|
84
84
|
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
85
85
|
});
|
|
@@ -89,12 +89,12 @@ describe('doctor', () => {
|
|
|
89
89
|
await doctorCommand.handler({
|
|
90
90
|
outputDir: '/foo',
|
|
91
91
|
});
|
|
92
|
-
expect(
|
|
93
|
-
expect(
|
|
92
|
+
expect(uiLogger.log).not.toHaveBeenCalled();
|
|
93
|
+
expect(uiLogger.error).not.toHaveBeenCalled();
|
|
94
94
|
expect(mockedFs.writeFileSync).toHaveBeenCalledTimes(1);
|
|
95
95
|
expect(mockedFs.writeFileSync).toHaveBeenCalledWith(expectedOutputFile, expect.stringContaining(diagnosis));
|
|
96
|
-
expect(
|
|
97
|
-
expect(
|
|
96
|
+
expect(uiLogger.success).toHaveBeenCalledTimes(1);
|
|
97
|
+
expect(uiLogger.success).toHaveBeenCalledWith(expect.stringMatching(/Output written to /));
|
|
98
98
|
expect(processExitSpy).toHaveBeenCalledTimes(1);
|
|
99
99
|
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.SUCCESS);
|
|
100
100
|
});
|
|
@@ -106,12 +106,12 @@ describe('doctor', () => {
|
|
|
106
106
|
await doctorCommand.handler({
|
|
107
107
|
outputDir: './foo',
|
|
108
108
|
});
|
|
109
|
-
expect(
|
|
110
|
-
expect(
|
|
109
|
+
expect(uiLogger.log).not.toHaveBeenCalled();
|
|
110
|
+
expect(uiLogger.error).not.toHaveBeenCalled();
|
|
111
111
|
expect(mockedFs.writeFileSync).toHaveBeenCalledTimes(1);
|
|
112
112
|
expect(mockedFs.writeFileSync).toHaveBeenCalledWith(expectedOutputFile, expect.stringContaining(diagnosis));
|
|
113
|
-
expect(
|
|
114
|
-
expect(
|
|
113
|
+
expect(uiLogger.success).toHaveBeenCalledTimes(1);
|
|
114
|
+
expect(uiLogger.success).toHaveBeenCalledWith(expect.stringMatching(/Output written to /));
|
|
115
115
|
expect(processExitSpy).toHaveBeenCalledTimes(1);
|
|
116
116
|
expect(processExitSpy).toHaveBeenCalledWith(EXIT_CODES.SUCCESS);
|
|
117
117
|
});
|
|
@@ -123,8 +123,8 @@ describe('doctor', () => {
|
|
|
123
123
|
await doctorCommand.handler({
|
|
124
124
|
outputDir: '/foo',
|
|
125
125
|
});
|
|
126
|
-
expect(
|
|
127
|
-
expect(
|
|
126
|
+
expect(uiLogger.error).toHaveBeenCalledTimes(1);
|
|
127
|
+
expect(uiLogger.error).toHaveBeenCalledWith(expect.stringMatching(/Unable to write output to/));
|
|
128
128
|
expect(mockedFs.writeFileSync).toHaveBeenCalledTimes(1);
|
|
129
129
|
expect(mockedFs.writeFileSync).toHaveBeenCalledWith(`/foo/hubspot-doctor-${date.toISOString()}.json`, expect.stringContaining(diagnosis));
|
|
130
130
|
expect(processExitSpy).toHaveBeenCalledTimes(1);
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
3
2
|
import { accessTokenForPersonalAccessKey } from '@hubspot/local-dev-lib/personalAccessKey';
|
|
4
3
|
import { loadConfig, getConfigPath, deleteAccount, getConfigAccounts, getConfigDefaultAccount, updateDefaultAccount, } from '@hubspot/local-dev-lib/config';
|
|
5
4
|
import { getAccountIdentifier } from '@hubspot/local-dev-lib/config/getAccountIdentifier';
|
|
6
5
|
import { isSpecifiedError } from '@hubspot/local-dev-lib/errors/index';
|
|
7
6
|
import { getCWDAccountOverride, getDefaultAccountOverrideFilePath, } from '@hubspot/local-dev-lib/config';
|
|
8
7
|
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
9
|
-
import { i18n } from '../../lib/lang.js';
|
|
10
8
|
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
11
9
|
import { promptUser } from '../../lib/prompts/promptUtils.js';
|
|
12
10
|
import { selectAccountFromConfig } from '../../lib/prompts/accountsPrompt.js';
|
|
@@ -15,15 +13,17 @@ import SpinniesManager from '../../lib/ui/SpinniesManager.js';
|
|
|
15
13
|
import { uiAccountDescription } from '../../lib/ui/index.js';
|
|
16
14
|
import { logError } from '../../lib/errorHandlers/index.js';
|
|
17
15
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
16
|
+
import { commands } from '../../lang/en.js';
|
|
17
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
18
18
|
const command = 'clean';
|
|
19
|
-
const describe =
|
|
19
|
+
const describe = commands.account.subcommands.clean.describe;
|
|
20
20
|
async function handler(args) {
|
|
21
21
|
const { qa } = args;
|
|
22
22
|
trackCommandUsage('accounts-clean');
|
|
23
23
|
const accountsList = getConfigAccounts() || [];
|
|
24
24
|
const filteredTestAccounts = accountsList.filter(p => qa ? p.env === 'qa' : p.env !== 'qa');
|
|
25
25
|
if (filteredTestAccounts && filteredTestAccounts.length === 0) {
|
|
26
|
-
|
|
26
|
+
uiLogger.log(commands.account.subcommands.clean.noResults);
|
|
27
27
|
process.exit(EXIT_CODES.SUCCESS);
|
|
28
28
|
}
|
|
29
29
|
const accountsToRemove = [];
|
|
@@ -31,7 +31,7 @@ async function handler(args) {
|
|
|
31
31
|
succeedColor: 'white',
|
|
32
32
|
});
|
|
33
33
|
SpinniesManager.add('accountsClean', {
|
|
34
|
-
text:
|
|
34
|
+
text: commands.account.subcommands.clean.loading.add,
|
|
35
35
|
});
|
|
36
36
|
for (const account of filteredTestAccounts) {
|
|
37
37
|
try {
|
|
@@ -56,29 +56,23 @@ async function handler(args) {
|
|
|
56
56
|
if (accountsToRemove.length > 0) {
|
|
57
57
|
const oneAccountFound = accountsToRemove.length === 1;
|
|
58
58
|
SpinniesManager.succeed('accountsClean', {
|
|
59
|
-
text:
|
|
60
|
-
?
|
|
61
|
-
:
|
|
62
|
-
count: accountsToRemove.length,
|
|
63
|
-
}),
|
|
59
|
+
text: oneAccountFound
|
|
60
|
+
? commands.account.subcommands.clean.inactiveAccountsFound.one
|
|
61
|
+
: commands.account.subcommands.clean.inactiveAccountsFound.other(accountsToRemove.length),
|
|
64
62
|
});
|
|
65
|
-
|
|
63
|
+
uiLogger.log(getTableContents(accountsToRemove.map(p => [
|
|
66
64
|
uiAccountDescription(getAccountIdentifier(p)),
|
|
67
65
|
]), { border: { bodyLeft: ' ' } }));
|
|
68
|
-
let promptMessage =
|
|
69
|
-
?
|
|
70
|
-
:
|
|
71
|
-
count: accountsToRemove.length,
|
|
72
|
-
});
|
|
66
|
+
let promptMessage = oneAccountFound
|
|
67
|
+
? commands.account.subcommands.clean.confirm.one
|
|
68
|
+
: commands.account.subcommands.clean.confirm.other(accountsToRemove.length);
|
|
73
69
|
const accountOverride = getCWDAccountOverride();
|
|
74
70
|
const overrideFilePath = getDefaultAccountOverrideFilePath();
|
|
75
71
|
const accountOverrideMatches = accountsToRemove.some(account => account.name === accountOverride ||
|
|
76
72
|
// @ts-expect-error: Default account override files can only exist with global config
|
|
77
73
|
account.accountId === accountOverride);
|
|
78
74
|
if (overrideFilePath && accountOverride && accountOverrideMatches) {
|
|
79
|
-
promptMessage = `${promptMessage}${
|
|
80
|
-
overrideFilePath,
|
|
81
|
-
})}`;
|
|
75
|
+
promptMessage = `${promptMessage}${commands.account.subcommands.clean.defaultAccountOverride(overrideFilePath)}`;
|
|
82
76
|
}
|
|
83
77
|
const { accountsCleanPrompt } = await promptUser([
|
|
84
78
|
{
|
|
@@ -88,7 +82,7 @@ async function handler(args) {
|
|
|
88
82
|
},
|
|
89
83
|
]);
|
|
90
84
|
if (accountsCleanPrompt) {
|
|
91
|
-
|
|
85
|
+
uiLogger.log('');
|
|
92
86
|
try {
|
|
93
87
|
if (overrideFilePath) {
|
|
94
88
|
fs.unlinkSync(overrideFilePath);
|
|
@@ -99,17 +93,14 @@ async function handler(args) {
|
|
|
99
93
|
}
|
|
100
94
|
for (const accountToRemove of accountsToRemove) {
|
|
101
95
|
await deleteAccount(accountToRemove.name);
|
|
102
|
-
|
|
103
|
-
accountName: accountToRemove.name,
|
|
104
|
-
}));
|
|
96
|
+
uiLogger.log(commands.account.subcommands.clean.removeSuccess(accountToRemove.name));
|
|
105
97
|
}
|
|
106
98
|
// Get updated version of the config
|
|
107
99
|
loadConfig(getConfigPath());
|
|
108
100
|
const defaultAccount = getConfigDefaultAccount();
|
|
109
101
|
if (defaultAccount &&
|
|
110
102
|
accountsToRemove.some(p => p.name === defaultAccount)) {
|
|
111
|
-
|
|
112
|
-
logger.log(i18n(`commands.account.subcommands.clean.replaceDefaultAccount`));
|
|
103
|
+
uiLogger.log(commands.account.subcommands.clean.replaceDefaultAccount);
|
|
113
104
|
const newDefaultAccount = await selectAccountFromConfig();
|
|
114
105
|
updateDefaultAccount(newDefaultAccount);
|
|
115
106
|
}
|
|
@@ -117,10 +108,10 @@ async function handler(args) {
|
|
|
117
108
|
}
|
|
118
109
|
else {
|
|
119
110
|
SpinniesManager.succeed('accountsClean', {
|
|
120
|
-
text:
|
|
111
|
+
text: commands.account.subcommands.clean.noResults,
|
|
121
112
|
});
|
|
122
113
|
}
|
|
123
|
-
|
|
114
|
+
uiLogger.log('');
|
|
124
115
|
process.exit(EXIT_CODES.SUCCESS);
|
|
125
116
|
}
|
|
126
117
|
function accountCleanBuilder(yargs) {
|
|
@@ -1,44 +1,36 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { getCwd } from '@hubspot/local-dev-lib/path';
|
|
4
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
5
4
|
import { DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME } from '@hubspot/local-dev-lib/constants/config';
|
|
6
5
|
import { getCWDAccountOverride, getDefaultAccountOverrideFilePath, getConfigPath, getAccountId, } from '@hubspot/local-dev-lib/config';
|
|
7
6
|
import { getGlobalConfig } from '@hubspot/local-dev-lib/config/migrate';
|
|
8
|
-
import { i18n } from '../../lib/lang.js';
|
|
9
7
|
import { promptUser } from '../../lib/prompts/promptUtils.js';
|
|
10
8
|
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
11
9
|
import { trackCommandMetadataUsage } from '../../lib/usageTracking.js';
|
|
12
10
|
import { selectAccountFromConfig } from '../../lib/prompts/accountsPrompt.js';
|
|
13
11
|
import { logError } from '../../lib/errorHandlers/index.js';
|
|
14
|
-
import { uiCommandReference } from '../../lib/ui/index.js';
|
|
15
12
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
13
|
+
import { commands } from '../../lang/en.js';
|
|
14
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
16
15
|
const command = 'create-override [account]';
|
|
17
|
-
const describe =
|
|
18
|
-
hsAccountFileName: DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME,
|
|
19
|
-
});
|
|
16
|
+
const describe = commands.account.subcommands.createOverride.describe(DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME);
|
|
20
17
|
async function handler(args) {
|
|
21
18
|
let overrideDefaultAccount = args.account;
|
|
22
19
|
const globalConfig = getGlobalConfig();
|
|
23
20
|
if (!globalConfig) {
|
|
24
|
-
|
|
25
|
-
authCommand: uiCommandReference('hs account auth'),
|
|
26
|
-
}));
|
|
21
|
+
uiLogger.error(commands.account.subcommands.createOverride.errors.globalConfigNotFound);
|
|
27
22
|
process.exit(EXIT_CODES.ERROR);
|
|
28
23
|
}
|
|
29
24
|
const accountOverride = getCWDAccountOverride();
|
|
30
25
|
const overrideFilePath = getDefaultAccountOverrideFilePath();
|
|
31
26
|
if (accountOverride && overrideFilePath) {
|
|
32
|
-
|
|
33
|
-
accountOverride,
|
|
34
|
-
overrideFilePath,
|
|
35
|
-
}));
|
|
27
|
+
uiLogger.log(commands.account.subcommands.createOverride.accountOverride(overrideFilePath, accountOverride.toString()));
|
|
36
28
|
const { replaceOverrideFile } = await promptUser({
|
|
37
29
|
type: 'confirm',
|
|
38
30
|
name: 'replaceOverrideFile',
|
|
39
|
-
message:
|
|
31
|
+
message: commands.account.subcommands.createOverride.prompts.replaceOverrideFile,
|
|
40
32
|
});
|
|
41
|
-
|
|
33
|
+
uiLogger.log('');
|
|
42
34
|
if (!replaceOverrideFile) {
|
|
43
35
|
const accountId = getAccountId(accountOverride) || undefined;
|
|
44
36
|
trackCommandMetadataUsage('account-createOverride', {
|
|
@@ -52,18 +44,14 @@ async function handler(args) {
|
|
|
52
44
|
overrideDefaultAccount = await selectAccountFromConfig();
|
|
53
45
|
}
|
|
54
46
|
else if (!getAccountId(overrideDefaultAccount)) {
|
|
55
|
-
|
|
56
|
-
configPath: getConfigPath() || '',
|
|
57
|
-
}));
|
|
47
|
+
uiLogger.error(commands.account.subcommands.createOverride.errors.accountNotFound(getConfigPath() || ''));
|
|
58
48
|
overrideDefaultAccount = await selectAccountFromConfig();
|
|
59
49
|
}
|
|
60
50
|
const accountId = getAccountId(overrideDefaultAccount);
|
|
61
51
|
try {
|
|
62
52
|
const overrideFilePath = path.join(getCwd(), DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME);
|
|
63
53
|
await fs.writeFile(overrideFilePath, accountId.toString(), 'utf8');
|
|
64
|
-
|
|
65
|
-
overrideFilePath,
|
|
66
|
-
}));
|
|
54
|
+
uiLogger.success(commands.account.subcommands.createOverride.success(overrideFilePath));
|
|
67
55
|
const trackingId = accountId || undefined;
|
|
68
56
|
trackCommandMetadataUsage('config-migrate', {
|
|
69
57
|
command: 'hs config migrate',
|
|
@@ -79,27 +67,21 @@ async function handler(args) {
|
|
|
79
67
|
}
|
|
80
68
|
function accountCreateOverrideBuilder(yargs) {
|
|
81
69
|
yargs.positional('account', {
|
|
82
|
-
describe:
|
|
70
|
+
describe: commands.account.subcommands.createOverride.options.account.describe,
|
|
83
71
|
type: 'string',
|
|
84
72
|
});
|
|
85
73
|
yargs.example([
|
|
86
74
|
[
|
|
87
75
|
'$0 account create-override',
|
|
88
|
-
|
|
89
|
-
hsAccountFileName: DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME,
|
|
90
|
-
}),
|
|
76
|
+
commands.account.subcommands.createOverride.examples.default(DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME),
|
|
91
77
|
],
|
|
92
78
|
[
|
|
93
79
|
'$0 account create-override 12345678',
|
|
94
|
-
|
|
95
|
-
hsAccountFileName: DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME,
|
|
96
|
-
}),
|
|
80
|
+
commands.account.subcommands.createOverride.examples.idBased(DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME),
|
|
97
81
|
],
|
|
98
82
|
[
|
|
99
83
|
'$0 account create-override MyAccount',
|
|
100
|
-
|
|
101
|
-
hsAccountFileName: DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME,
|
|
102
|
-
}),
|
|
84
|
+
commands.account.subcommands.createOverride.examples.nameBased(DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME),
|
|
103
85
|
],
|
|
104
86
|
]);
|
|
105
87
|
return yargs;
|
package/commands/account/info.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
2
1
|
import { getAccountConfig, getDisplayDefaultAccount, getConfigDefaultAccount, getDefaultAccountOverrideFilePath, getConfigPath, } from '@hubspot/local-dev-lib/config';
|
|
3
2
|
import { getAccessToken } from '@hubspot/local-dev-lib/personalAccessKey';
|
|
4
3
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
5
|
-
import { i18n } from '../../lib/lang.js';
|
|
6
4
|
import { indent } from '../../lib/ui/index.js';
|
|
7
5
|
import { getTableContents } from '../../lib/ui/table.js';
|
|
8
|
-
|
|
6
|
+
import { commands } from '../../lang/en.js';
|
|
7
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
8
|
+
const describe = commands.account.subcommands.info.describe;
|
|
9
9
|
const command = 'info [account]';
|
|
10
10
|
async function handler(args) {
|
|
11
11
|
const { derivedAccountId } = args;
|
|
@@ -19,53 +19,42 @@ async function handler(args) {
|
|
|
19
19
|
// If a default account is present in the config, display it
|
|
20
20
|
const configPath = getConfigPath();
|
|
21
21
|
if (configPath) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
})}`);
|
|
26
|
-
logger.log(`${indent(1)}${i18n(`commands.account.subcommands.info.defaultAccount`, {
|
|
27
|
-
account: getDisplayDefaultAccount(),
|
|
28
|
-
})}`);
|
|
22
|
+
uiLogger.log(commands.account.subcommands.info.defaultAccountTitle);
|
|
23
|
+
uiLogger.log(`${indent(1)}${commands.account.subcommands.info.configPath(configPath)}`);
|
|
24
|
+
uiLogger.log(`${indent(1)}${commands.account.subcommands.info.defaultAccount(getDisplayDefaultAccount().toString())}`);
|
|
29
25
|
}
|
|
30
26
|
// If a default account override is present, display it
|
|
31
27
|
const overrideFilePath = getDefaultAccountOverrideFilePath();
|
|
32
28
|
if (overrideFilePath) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
account: getConfigDefaultAccount(),
|
|
38
|
-
})}`);
|
|
29
|
+
uiLogger.log('');
|
|
30
|
+
uiLogger.log(commands.account.subcommands.info.overrideFilePathTitle);
|
|
31
|
+
uiLogger.log(`${indent(1)}${commands.account.subcommands.info.overrideFilePath(overrideFilePath)}`);
|
|
32
|
+
uiLogger.log(`${indent(1)}${commands.account.subcommands.info.overrideAccount(getConfigDefaultAccount().toString())}`);
|
|
39
33
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}));
|
|
45
|
-
logger.log(i18n(`commands.account.subcommands.info.scopeGroups`));
|
|
46
|
-
logger.log(getTableContents(scopeGroups, { border: { bodyLeft: ' ' } }));
|
|
34
|
+
uiLogger.log('');
|
|
35
|
+
uiLogger.log(commands.account.subcommands.info.name(name));
|
|
36
|
+
uiLogger.log(commands.account.subcommands.info.accountId(derivedAccountId));
|
|
37
|
+
uiLogger.log(commands.account.subcommands.info.scopeGroups);
|
|
38
|
+
uiLogger.log(getTableContents(scopeGroups, { border: { bodyLeft: ' ' } }));
|
|
47
39
|
}
|
|
48
40
|
else {
|
|
49
|
-
|
|
41
|
+
uiLogger.log(commands.account.subcommands.info.errors.notUsingPersonalAccessKey);
|
|
50
42
|
}
|
|
51
43
|
}
|
|
52
44
|
function accountInfoBuilder(yargs) {
|
|
53
45
|
yargs.positional('account', {
|
|
54
|
-
describe:
|
|
46
|
+
describe: commands.account.subcommands.info.options.account.describe,
|
|
55
47
|
type: 'string',
|
|
56
48
|
});
|
|
57
49
|
yargs.example([
|
|
58
|
-
[
|
|
59
|
-
'$0 accounts info',
|
|
60
|
-
i18n(`commands.account.subcommands.info.examples.default`),
|
|
61
|
-
],
|
|
50
|
+
['$0 accounts info', commands.account.subcommands.info.examples.default],
|
|
62
51
|
[
|
|
63
52
|
'$0 accounts info MyAccount',
|
|
64
|
-
|
|
53
|
+
commands.account.subcommands.info.examples.nameBased,
|
|
65
54
|
],
|
|
66
55
|
[
|
|
67
56
|
'$0 accounts info 1234567',
|
|
68
|
-
|
|
57
|
+
commands.account.subcommands.info.examples.idBased,
|
|
69
58
|
],
|
|
70
59
|
]);
|
|
71
60
|
return yargs;
|
package/commands/account/list.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
2
1
|
import { getConfigPath, getConfigAccounts, getDefaultAccountOverrideFilePath, getDisplayDefaultAccount, getConfigDefaultAccount, } from '@hubspot/local-dev-lib/config';
|
|
3
2
|
import { getAccountIdentifier } from '@hubspot/local-dev-lib/config/getAccountIdentifier';
|
|
4
3
|
import { indent } from '../../lib/ui/index.js';
|
|
5
4
|
import { getTableContents, getTableHeader } from '../../lib/ui/table.js';
|
|
6
5
|
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
7
6
|
import { isSandbox, isDeveloperTestAccount } from '../../lib/accountTypes.js';
|
|
8
|
-
import { i18n } from '../../lib/lang.js';
|
|
9
7
|
import { HUBSPOT_ACCOUNT_TYPES, HUBSPOT_ACCOUNT_TYPE_STRINGS, } from '@hubspot/local-dev-lib/constants/config';
|
|
10
8
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
9
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
10
|
+
import { commands } from '../../lang/en.js';
|
|
11
11
|
const command = ['list', 'ls'];
|
|
12
|
-
const describe =
|
|
12
|
+
const describe = commands.account.subcommands.list.describe;
|
|
13
13
|
function sortAndMapAccounts(accounts) {
|
|
14
14
|
const mappedAccountData = {};
|
|
15
15
|
// Standard and app developer accounts
|
|
@@ -72,33 +72,27 @@ async function handler(args) {
|
|
|
72
72
|
const mappedAccountData = sortAndMapAccounts(accountsList);
|
|
73
73
|
const accountData = getAccountData(mappedAccountData);
|
|
74
74
|
accountData.unshift(getTableHeader([
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
commands.account.subcommands.list.labels.name,
|
|
76
|
+
commands.account.subcommands.list.labels.accountId,
|
|
77
|
+
commands.account.subcommands.list.labels.authType,
|
|
78
78
|
]));
|
|
79
79
|
// If a default account is present in the config, display it
|
|
80
80
|
if (configPath) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
logger.log(`${indent(1)}${i18n(`commands.account.subcommands.list.defaultAccount`, {
|
|
86
|
-
account: getDisplayDefaultAccount(),
|
|
87
|
-
})}`);
|
|
88
|
-
logger.log('');
|
|
81
|
+
uiLogger.log(commands.account.subcommands.list.defaultAccountTitle);
|
|
82
|
+
uiLogger.log(`${indent(1)}${commands.account.subcommands.list.configPath(configPath)}`);
|
|
83
|
+
uiLogger.log(`${indent(1)}${commands.account.subcommands.list.defaultAccount(getDisplayDefaultAccount().toString())}`);
|
|
84
|
+
uiLogger.log('');
|
|
89
85
|
}
|
|
90
86
|
// If a default account override is present, display it
|
|
91
87
|
const overrideFilePath = getDefaultAccountOverrideFilePath();
|
|
92
88
|
if (overrideFilePath) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
})}`);
|
|
98
|
-
logger.log('');
|
|
89
|
+
uiLogger.log(commands.account.subcommands.list.overrideFilePathTitle);
|
|
90
|
+
uiLogger.log(`${indent(1)}${commands.account.subcommands.list.overrideFilePath(overrideFilePath)}`);
|
|
91
|
+
uiLogger.log(`${indent(1)}${commands.account.subcommands.list.overrideAccount(getConfigDefaultAccount().toString())}`);
|
|
92
|
+
uiLogger.log('');
|
|
99
93
|
}
|
|
100
|
-
|
|
101
|
-
|
|
94
|
+
uiLogger.log(commands.account.subcommands.list.accounts);
|
|
95
|
+
uiLogger.log(getTableContents(accountData, { border: { bodyLeft: ' ' } }));
|
|
102
96
|
}
|
|
103
97
|
function accountListBuilder(yargs) {
|
|
104
98
|
yargs.example([['$0 accounts list']]);
|