@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
|
@@ -1,28 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { uiLogger } from '../../../lib/ui/logger.js';
|
|
2
2
|
import { downloadSchemas, getResolvedPath, } from '@hubspot/local-dev-lib/customObjects';
|
|
3
3
|
import { inputPrompt } from '../../../lib/prompts/promptUtils.js';
|
|
4
4
|
import { trackCommandUsage } from '../../../lib/usageTracking.js';
|
|
5
|
-
import {
|
|
5
|
+
import { commands } from '../../../lang/en.js';
|
|
6
6
|
import { logSchemas } from '../../../lib/schema.js';
|
|
7
7
|
import { logError } from '../../../lib/errorHandlers/index.js';
|
|
8
8
|
import { makeYargsBuilder } from '../../../lib/yargsUtils.js';
|
|
9
9
|
const command = 'fetch-all [dest]';
|
|
10
|
-
const describe =
|
|
10
|
+
const describe = commands.customObject.subcommands.schema.subcommands.fetchAll.describe;
|
|
11
11
|
async function handler(args) {
|
|
12
12
|
const { derivedAccountId, dest: providedDest } = args;
|
|
13
13
|
trackCommandUsage('custom-object-schema-fetch-all', {}, derivedAccountId);
|
|
14
14
|
try {
|
|
15
15
|
const dest = providedDest ||
|
|
16
|
-
(await inputPrompt(
|
|
16
|
+
(await inputPrompt(commands.customObject.subcommands.schema.subcommands.fetchAll.inputDest));
|
|
17
17
|
const schemas = await downloadSchemas(derivedAccountId, dest);
|
|
18
18
|
logSchemas(schemas);
|
|
19
|
-
|
|
20
|
-
path: getResolvedPath(dest),
|
|
21
|
-
}));
|
|
19
|
+
uiLogger.success(commands.customObject.subcommands.schema.subcommands.fetchAll.success.fetch(getResolvedPath(dest)));
|
|
22
20
|
}
|
|
23
21
|
catch (e) {
|
|
24
22
|
logError(e);
|
|
25
|
-
|
|
23
|
+
uiLogger.error(commands.customObject.subcommands.schema.subcommands.fetchAll.errors.fetch);
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
26
|
function schemaFetchAllBuilder(yargs) {
|
|
@@ -30,15 +28,18 @@ function schemaFetchAllBuilder(yargs) {
|
|
|
30
28
|
.example([
|
|
31
29
|
[
|
|
32
30
|
'$0 custom-object schema fetch-all',
|
|
33
|
-
|
|
31
|
+
commands.customObject.subcommands.schema.subcommands.fetchAll.examples
|
|
32
|
+
.default,
|
|
34
33
|
],
|
|
35
34
|
[
|
|
36
35
|
'$0 custom-object schema fetch-all my/folder',
|
|
37
|
-
|
|
36
|
+
commands.customObject.subcommands.schema.subcommands.fetchAll.examples
|
|
37
|
+
.specifyPath,
|
|
38
38
|
],
|
|
39
39
|
])
|
|
40
40
|
.positional('dest', {
|
|
41
|
-
describe:
|
|
41
|
+
describe: commands.customObject.subcommands.schema.subcommands.fetchAll
|
|
42
|
+
.positionals.dest.describe,
|
|
42
43
|
type: 'string',
|
|
43
44
|
});
|
|
44
45
|
return yargs;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { fetchObjectSchemas } from '@hubspot/local-dev-lib/api/customObjects';
|
|
2
|
-
import {
|
|
2
|
+
import { uiLogger } from '../../../lib/ui/logger.js';
|
|
3
3
|
import { downloadSchema, getResolvedPath, } from '@hubspot/local-dev-lib/customObjects';
|
|
4
4
|
import { inputPrompt, listPrompt } from '../../../lib/prompts/promptUtils.js';
|
|
5
5
|
import { trackCommandUsage } from '../../../lib/usageTracking.js';
|
|
6
|
-
import {
|
|
6
|
+
import { commands } from '../../../lang/en.js';
|
|
7
7
|
import { logError } from '../../../lib/errorHandlers/index.js';
|
|
8
8
|
import { makeYargsBuilder } from '../../../lib/yargsUtils.js';
|
|
9
9
|
const command = 'fetch [name] [dest]';
|
|
10
|
-
const describe =
|
|
10
|
+
const describe = commands.customObject.subcommands.schema.subcommands.fetch.describe;
|
|
11
11
|
async function handler(args) {
|
|
12
12
|
const { name: providedName, dest: providedDest, derivedAccountId } = args;
|
|
13
13
|
trackCommandUsage('custom-object-schema-fetch', {}, derivedAccountId);
|
|
@@ -17,21 +17,17 @@ async function handler(args) {
|
|
|
17
17
|
const schemaNames = results?.map(({ name: schemaName }) => schemaName);
|
|
18
18
|
name =
|
|
19
19
|
providedName ||
|
|
20
|
-
(await listPrompt(
|
|
20
|
+
(await listPrompt(commands.customObject.subcommands.schema.subcommands.fetch.selectSchema, {
|
|
21
21
|
choices: schemaNames,
|
|
22
22
|
}));
|
|
23
23
|
const dest = providedDest ||
|
|
24
|
-
(await inputPrompt(
|
|
24
|
+
(await inputPrompt(commands.customObject.subcommands.schema.subcommands.fetch.inputDest));
|
|
25
25
|
await downloadSchema(derivedAccountId, name, dest);
|
|
26
|
-
|
|
27
|
-
path: getResolvedPath(dest, name),
|
|
28
|
-
}));
|
|
26
|
+
uiLogger.success(commands.customObject.subcommands.schema.subcommands.fetch.success.savedToPath(getResolvedPath(dest, name)));
|
|
29
27
|
}
|
|
30
28
|
catch (e) {
|
|
31
29
|
logError(e);
|
|
32
|
-
|
|
33
|
-
name: name || '',
|
|
34
|
-
}));
|
|
30
|
+
uiLogger.error(commands.customObject.subcommands.schema.subcommands.fetch.errors.fetch(name || ''));
|
|
35
31
|
}
|
|
36
32
|
}
|
|
37
33
|
function schemaFetchBuilder(yargs) {
|
|
@@ -39,19 +35,23 @@ function schemaFetchBuilder(yargs) {
|
|
|
39
35
|
.example([
|
|
40
36
|
[
|
|
41
37
|
'$0 custom-object schema fetch schemaName',
|
|
42
|
-
|
|
38
|
+
commands.customObject.subcommands.schema.subcommands.fetch.examples
|
|
39
|
+
.default,
|
|
43
40
|
],
|
|
44
41
|
[
|
|
45
42
|
'$0 custom-object schema fetch schemaName my/folder',
|
|
46
|
-
|
|
43
|
+
commands.customObject.subcommands.schema.subcommands.fetch.examples
|
|
44
|
+
.specifyPath,
|
|
47
45
|
],
|
|
48
46
|
])
|
|
49
47
|
.positional('name', {
|
|
50
|
-
describe:
|
|
48
|
+
describe: commands.customObject.subcommands.schema.subcommands.fetch.positionals
|
|
49
|
+
.name.describe,
|
|
51
50
|
type: 'string',
|
|
52
51
|
})
|
|
53
52
|
.positional('dest', {
|
|
54
|
-
describe:
|
|
53
|
+
describe: commands.customObject.subcommands.schema.subcommands.fetch.positionals
|
|
54
|
+
.dest.describe,
|
|
55
55
|
type: 'string',
|
|
56
56
|
});
|
|
57
57
|
return yargs;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { uiLogger } from '../../../lib/ui/logger.js';
|
|
2
2
|
import { logError } from '../../../lib/errorHandlers/index.js';
|
|
3
3
|
import { trackCommandUsage } from '../../../lib/usageTracking.js';
|
|
4
4
|
import { listSchemas } from '../../../lib/schema.js';
|
|
5
|
-
import {
|
|
5
|
+
import { commands } from '../../../lang/en.js';
|
|
6
6
|
import { makeYargsBuilder } from '../../../lib/yargsUtils.js';
|
|
7
7
|
const command = 'list';
|
|
8
|
-
const describe =
|
|
8
|
+
const describe = commands.customObject.subcommands.schema.subcommands.list.describe;
|
|
9
9
|
async function handler(args) {
|
|
10
10
|
const { derivedAccountId } = args;
|
|
11
11
|
trackCommandUsage('custom-object-schema-list', {}, derivedAccountId);
|
|
@@ -14,7 +14,7 @@ async function handler(args) {
|
|
|
14
14
|
}
|
|
15
15
|
catch (e) {
|
|
16
16
|
logError(e);
|
|
17
|
-
|
|
17
|
+
uiLogger.error(commands.customObject.subcommands.schema.subcommands.list.errors.list);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
function schemaListBuilder(yargs) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fetchObjectSchemas, updateObjectSchema, } from '@hubspot/local-dev-lib/api/customObjects';
|
|
2
|
-
import {
|
|
2
|
+
import { uiLogger } from '../../../lib/ui/logger.js';
|
|
3
3
|
import { getAbsoluteFilePath } from '@hubspot/local-dev-lib/path';
|
|
4
4
|
import { ENVIRONMENTS } from '@hubspot/local-dev-lib/constants/environments';
|
|
5
5
|
import { getEnv } from '@hubspot/local-dev-lib/config';
|
|
@@ -8,19 +8,20 @@ import { listPrompt } from '../../../lib/prompts/promptUtils.js';
|
|
|
8
8
|
import { logError } from '../../../lib/errorHandlers/index.js';
|
|
9
9
|
import { checkAndConvertToJson } from '../../../lib/validation.js';
|
|
10
10
|
import { trackCommandUsage } from '../../../lib/usageTracking.js';
|
|
11
|
-
import {
|
|
11
|
+
import { commands } from '../../../lang/en.js';
|
|
12
12
|
import { EXIT_CODES } from '../../../lib/enums/exitCodes.js';
|
|
13
13
|
import { isSchemaDefinition } from '../../../lib/customObject.js';
|
|
14
14
|
import { makeYargsBuilder } from '../../../lib/yargsUtils.js';
|
|
15
15
|
const command = 'update [name]';
|
|
16
|
-
const describe =
|
|
16
|
+
const describe = commands.customObject.subcommands.schema.subcommands.update.describe;
|
|
17
17
|
async function handler(args) {
|
|
18
18
|
const { path, name: providedName, derivedAccountId } = args;
|
|
19
19
|
trackCommandUsage('custom-object-schema-update', {}, derivedAccountId);
|
|
20
20
|
const filePath = getAbsoluteFilePath(path);
|
|
21
21
|
const schemaJson = checkAndConvertToJson(filePath);
|
|
22
22
|
if (!isSchemaDefinition(schemaJson)) {
|
|
23
|
-
|
|
23
|
+
uiLogger.error(commands.customObject.subcommands.schema.subcommands.update.errors
|
|
24
|
+
.invalidSchema);
|
|
24
25
|
process.exit(EXIT_CODES.ERROR);
|
|
25
26
|
}
|
|
26
27
|
let name = providedName;
|
|
@@ -30,29 +31,28 @@ async function handler(args) {
|
|
|
30
31
|
name =
|
|
31
32
|
providedName && typeof providedName === 'string'
|
|
32
33
|
? providedName
|
|
33
|
-
: await listPrompt(
|
|
34
|
+
: await listPrompt(commands.customObject.subcommands.schema.subcommands.update
|
|
35
|
+
.selectSchema, {
|
|
34
36
|
choices: schemaNames,
|
|
35
37
|
});
|
|
36
38
|
const { data } = await updateObjectSchema(derivedAccountId, name, schemaJson);
|
|
37
|
-
|
|
38
|
-
url: `${getHubSpotWebsiteOrigin(getEnv() === 'qa' ? ENVIRONMENTS.QA : ENVIRONMENTS.PROD)}/contacts/${derivedAccountId}/objects/${data.objectTypeId}`,
|
|
39
|
-
}));
|
|
39
|
+
uiLogger.success(commands.customObject.subcommands.schema.subcommands.update.success.viewAtUrl(`${getHubSpotWebsiteOrigin(getEnv() === 'qa' ? ENVIRONMENTS.QA : ENVIRONMENTS.PROD)}/contacts/${derivedAccountId}/objects/${data.objectTypeId}`));
|
|
40
40
|
}
|
|
41
41
|
catch (e) {
|
|
42
42
|
logError(e, { accountId: derivedAccountId });
|
|
43
|
-
|
|
44
|
-
definition: path,
|
|
45
|
-
}));
|
|
43
|
+
uiLogger.error(commands.customObject.subcommands.schema.subcommands.update.errors.update(path));
|
|
46
44
|
}
|
|
47
45
|
}
|
|
48
46
|
function schemaUpdateBuilder(yargs) {
|
|
49
47
|
yargs
|
|
50
48
|
.positional('name', {
|
|
51
|
-
describe:
|
|
49
|
+
describe: commands.customObject.subcommands.schema.subcommands.update.positionals
|
|
50
|
+
.name.describe,
|
|
52
51
|
type: 'string',
|
|
53
52
|
})
|
|
54
53
|
.option('path', {
|
|
55
|
-
describe:
|
|
54
|
+
describe: commands.customObject.subcommands.schema.subcommands.update.options.path
|
|
55
|
+
.describe,
|
|
56
56
|
type: 'string',
|
|
57
57
|
required: true,
|
|
58
58
|
});
|
|
@@ -4,10 +4,10 @@ import fetchAllCommand from './schema/fetch-all.js';
|
|
|
4
4
|
import deleteCommand from './schema/delete.js';
|
|
5
5
|
import listCommand from './schema/list.js';
|
|
6
6
|
import updateSchema from './schema/update.js';
|
|
7
|
-
import {
|
|
7
|
+
import { commands } from '../../lang/en.js';
|
|
8
8
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
9
9
|
const command = ['schema', 'schemas'];
|
|
10
|
-
const describe =
|
|
10
|
+
const describe = commands.customObject.subcommands.schema.describe;
|
|
11
11
|
function customObjectSchemaBuilder(yargs) {
|
|
12
12
|
yargs
|
|
13
13
|
.command(listCommand)
|
package/commands/customObject.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import schemaCommand from './customObject/schema.js';
|
|
2
2
|
import createCommand from './customObject/create.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { uiBetaTag, uiLink } from '../lib/ui/index.js';
|
|
3
|
+
import { commands } from '../lang/en.js';
|
|
4
|
+
import { uiBetaTag } from '../lib/ui/index.js';
|
|
6
5
|
import { makeYargsBuilder } from '../lib/yargsUtils.js';
|
|
6
|
+
import { uiLogger } from '../lib/ui/logger.js';
|
|
7
7
|
const command = ['custom-object', 'custom-objects', 'co'];
|
|
8
|
-
const describe = uiBetaTag(
|
|
8
|
+
const describe = uiBetaTag(commands.customObject.describe, false);
|
|
9
9
|
function logBetaMessage() {
|
|
10
|
-
uiBetaTag(
|
|
11
|
-
|
|
12
|
-
logger.log();
|
|
10
|
+
uiBetaTag(commands.customObject.betaMessage);
|
|
11
|
+
uiLogger.log(commands.customObject.seeMoreLink);
|
|
13
12
|
}
|
|
14
13
|
function customObjectBuilder(yargs) {
|
|
15
14
|
yargs.middleware([logBetaMessage]);
|
package/commands/doctor.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import { trackCommandMetadataUsage, trackCommandUsage, } from '../lib/usageTracking.js';
|
|
4
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
5
4
|
import { Doctor } from '../lib/doctor/Doctor.js';
|
|
6
5
|
import { EXIT_CODES } from '../lib/enums/exitCodes.js';
|
|
7
6
|
import { getCwd } from '@hubspot/local-dev-lib/path';
|
|
8
7
|
import { makeYargsBuilder } from '../lib/yargsUtils.js';
|
|
9
|
-
import {
|
|
8
|
+
import { uiLogger } from '../lib/ui/logger.js';
|
|
9
|
+
import { commands } from '../lang/en.js';
|
|
10
10
|
const command = 'doctor';
|
|
11
|
-
const describe =
|
|
11
|
+
const describe = commands.doctor.describe;
|
|
12
12
|
const handler = async (args) => {
|
|
13
13
|
const { outputDir } = args;
|
|
14
14
|
const doctor = new Doctor();
|
|
@@ -20,10 +20,10 @@ const handler = async (args) => {
|
|
|
20
20
|
}
|
|
21
21
|
if (!outputDir) {
|
|
22
22
|
if (output?.diagnosis) {
|
|
23
|
-
|
|
23
|
+
uiLogger.log(output.diagnosis);
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
26
|
-
|
|
26
|
+
uiLogger.error(commands.doctor.errors.generatingDiagnosis);
|
|
27
27
|
return process.exit(EXIT_CODES.ERROR);
|
|
28
28
|
}
|
|
29
29
|
return process.exit(EXIT_CODES.SUCCESS);
|
|
@@ -35,20 +35,17 @@ const handler = async (args) => {
|
|
|
35
35
|
const outputFile = path.join(outputDirPath, `hubspot-doctor-${new Date().toISOString()}.json`);
|
|
36
36
|
try {
|
|
37
37
|
fs.writeFileSync(outputFile, JSON.stringify(output, null, 4));
|
|
38
|
-
|
|
38
|
+
uiLogger.success(commands.doctor.outputWritten(outputFile));
|
|
39
39
|
}
|
|
40
40
|
catch (e) {
|
|
41
|
-
|
|
42
|
-
file: outputFile,
|
|
43
|
-
errorMessage: e instanceof Error ? e.message : e,
|
|
44
|
-
}));
|
|
41
|
+
uiLogger.error(commands.doctor.errors.unableToWriteOutputFile(outputFile, e instanceof Error ? e.message : e));
|
|
45
42
|
return process.exit(EXIT_CODES.ERROR);
|
|
46
43
|
}
|
|
47
44
|
return process.exit(EXIT_CODES.SUCCESS);
|
|
48
45
|
};
|
|
49
46
|
function doctorBuilder(yargs) {
|
|
50
47
|
yargs.option('output-dir', {
|
|
51
|
-
describe:
|
|
48
|
+
describe: commands.doctor.options.outputDir,
|
|
52
49
|
type: 'string',
|
|
53
50
|
});
|
|
54
51
|
return yargs;
|
package/commands/feedback.js
CHANGED
|
@@ -1,25 +1,20 @@
|
|
|
1
1
|
import open from 'open';
|
|
2
|
-
import { i18n } from '../lib/lang.js';
|
|
3
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
4
2
|
import { confirmPrompt } from '../lib/prompts/promptUtils.js';
|
|
5
3
|
import { makeYargsBuilder } from '../lib/yargsUtils.js';
|
|
6
4
|
import { EXIT_CODES } from '../lib/enums/exitCodes.js';
|
|
7
|
-
import {
|
|
5
|
+
import { commands } from '../lang/en.js';
|
|
6
|
+
import { uiLogger } from '../lib/ui/logger.js';
|
|
8
7
|
const FEEDBACK_URL = 'https://developers.hubspot.com/feedback';
|
|
9
8
|
const command = 'feedback';
|
|
10
|
-
const describe =
|
|
9
|
+
const describe = commands.project.feedback.describe;
|
|
11
10
|
async function handler() {
|
|
12
|
-
const shouldOpen = await confirmPrompt(
|
|
11
|
+
const shouldOpen = await confirmPrompt(commands.project.feedback.openPrompt);
|
|
13
12
|
if (!shouldOpen) {
|
|
14
|
-
|
|
15
|
-
url: uiLink('the developer feedback form', FEEDBACK_URL),
|
|
16
|
-
}));
|
|
13
|
+
uiLogger.log(commands.project.feedback.error(FEEDBACK_URL));
|
|
17
14
|
process.exit(EXIT_CODES.ERROR);
|
|
18
15
|
}
|
|
19
16
|
open(FEEDBACK_URL, { url: true });
|
|
20
|
-
|
|
21
|
-
url: uiLink('the developer feedback form', FEEDBACK_URL),
|
|
22
|
-
}));
|
|
17
|
+
uiLogger.success(commands.project.feedback.success(FEEDBACK_URL));
|
|
23
18
|
process.exit(EXIT_CODES.SUCCESS);
|
|
24
19
|
}
|
|
25
20
|
function feedbackBuilder(yargs) {
|
package/commands/fetch.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { downloadFileOrFolder } from '@hubspot/local-dev-lib/fileMapper';
|
|
2
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
3
2
|
import { addCmsPublishModeOptions, addOverwriteOptions, getCmsPublishMode, } from '../lib/commonOpts.js';
|
|
4
3
|
import { resolveLocalPath } from '../lib/filesystem.js';
|
|
5
4
|
import { validateCmsPublishMode } from '../lib/validation.js';
|
|
6
5
|
import { trackCommandUsage } from '../lib/usageTracking.js';
|
|
7
|
-
import { i18n } from '../lib/lang.js';
|
|
8
6
|
import { makeYargsBuilder } from '../lib/yargsUtils.js';
|
|
9
7
|
import { EXIT_CODES } from '../lib/enums/exitCodes.js';
|
|
10
8
|
import { logError } from '../lib/errorHandlers/index.js';
|
|
9
|
+
import { commands } from '../lang/en.js';
|
|
10
|
+
import { uiLogger } from '../lib/ui/logger.js';
|
|
11
11
|
const command = 'fetch <src> [dest]';
|
|
12
|
-
const describe =
|
|
12
|
+
const describe = commands.fetch.describe;
|
|
13
13
|
const handler = async (options) => {
|
|
14
14
|
const { src, dest } = options;
|
|
15
15
|
if (!validateCmsPublishMode(options)) {
|
|
16
16
|
process.exit(EXIT_CODES.ERROR);
|
|
17
17
|
}
|
|
18
18
|
if (typeof src !== 'string') {
|
|
19
|
-
|
|
19
|
+
uiLogger.error(commands.fetch.errors.sourceRequired);
|
|
20
20
|
process.exit(EXIT_CODES.ERROR);
|
|
21
21
|
}
|
|
22
22
|
const { derivedAccountId } = options;
|
|
@@ -38,16 +38,16 @@ const handler = async (options) => {
|
|
|
38
38
|
};
|
|
39
39
|
const fetchBuilder = (yargs) => {
|
|
40
40
|
yargs.positional('src', {
|
|
41
|
-
describe:
|
|
41
|
+
describe: commands.fetch.positionals.src.describe,
|
|
42
42
|
type: 'string',
|
|
43
43
|
});
|
|
44
44
|
yargs.positional('dest', {
|
|
45
|
-
describe:
|
|
45
|
+
describe: commands.fetch.positionals.dest.describe,
|
|
46
46
|
type: 'string',
|
|
47
47
|
});
|
|
48
48
|
yargs.options({
|
|
49
49
|
staging: {
|
|
50
|
-
describe:
|
|
50
|
+
describe: commands.fetch.options.staging.describe,
|
|
51
51
|
type: 'boolean',
|
|
52
52
|
default: false,
|
|
53
53
|
hidden: true,
|
|
@@ -56,7 +56,7 @@ const fetchBuilder = (yargs) => {
|
|
|
56
56
|
yargs.options({
|
|
57
57
|
assetVersion: {
|
|
58
58
|
type: 'number',
|
|
59
|
-
describe:
|
|
59
|
+
describe: commands.fetch.options.assetVersion.describe,
|
|
60
60
|
},
|
|
61
61
|
});
|
|
62
62
|
addCmsPublishModeOptions(yargs, { read: true });
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { downloadFileOrFolder } from '@hubspot/local-dev-lib/fileManager';
|
|
2
|
-
import {
|
|
2
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
3
3
|
import { resolveLocalPath } from '../../lib/filesystem.js';
|
|
4
4
|
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
5
|
-
import {
|
|
5
|
+
import { commands } from '../../lang/en.js';
|
|
6
6
|
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
7
7
|
import { logError } from '../../lib/errorHandlers/index.js';
|
|
8
8
|
import { addOverwriteOptions } from '../../lib/commonOpts.js';
|
|
9
9
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
10
10
|
const command = 'fetch <src> [dest]';
|
|
11
|
-
const describe =
|
|
11
|
+
const describe = commands.filemanager.subcommands.fetch.describe;
|
|
12
12
|
async function handler(args) {
|
|
13
13
|
const { src, includeArchived, derivedAccountId, overwrite } = args;
|
|
14
14
|
if (typeof src !== 'string') {
|
|
15
|
-
|
|
15
|
+
uiLogger.error(commands.filemanager.subcommands.fetch.errors.sourceRequired);
|
|
16
16
|
process.exit(EXIT_CODES.ERROR);
|
|
17
17
|
}
|
|
18
18
|
const dest = resolveLocalPath(args.dest);
|
|
@@ -29,16 +29,16 @@ async function handler(args) {
|
|
|
29
29
|
function fileManagerFetchBuilder(yargs) {
|
|
30
30
|
addOverwriteOptions(yargs);
|
|
31
31
|
yargs.positional('src', {
|
|
32
|
-
describe:
|
|
32
|
+
describe: commands.filemanager.subcommands.fetch.positionals.src.describe,
|
|
33
33
|
type: 'string',
|
|
34
34
|
});
|
|
35
35
|
yargs.positional('dest', {
|
|
36
|
-
describe:
|
|
36
|
+
describe: commands.filemanager.subcommands.fetch.positionals.dest.describe,
|
|
37
37
|
type: 'string',
|
|
38
38
|
});
|
|
39
39
|
yargs.option('include-archived', {
|
|
40
40
|
alias: ['i'],
|
|
41
|
-
describe:
|
|
41
|
+
describe: commands.filemanager.subcommands.fetch.options.includeArchived.describe,
|
|
42
42
|
type: 'boolean',
|
|
43
43
|
});
|
|
44
44
|
return yargs;
|
|
@@ -3,16 +3,16 @@ import path from 'path';
|
|
|
3
3
|
import { uploadFolder } from '@hubspot/local-dev-lib/fileManager';
|
|
4
4
|
import { uploadFile } from '@hubspot/local-dev-lib/api/fileManager';
|
|
5
5
|
import { getCwd, convertToUnixPath } from '@hubspot/local-dev-lib/path';
|
|
6
|
-
import {
|
|
6
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
7
7
|
import { validateSrcAndDestPaths } from '@hubspot/local-dev-lib/cms/modules';
|
|
8
8
|
import { shouldIgnoreFile } from '@hubspot/local-dev-lib/ignoreRules';
|
|
9
9
|
import { ApiErrorContext, logError } from '../../lib/errorHandlers/index.js';
|
|
10
10
|
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
11
|
-
import {
|
|
11
|
+
import { commands } from '../../lang/en.js';
|
|
12
12
|
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
13
13
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
14
14
|
const command = 'upload <src> <dest>';
|
|
15
|
-
const describe =
|
|
15
|
+
const describe = commands.filemanager.subcommands.upload.describe;
|
|
16
16
|
async function handler(args) {
|
|
17
17
|
const { src, dest, derivedAccountId } = args;
|
|
18
18
|
const absoluteSrcPath = path.resolve(getCwd(), src);
|
|
@@ -20,49 +20,36 @@ async function handler(args) {
|
|
|
20
20
|
try {
|
|
21
21
|
stats = fs.statSync(absoluteSrcPath);
|
|
22
22
|
if (!stats.isFile() && !stats.isDirectory()) {
|
|
23
|
-
|
|
24
|
-
path: src,
|
|
25
|
-
}));
|
|
23
|
+
uiLogger.error(commands.filemanager.subcommands.upload.errors.invalidPath(src));
|
|
26
24
|
return;
|
|
27
25
|
}
|
|
28
26
|
}
|
|
29
27
|
catch (e) {
|
|
30
|
-
|
|
31
|
-
path: src,
|
|
32
|
-
}));
|
|
28
|
+
uiLogger.error(commands.filemanager.subcommands.upload.errors.invalidPath(src));
|
|
33
29
|
return;
|
|
34
30
|
}
|
|
35
31
|
if (!dest) {
|
|
36
|
-
|
|
32
|
+
uiLogger.error(commands.filemanager.subcommands.upload.errors.destinationRequired);
|
|
37
33
|
return;
|
|
38
34
|
}
|
|
39
35
|
const normalizedDest = convertToUnixPath(dest);
|
|
40
36
|
trackCommandUsage('filemanager-upload', { type: stats.isFile() ? 'file' : 'folder' }, derivedAccountId);
|
|
41
37
|
const srcDestIssues = await validateSrcAndDestPaths({ isLocal: true, path: src }, { isHubSpot: true, path: dest });
|
|
42
38
|
if (srcDestIssues.length) {
|
|
43
|
-
srcDestIssues.forEach(({ message }) =>
|
|
39
|
+
srcDestIssues.forEach(({ message }) => uiLogger.error(message));
|
|
44
40
|
process.exit(EXIT_CODES.ERROR);
|
|
45
41
|
}
|
|
46
42
|
if (stats.isFile()) {
|
|
47
43
|
if (shouldIgnoreFile(absoluteSrcPath)) {
|
|
48
|
-
|
|
49
|
-
path: src,
|
|
50
|
-
}));
|
|
44
|
+
uiLogger.error(commands.filemanager.subcommands.upload.errors.fileIgnored(src));
|
|
51
45
|
return;
|
|
52
46
|
}
|
|
53
47
|
uploadFile(derivedAccountId, absoluteSrcPath, normalizedDest)
|
|
54
48
|
.then(() => {
|
|
55
|
-
|
|
56
|
-
accountId: derivedAccountId,
|
|
57
|
-
dest: normalizedDest,
|
|
58
|
-
src,
|
|
59
|
-
}));
|
|
49
|
+
uiLogger.success(commands.filemanager.subcommands.upload.success.upload(src, normalizedDest, derivedAccountId));
|
|
60
50
|
})
|
|
61
51
|
.catch(error => {
|
|
62
|
-
|
|
63
|
-
dest: normalizedDest,
|
|
64
|
-
src,
|
|
65
|
-
}));
|
|
52
|
+
uiLogger.error(commands.filemanager.subcommands.upload.errors.upload(src, normalizedDest));
|
|
66
53
|
logError(error, new ApiErrorContext({
|
|
67
54
|
accountId: derivedAccountId,
|
|
68
55
|
request: normalizedDest,
|
|
@@ -71,19 +58,13 @@ async function handler(args) {
|
|
|
71
58
|
});
|
|
72
59
|
}
|
|
73
60
|
else {
|
|
74
|
-
|
|
75
|
-
accountId: derivedAccountId,
|
|
76
|
-
dest,
|
|
77
|
-
src,
|
|
78
|
-
}));
|
|
61
|
+
uiLogger.log(commands.filemanager.subcommands.upload.logs.uploading(src, dest, derivedAccountId));
|
|
79
62
|
uploadFolder(derivedAccountId, absoluteSrcPath, dest)
|
|
80
63
|
.then(() => {
|
|
81
|
-
|
|
82
|
-
dest,
|
|
83
|
-
}));
|
|
64
|
+
uiLogger.success(commands.filemanager.subcommands.upload.success.uploadComplete(dest));
|
|
84
65
|
})
|
|
85
66
|
.catch(error => {
|
|
86
|
-
|
|
67
|
+
uiLogger.error(commands.filemanager.subcommands.upload.errors.uploadingFailed);
|
|
87
68
|
logError(error, {
|
|
88
69
|
accountId: derivedAccountId,
|
|
89
70
|
});
|
|
@@ -92,11 +73,11 @@ async function handler(args) {
|
|
|
92
73
|
}
|
|
93
74
|
function fileManagerUploadBuilder(yargs) {
|
|
94
75
|
yargs.positional('src', {
|
|
95
|
-
describe:
|
|
76
|
+
describe: commands.filemanager.subcommands.upload.positionals.src.describe,
|
|
96
77
|
type: 'string',
|
|
97
78
|
});
|
|
98
79
|
yargs.positional('dest', {
|
|
99
|
-
describe:
|
|
80
|
+
describe: commands.filemanager.subcommands.upload.positionals.dest.describe,
|
|
100
81
|
type: 'string',
|
|
101
82
|
});
|
|
102
83
|
return yargs;
|
package/commands/filemanager.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import upload from './filemanager/upload.js';
|
|
2
2
|
import fetch from './filemanager/fetch.js';
|
|
3
|
-
import {
|
|
3
|
+
import { commands } from '../lang/en.js';
|
|
4
4
|
import { makeYargsBuilder } from '../lib/yargsUtils.js';
|
|
5
5
|
const command = 'filemanager';
|
|
6
|
-
const describe =
|
|
6
|
+
const describe = commands.filemanager.describe;
|
|
7
7
|
function fileManagerBuilder(yargs) {
|
|
8
8
|
yargs.command(upload).command(fetch).demandCommand(1, '');
|
|
9
9
|
return yargs;
|