@hubspot/cli 7.8.12-experimental.1 → 7.9.0-beta.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/commands/__tests__/cms.test.js +44 -1
- package/commands/__tests__/customObject.test.js +22 -1
- package/commands/__tests__/project.test.js +2 -0
- package/commands/account/auth.js +1 -0
- package/commands/auth.js +1 -0
- package/commands/{__tests__/remove.test.js → cms/__tests__/delete.test.js} +8 -8
- package/commands/{__tests__ → cms/__tests__}/fetch.test.js +3 -3
- package/commands/{__tests__ → cms/__tests__}/function.test.js +7 -3
- package/commands/{__tests__ → cms/__tests__}/lint.test.js +3 -3
- package/commands/{__tests__ → cms/__tests__}/list.test.js +3 -3
- package/commands/{__tests__ → cms/__tests__}/mv.test.js +3 -3
- package/commands/{__tests__ → cms/__tests__}/theme.test.js +9 -2
- package/commands/cms/app/create.d.ts +9 -0
- package/commands/cms/app/create.js +82 -0
- package/commands/cms/app.d.ts +3 -0
- package/commands/cms/app.js +17 -0
- package/commands/cms/delete.d.ts +6 -0
- package/commands/cms/delete.js +43 -0
- package/commands/cms/fetch.d.ts +12 -0
- package/commands/cms/fetch.js +79 -0
- package/commands/{__tests__ → cms/function/__tests__}/logs.test.js +4 -5
- package/commands/cms/function/create.d.ts +12 -0
- package/commands/cms/function/create.js +84 -0
- package/commands/cms/function/deploy.d.ts +6 -0
- package/commands/cms/function/deploy.js +89 -0
- package/commands/cms/function/list.d.ts +6 -0
- package/commands/cms/function/list.js +60 -0
- package/commands/cms/function/logs.d.ts +10 -0
- package/commands/cms/function/logs.js +135 -0
- package/commands/cms/function/server.d.ts +10 -0
- package/commands/cms/function/server.js +69 -0
- package/commands/cms/function.d.ts +3 -0
- package/commands/cms/function.js +27 -0
- package/commands/cms/lint.d.ts +6 -0
- package/commands/cms/lint.js +83 -0
- package/commands/cms/list.d.ts +6 -0
- package/commands/cms/list.js +96 -0
- package/commands/cms/module/create.d.ts +11 -0
- package/commands/cms/module/create.js +84 -0
- package/commands/cms/module/marketplace-validate.d.ts +6 -0
- package/commands/cms/module/marketplace-validate.js +45 -0
- package/commands/cms/module.d.ts +3 -0
- package/commands/cms/module.js +17 -0
- package/commands/cms/mv.d.ts +7 -0
- package/commands/cms/mv.js +60 -0
- package/commands/cms/template/create.d.ts +9 -0
- package/commands/cms/template/create.js +72 -0
- package/commands/cms/template.d.ts +3 -0
- package/commands/cms/template.js +17 -0
- package/commands/{theme → cms/theme}/__tests__/marketplace-validate.test.js +2 -2
- package/commands/{theme → cms/theme}/__tests__/preview.test.js +2 -2
- package/commands/cms/theme/create.d.ts +6 -0
- package/commands/cms/theme/create.js +58 -0
- package/commands/cms/theme/generate-selectors.d.ts +6 -0
- package/commands/cms/theme/generate-selectors.js +171 -0
- package/commands/cms/theme/marketplace-validate.d.ts +6 -0
- package/commands/cms/theme/marketplace-validate.js +46 -0
- package/commands/cms/theme/preview.d.ts +12 -0
- package/commands/cms/theme/preview.js +224 -0
- package/commands/cms/theme.d.ts +3 -0
- package/commands/cms/theme.js +25 -0
- package/commands/cms/upload.d.ts +12 -0
- package/commands/cms/upload.js +212 -0
- package/commands/cms/watch.d.ts +14 -0
- package/commands/cms/watch.js +138 -0
- package/commands/cms/webpack/create.d.ts +6 -0
- package/commands/cms/webpack/create.js +58 -0
- package/commands/cms/webpack.d.ts +3 -0
- package/commands/cms/webpack.js +17 -0
- package/commands/cms.js +26 -0
- package/commands/create.js +4 -2
- package/commands/customObject/{schema/__tests__/create.test.js → __tests__/createSchema.test.js} +5 -5
- package/commands/customObject/{schema/__tests__/delete.test.js → __tests__/deleteSchema.test.js} +5 -5
- package/commands/customObject/{schema/__tests__/fetch-all.test.js → __tests__/fetch-all-schemas.test.js} +5 -5
- package/commands/customObject/{schema/__tests__/fetch.test.js → __tests__/fetchSchema.test.js} +5 -5
- package/commands/customObject/{schema/__tests__/list.test.js → __tests__/listSchemas.test.js} +5 -5
- package/commands/customObject/{schema/__tests__/update.test.js → __tests__/updateSchema.test.js} +5 -5
- package/commands/customObject/createSchema.d.ts +6 -0
- package/commands/customObject/createSchema.js +56 -0
- package/commands/customObject/deleteSchema.d.ts +7 -0
- package/commands/customObject/deleteSchema.js +69 -0
- package/commands/customObject/fetchAllSchemas.d.ts +6 -0
- package/commands/customObject/fetchAllSchemas.js +57 -0
- package/commands/customObject/fetchSchema.d.ts +7 -0
- package/commands/customObject/fetchSchema.js +67 -0
- package/commands/customObject/listSchemas.d.ts +4 -0
- package/commands/customObject/listSchemas.js +35 -0
- package/commands/customObject/schema/create.d.ts +4 -6
- package/commands/customObject/schema/create.js +13 -36
- package/commands/customObject/schema/delete.d.ts +4 -7
- package/commands/customObject/schema/delete.js +15 -50
- package/commands/customObject/schema/fetch-all.d.ts +4 -6
- package/commands/customObject/schema/fetch-all.js +14 -41
- package/commands/customObject/schema/fetch.d.ts +4 -7
- package/commands/customObject/schema/fetch.js +14 -49
- package/commands/customObject/schema/list.d.ts +4 -4
- package/commands/customObject/schema/list.js +10 -19
- package/commands/customObject/schema/update.d.ts +4 -7
- package/commands/customObject/schema/update.js +15 -50
- package/commands/customObject/schema.js +4 -2
- package/commands/customObject/updateSchema.d.ts +7 -0
- package/commands/customObject/updateSchema.js +71 -0
- package/commands/customObject.js +16 -1
- package/commands/feedback.js +1 -1
- package/commands/fetch.d.ts +4 -12
- package/commands/fetch.js +19 -46
- package/commands/function/deploy.d.ts +4 -6
- package/commands/function/deploy.js +14 -71
- package/commands/function/list.d.ts +4 -6
- package/commands/function/list.js +14 -40
- package/commands/function/server.d.ts +4 -10
- package/commands/function/server.js +22 -29
- package/commands/function.d.ts +2 -4
- package/commands/function.js +25 -14
- package/commands/lint.d.ts +4 -6
- package/commands/lint.js +13 -65
- package/commands/list.d.ts +4 -6
- package/commands/list.js +13 -74
- package/commands/logs.d.ts +4 -10
- package/commands/logs.js +24 -87
- package/commands/module/marketplace-validate.d.ts +4 -6
- package/commands/module/marketplace-validate.js +15 -27
- package/commands/module.d.ts +2 -2
- package/commands/module.js +17 -15
- package/commands/mv.d.ts +4 -7
- package/commands/mv.js +13 -39
- package/commands/project/__tests__/add.test.js +12 -12
- package/commands/project/__tests__/devUnifiedFlow.test.js +32 -0
- package/commands/project/__tests__/list.test.js +31 -0
- package/commands/project/__tests__/migrate.test.js +1 -0
- package/commands/project/add.d.ts +2 -2
- package/commands/project/add.js +3 -2
- package/commands/project/create.js +1 -1
- package/commands/project/dev/deprecatedFlow.js +2 -2
- package/commands/project/dev/index.js +5 -5
- package/commands/project/dev/unifiedFlow.js +8 -3
- package/commands/project/download.js +5 -2
- package/commands/project/installDeps.d.ts +2 -2
- package/commands/project/installDeps.js +1 -0
- package/commands/project/list.d.ts +4 -0
- package/commands/project/list.js +62 -0
- package/commands/project/migrate.js +5 -2
- package/commands/project.js +2 -0
- package/commands/remove.d.ts +4 -6
- package/commands/remove.js +12 -24
- package/commands/testAccount/create.js +2 -2
- package/commands/testAccount/delete.js +1 -1
- package/commands/theme/generate-selectors.d.ts +4 -6
- package/commands/theme/generate-selectors.js +14 -152
- package/commands/theme/marketplace-validate.d.ts +4 -6
- package/commands/theme/marketplace-validate.js +14 -25
- package/commands/theme/preview.d.ts +4 -12
- package/commands/theme/preview.js +18 -180
- package/commands/theme.d.ts +2 -2
- package/commands/theme.js +19 -13
- package/commands/upload.d.ts +4 -12
- package/commands/upload.js +19 -169
- package/commands/watch.d.ts +4 -14
- package/commands/watch.js +23 -88
- package/lang/en.d.ts +561 -425
- package/lang/en.js +563 -427
- package/lang/en.lyaml +2 -2
- package/lib/__tests__/buildAccount.test.js +2 -2
- package/lib/__tests__/http.test.js +40 -0
- package/lib/buildAccount.d.ts +2 -2
- package/lib/buildAccount.js +7 -7
- package/lib/configMigrate.js +88 -9
- package/lib/constants.d.ts +9 -0
- package/lib/constants.js +9 -0
- package/lib/generateSelectors.js +1 -1
- package/lib/http.d.ts +1 -0
- package/lib/http.js +26 -0
- package/lib/middleware/autoUpdateMiddleware.d.ts +2 -1
- package/lib/middleware/autoUpdateMiddleware.js +12 -2
- package/lib/middleware/commandTargetingUtils.d.ts +1 -1
- package/lib/middleware/commandTargetingUtils.js +16 -20
- package/lib/projects/__tests__/AppDevModeInterface.test.js +95 -109
- package/lib/projects/__tests__/DevServerManager.test.d.ts +1 -0
- package/lib/projects/__tests__/DevServerManager.test.js +183 -0
- package/lib/projects/__tests__/LocalDevProcess.test.js +6 -5
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +6 -6
- package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.d.ts +1 -0
- package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.js +161 -0
- package/lib/projects/__tests__/deploy.test.js +9 -9
- package/lib/projects/__tests__/upload.test.js +2 -2
- package/lib/projects/add/__tests__/v2AddComponent.test.d.ts +1 -0
- package/lib/projects/add/__tests__/{v3AddComponent.test.js → v2AddComponent.test.js} +35 -35
- package/lib/projects/add/{v3AddComponent.d.ts → v2AddComponent.d.ts} +1 -1
- package/lib/projects/add/{v3AddComponent.js → v2AddComponent.js} +5 -5
- package/lib/projects/create/__tests__/v2.test.d.ts +1 -0
- package/lib/projects/create/__tests__/{v3.test.js → v2.test.js} +2 -2
- package/lib/projects/create/index.js +2 -2
- package/lib/projects/create/{v3.d.ts → v2.d.ts} +3 -3
- package/lib/projects/create/{v3.js → v2.js} +3 -3
- package/lib/projects/deploy.d.ts +1 -1
- package/lib/projects/deploy.js +2 -2
- package/lib/projects/localDev/AppDevModeInterface.d.ts +10 -3
- package/lib/projects/localDev/AppDevModeInterface.js +132 -105
- package/lib/projects/localDev/DevServerManager.d.ts +10 -29
- package/lib/projects/localDev/DevServerManager.js +20 -76
- package/lib/projects/localDev/DevServerManager_DEPRECATED.d.ts +40 -0
- package/lib/projects/localDev/DevServerManager_DEPRECATED.js +120 -0
- package/lib/projects/localDev/{LocalDevManager.js → LocalDevManager_DEPRECATED.js} +6 -6
- package/lib/projects/localDev/LocalDevProcess.js +3 -2
- package/lib/projects/localDev/LocalDevState.d.ts +3 -0
- package/lib/projects/localDev/LocalDevState.js +9 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +4 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.js +39 -6
- package/lib/projects/localDev/UIExtensionsDevModeInterface.d.ts +13 -0
- package/lib/projects/localDev/UIExtensionsDevModeInterface.js +37 -0
- package/lib/projects/localDev/helpers/account.d.ts +1 -1
- package/lib/projects/localDev/helpers/account.js +2 -2
- package/lib/projects/localDev/helpers/process.d.ts +1 -0
- package/lib/projects/localDev/helpers/process.js +15 -0
- package/lib/projects/localDev/helpers/project.js +2 -3
- package/lib/projects/localDev/localDevWebsocketServerUtils.d.ts +3 -0
- package/lib/projects/localDev/localDevWebsocketServerUtils.js +9 -0
- package/lib/projects/urls.d.ts +0 -1
- package/lib/projects/urls.js +0 -3
- package/lib/prompts/__tests__/projectAddPrompt.test.js +10 -10
- package/lib/prompts/installAppPrompt.d.ts +1 -6
- package/lib/prompts/installAppPrompt.js +1 -6
- package/lib/prompts/projectAddPrompt.d.ts +2 -2
- package/lib/prompts/projectAddPrompt.js +1 -1
- package/lib/theme/__tests__/migrate.test.js +4 -4
- package/lib/ui/index.d.ts +2 -0
- package/lib/ui/index.js +8 -0
- package/lib/ui/uiMessages.d.ts +5 -0
- package/lib/ui/uiMessages.js +5 -0
- package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +2 -2
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +1 -1
- package/package.json +6 -5
- package/types/Cms.d.ts +6 -6
- package/lib/projects/localDev/DevServerManagerV2.d.ts +0 -22
- package/lib/projects/localDev/DevServerManagerV2.js +0 -81
- /package/commands/{customObject/schema → cms}/__tests__/delete.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/fetch.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/function.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/lint.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/list.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/mv.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/theme.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/function/__tests__}/logs.test.d.ts +0 -0
- /package/commands/{theme → cms/theme}/__tests__/generate-selectors.test.d.ts +0 -0
- /package/commands/{theme → cms/theme}/__tests__/generate-selectors.test.js +0 -0
- /package/commands/{theme → cms/theme}/__tests__/marketplace-validate.test.d.ts +0 -0
- /package/commands/{theme → cms/theme}/__tests__/preview.test.d.ts +0 -0
- /package/commands/{__tests__/remove.test.d.ts → customObject/__tests__/createSchema.test.d.ts} +0 -0
- /package/commands/customObject/{schema/__tests__/create.test.d.ts → __tests__/deleteSchema.test.d.ts} +0 -0
- /package/commands/customObject/{schema/__tests__/fetch-all.test.d.ts → __tests__/fetch-all-schemas.test.d.ts} +0 -0
- /package/commands/customObject/{schema/__tests__/fetch.test.d.ts → __tests__/fetchSchema.test.d.ts} +0 -0
- /package/commands/customObject/{schema/__tests__/list.test.d.ts → __tests__/listSchemas.test.d.ts} +0 -0
- /package/commands/customObject/{schema/__tests__/update.test.d.ts → __tests__/updateSchema.test.d.ts} +0 -0
- /package/{lib/projects/add/__tests__/v3AddComponent.test.d.ts → commands/project/__tests__/list.test.d.ts} +0 -0
- /package/lib/{projects/create/__tests__/v3.test.d.ts → __tests__/http.test.d.ts} +0 -0
- /package/{commands/create → lib/cmsAssets}/api-sample.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/api-sample.js +0 -0
- /package/{commands/create → lib/cmsAssets}/app.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/app.js +0 -0
- /package/{commands/create → lib/cmsAssets}/function.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/function.js +0 -0
- /package/{commands/create → lib/cmsAssets}/index.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/index.js +0 -0
- /package/{commands/create → lib/cmsAssets}/module.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/module.js +0 -0
- /package/{commands/create → lib/cmsAssets}/react-app.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/react-app.js +0 -0
- /package/{commands/create → lib/cmsAssets}/template.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/template.js +0 -0
- /package/{commands/create → lib/cmsAssets}/vue-app.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/vue-app.js +0 -0
- /package/{commands/create → lib/cmsAssets}/webpack-serverless.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/webpack-serverless.js +0 -0
- /package/{commands/create → lib/cmsAssets}/website-theme.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/website-theme.js +0 -0
- /package/lib/projects/localDev/{LocalDevManager.d.ts → LocalDevManager_DEPRECATED.d.ts} +0 -0
|
@@ -1,71 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { downloadSchema, getResolvedPath, } from '@hubspot/local-dev-lib/customObjects';
|
|
4
|
-
import { inputPrompt, listPrompt } from '../../../lib/prompts/promptUtils.js';
|
|
5
|
-
import { trackCommandUsage } from '../../../lib/usageTracking.js';
|
|
6
|
-
import { commands } from '../../../lang/en.js';
|
|
7
|
-
import { logError } from '../../../lib/errorHandlers/index.js';
|
|
1
|
+
import { uiCommandRelocatedMessage, uiCommandRenamedDescription, uiDeprecatedTag, } from '../../../lib/ui/index.js';
|
|
2
|
+
import fetchSchemaCommand from '../fetchSchema.js';
|
|
8
3
|
import { makeYargsBuilder } from '../../../lib/yargsUtils.js';
|
|
9
|
-
|
|
10
|
-
const
|
|
4
|
+
import { commands } from '../../../lang/en.js';
|
|
5
|
+
const command = 'fetch <name> [dest]';
|
|
6
|
+
const describe = uiDeprecatedTag(fetchSchemaCommand.describe, false);
|
|
11
7
|
async function handler(args) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
let name;
|
|
15
|
-
try {
|
|
16
|
-
const { data: { results }, } = await fetchObjectSchemas(derivedAccountId);
|
|
17
|
-
const schemaNames = results?.map(({ name: schemaName }) => schemaName);
|
|
18
|
-
name =
|
|
19
|
-
providedName ||
|
|
20
|
-
(await listPrompt(commands.customObject.subcommands.schema.subcommands.fetch.selectSchema, {
|
|
21
|
-
choices: schemaNames,
|
|
22
|
-
}));
|
|
23
|
-
const dest = providedDest ||
|
|
24
|
-
(await inputPrompt(commands.customObject.subcommands.schema.subcommands.fetch.inputDest));
|
|
25
|
-
await downloadSchema(derivedAccountId, name, dest);
|
|
26
|
-
uiLogger.success(commands.customObject.subcommands.schema.subcommands.fetch.success.savedToPath(getResolvedPath(dest, name)));
|
|
27
|
-
}
|
|
28
|
-
catch (e) {
|
|
29
|
-
logError(e);
|
|
30
|
-
uiLogger.error(commands.customObject.subcommands.schema.subcommands.fetch.errors.fetch(name || ''));
|
|
31
|
-
}
|
|
8
|
+
uiCommandRelocatedMessage('hs custom-object fetch-schema');
|
|
9
|
+
await fetchSchemaCommand.handler(args);
|
|
32
10
|
}
|
|
33
|
-
function
|
|
11
|
+
function deprecatedFetchSchemaBuilder(yargs) {
|
|
34
12
|
yargs
|
|
35
|
-
.example([
|
|
36
|
-
[
|
|
37
|
-
'$0 custom-object schema fetch schemaName',
|
|
38
|
-
commands.customObject.subcommands.schema.subcommands.fetch.examples
|
|
39
|
-
.default,
|
|
40
|
-
],
|
|
41
|
-
[
|
|
42
|
-
'$0 custom-object schema fetch schemaName my/folder',
|
|
43
|
-
commands.customObject.subcommands.schema.subcommands.fetch.examples
|
|
44
|
-
.specifyPath,
|
|
45
|
-
],
|
|
46
|
-
])
|
|
47
13
|
.positional('name', {
|
|
48
|
-
describe: commands.customObject.subcommands.
|
|
49
|
-
.name.describe,
|
|
14
|
+
describe: commands.customObject.subcommands.fetchSchema.positionals.name.describe,
|
|
50
15
|
type: 'string',
|
|
51
16
|
})
|
|
52
17
|
.positional('dest', {
|
|
53
|
-
describe: commands.customObject.subcommands.
|
|
54
|
-
.dest.describe,
|
|
18
|
+
describe: commands.customObject.subcommands.fetchSchema.positionals.dest.describe,
|
|
55
19
|
type: 'string',
|
|
56
20
|
});
|
|
57
21
|
return yargs;
|
|
58
22
|
}
|
|
59
|
-
const
|
|
23
|
+
const verboseDescribe = uiCommandRenamedDescription(fetchSchemaCommand.describe, 'hs custom-object fetch-schema');
|
|
24
|
+
const builder = makeYargsBuilder(deprecatedFetchSchemaBuilder, command, verboseDescribe, {
|
|
60
25
|
useGlobalOptions: true,
|
|
61
26
|
useConfigOptions: true,
|
|
62
27
|
useAccountOptions: true,
|
|
63
28
|
useEnvironmentOptions: true,
|
|
64
29
|
});
|
|
65
|
-
const
|
|
30
|
+
const deprecatedFetchSchemaCommand = {
|
|
66
31
|
command,
|
|
67
32
|
describe,
|
|
68
33
|
handler,
|
|
69
34
|
builder,
|
|
70
35
|
};
|
|
71
|
-
export default
|
|
36
|
+
export default deprecatedFetchSchemaCommand;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
declare const
|
|
4
|
-
export default
|
|
1
|
+
import { YargsCommandModule } from '../../../types/Yargs.js';
|
|
2
|
+
import { SchemaListArgs } from '../listSchemas.js';
|
|
3
|
+
declare const deprecatedListSchemaCommand: YargsCommandModule<unknown, SchemaListArgs>;
|
|
4
|
+
export default deprecatedListSchemaCommand;
|
|
@@ -1,35 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { trackCommandUsage } from '../../../lib/usageTracking.js';
|
|
4
|
-
import { listSchemas } from '../../../lib/schema.js';
|
|
5
|
-
import { commands } from '../../../lang/en.js';
|
|
1
|
+
import { uiCommandRelocatedMessage, uiCommandRenamedDescription, uiDeprecatedTag, } from '../../../lib/ui/index.js';
|
|
2
|
+
import listSchemaCommand from '../listSchemas.js';
|
|
6
3
|
import { makeYargsBuilder } from '../../../lib/yargsUtils.js';
|
|
7
4
|
const command = 'list';
|
|
8
|
-
const describe =
|
|
5
|
+
const describe = uiDeprecatedTag(listSchemaCommand.describe, false);
|
|
9
6
|
async function handler(args) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
try {
|
|
13
|
-
await listSchemas(derivedAccountId);
|
|
14
|
-
}
|
|
15
|
-
catch (e) {
|
|
16
|
-
logError(e);
|
|
17
|
-
uiLogger.error(commands.customObject.subcommands.schema.subcommands.list.errors.list);
|
|
18
|
-
}
|
|
7
|
+
uiCommandRelocatedMessage('hs custom-object list-schemas');
|
|
8
|
+
await listSchemaCommand.handler(args);
|
|
19
9
|
}
|
|
20
|
-
function
|
|
10
|
+
function deprecatedListSchemaBuilder(yargs) {
|
|
21
11
|
return yargs;
|
|
22
12
|
}
|
|
23
|
-
const
|
|
13
|
+
const verboseDescribe = uiCommandRenamedDescription(listSchemaCommand.describe, 'hs custom-object list-schemas');
|
|
14
|
+
const builder = makeYargsBuilder(deprecatedListSchemaBuilder, command, verboseDescribe, {
|
|
24
15
|
useGlobalOptions: true,
|
|
25
16
|
useConfigOptions: true,
|
|
26
17
|
useAccountOptions: true,
|
|
27
18
|
useEnvironmentOptions: true,
|
|
28
19
|
});
|
|
29
|
-
const
|
|
20
|
+
const deprecatedListSchemaCommand = {
|
|
30
21
|
command,
|
|
31
22
|
describe,
|
|
32
23
|
handler,
|
|
33
24
|
builder,
|
|
34
25
|
};
|
|
35
|
-
export default
|
|
26
|
+
export default deprecatedListSchemaCommand;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
declare const schemaUpdateCommand: YargsCommandModule<unknown, SchemaUpdateArgs>;
|
|
7
|
-
export default schemaUpdateCommand;
|
|
1
|
+
import { YargsCommandModule } from '../../../types/Yargs.js';
|
|
2
|
+
import { SchemaUpdateArgs } from '../updateSchema.js';
|
|
3
|
+
declare const deprecatedUpdateSchemaCommand: YargsCommandModule<unknown, SchemaUpdateArgs>;
|
|
4
|
+
export default deprecatedUpdateSchemaCommand;
|
|
@@ -1,74 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { getAbsoluteFilePath } from '@hubspot/local-dev-lib/path';
|
|
4
|
-
import { ENVIRONMENTS } from '@hubspot/local-dev-lib/constants/environments';
|
|
5
|
-
import { getEnv } from '@hubspot/local-dev-lib/config';
|
|
6
|
-
import { getHubSpotWebsiteOrigin } from '@hubspot/local-dev-lib/urls';
|
|
7
|
-
import { listPrompt } from '../../../lib/prompts/promptUtils.js';
|
|
8
|
-
import { logError } from '../../../lib/errorHandlers/index.js';
|
|
9
|
-
import { checkAndConvertToJson } from '../../../lib/validation.js';
|
|
10
|
-
import { trackCommandUsage } from '../../../lib/usageTracking.js';
|
|
11
|
-
import { commands } from '../../../lang/en.js';
|
|
12
|
-
import { EXIT_CODES } from '../../../lib/enums/exitCodes.js';
|
|
13
|
-
import { isSchemaDefinition } from '../../../lib/customObject.js';
|
|
1
|
+
import { uiCommandRelocatedMessage, uiCommandRenamedDescription, uiDeprecatedTag, } from '../../../lib/ui/index.js';
|
|
2
|
+
import updateSchemaCommand from '../updateSchema.js';
|
|
14
3
|
import { makeYargsBuilder } from '../../../lib/yargsUtils.js';
|
|
15
|
-
|
|
16
|
-
const
|
|
4
|
+
import { commands } from '../../../lang/en.js';
|
|
5
|
+
const command = 'update <name>';
|
|
6
|
+
const describe = uiDeprecatedTag(updateSchemaCommand.describe, false);
|
|
17
7
|
async function handler(args) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const filePath = getAbsoluteFilePath(path);
|
|
21
|
-
const schemaJson = checkAndConvertToJson(filePath);
|
|
22
|
-
if (!isSchemaDefinition(schemaJson)) {
|
|
23
|
-
uiLogger.error(commands.customObject.subcommands.schema.subcommands.update.errors
|
|
24
|
-
.invalidSchema);
|
|
25
|
-
process.exit(EXIT_CODES.ERROR);
|
|
26
|
-
}
|
|
27
|
-
let name = providedName;
|
|
28
|
-
try {
|
|
29
|
-
const { data: { results }, } = await fetchObjectSchemas(derivedAccountId);
|
|
30
|
-
const schemaNames = results?.map(({ name: schemaName }) => schemaName);
|
|
31
|
-
name =
|
|
32
|
-
providedName && typeof providedName === 'string'
|
|
33
|
-
? providedName
|
|
34
|
-
: await listPrompt(commands.customObject.subcommands.schema.subcommands.update
|
|
35
|
-
.selectSchema, {
|
|
36
|
-
choices: schemaNames,
|
|
37
|
-
});
|
|
38
|
-
const { data } = await updateObjectSchema(derivedAccountId, name, schemaJson);
|
|
39
|
-
uiLogger.success(commands.customObject.subcommands.schema.subcommands.update.success.viewAtUrl(`${getHubSpotWebsiteOrigin(getEnv() === 'qa' ? ENVIRONMENTS.QA : ENVIRONMENTS.PROD)}/contacts/${derivedAccountId}/objects/${data.objectTypeId}`));
|
|
40
|
-
}
|
|
41
|
-
catch (e) {
|
|
42
|
-
logError(e, { accountId: derivedAccountId });
|
|
43
|
-
uiLogger.error(commands.customObject.subcommands.schema.subcommands.update.errors.update(path));
|
|
44
|
-
}
|
|
8
|
+
uiCommandRelocatedMessage('hs custom-object update-schema');
|
|
9
|
+
await updateSchemaCommand.handler(args);
|
|
45
10
|
}
|
|
46
|
-
function
|
|
11
|
+
function deprecatedUpdateSchemaBuilder(yargs) {
|
|
47
12
|
yargs
|
|
48
13
|
.positional('name', {
|
|
49
|
-
describe: commands.customObject.subcommands.
|
|
50
|
-
.
|
|
14
|
+
describe: commands.customObject.subcommands.updateSchema.positionals.name
|
|
15
|
+
.describe,
|
|
51
16
|
type: 'string',
|
|
52
17
|
})
|
|
53
18
|
.option('path', {
|
|
54
|
-
describe: commands.customObject.subcommands.
|
|
55
|
-
.describe,
|
|
19
|
+
describe: commands.customObject.subcommands.updateSchema.options.path.describe,
|
|
56
20
|
type: 'string',
|
|
57
21
|
required: true,
|
|
58
22
|
});
|
|
59
23
|
return yargs;
|
|
60
24
|
}
|
|
61
|
-
const
|
|
25
|
+
const verboseDescribe = uiCommandRenamedDescription(updateSchemaCommand.describe, 'hs custom-object update-schema');
|
|
26
|
+
const builder = makeYargsBuilder(deprecatedUpdateSchemaBuilder, command, verboseDescribe, {
|
|
62
27
|
useGlobalOptions: true,
|
|
63
28
|
useConfigOptions: true,
|
|
64
29
|
useAccountOptions: true,
|
|
65
30
|
useEnvironmentOptions: true,
|
|
66
31
|
useTestingOptions: true,
|
|
67
32
|
});
|
|
68
|
-
const
|
|
33
|
+
const deprecatedUpdateSchemaCommand = {
|
|
69
34
|
command,
|
|
70
35
|
describe,
|
|
71
36
|
handler,
|
|
72
37
|
builder,
|
|
73
38
|
};
|
|
74
|
-
export default
|
|
39
|
+
export default deprecatedUpdateSchemaCommand;
|
|
@@ -6,8 +6,9 @@ import listCommand from './schema/list.js';
|
|
|
6
6
|
import updateSchema from './schema/update.js';
|
|
7
7
|
import { commands } from '../../lang/en.js';
|
|
8
8
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
9
|
+
import { uiDeprecatedTag, uiCommandRenamedDescription, } from '../../lib/ui/index.js';
|
|
9
10
|
const command = ['schema', 'schemas'];
|
|
10
|
-
const describe = commands.customObject.subcommands.schema.describe;
|
|
11
|
+
const describe = uiDeprecatedTag(commands.customObject.subcommands.schema.describe, false);
|
|
11
12
|
function customObjectSchemaBuilder(yargs) {
|
|
12
13
|
yargs
|
|
13
14
|
.command(listCommand)
|
|
@@ -19,7 +20,8 @@ function customObjectSchemaBuilder(yargs) {
|
|
|
19
20
|
.demandCommand(1, '');
|
|
20
21
|
return yargs;
|
|
21
22
|
}
|
|
22
|
-
const
|
|
23
|
+
const verboseDescribe = uiCommandRenamedDescription(commands.customObject.subcommands.schema.describe, 'hs custom-object');
|
|
24
|
+
const builder = makeYargsBuilder(customObjectSchemaBuilder, command, verboseDescribe);
|
|
23
25
|
const customObjectSchemaCommand = {
|
|
24
26
|
command,
|
|
25
27
|
describe,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, TestingArgs, YargsCommandModule } from '../../types/Yargs.js';
|
|
2
|
+
export type SchemaUpdateArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & TestingArgs & {
|
|
3
|
+
name?: string;
|
|
4
|
+
path: string;
|
|
5
|
+
};
|
|
6
|
+
declare const updateSchemaCommand: YargsCommandModule<unknown, SchemaUpdateArgs>;
|
|
7
|
+
export default updateSchemaCommand;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { fetchObjectSchemas, updateObjectSchema, } from '@hubspot/local-dev-lib/api/customObjects';
|
|
2
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
3
|
+
import { getAbsoluteFilePath } from '@hubspot/local-dev-lib/path';
|
|
4
|
+
import { ENVIRONMENTS } from '@hubspot/local-dev-lib/constants/environments';
|
|
5
|
+
import { getEnv } from '@hubspot/local-dev-lib/config';
|
|
6
|
+
import { getHubSpotWebsiteOrigin } from '@hubspot/local-dev-lib/urls';
|
|
7
|
+
import { listPrompt } from '../../lib/prompts/promptUtils.js';
|
|
8
|
+
import { logError } from '../../lib/errorHandlers/index.js';
|
|
9
|
+
import { checkAndConvertToJson } from '../../lib/validation.js';
|
|
10
|
+
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
11
|
+
import { commands } from '../../lang/en.js';
|
|
12
|
+
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
13
|
+
import { isSchemaDefinition } from '../../lib/customObject.js';
|
|
14
|
+
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
15
|
+
const command = 'update-schema [name]';
|
|
16
|
+
const describe = commands.customObject.subcommands.updateSchema.describe;
|
|
17
|
+
async function handler(args) {
|
|
18
|
+
const { path, name: providedName, derivedAccountId } = args;
|
|
19
|
+
trackCommandUsage('custom-object-schema-update', {}, derivedAccountId);
|
|
20
|
+
const filePath = getAbsoluteFilePath(path);
|
|
21
|
+
const schemaJson = checkAndConvertToJson(filePath);
|
|
22
|
+
if (!isSchemaDefinition(schemaJson)) {
|
|
23
|
+
uiLogger.error(commands.customObject.subcommands.updateSchema.errors.invalidSchema);
|
|
24
|
+
process.exit(EXIT_CODES.ERROR);
|
|
25
|
+
}
|
|
26
|
+
let name = providedName;
|
|
27
|
+
try {
|
|
28
|
+
const { data: { results }, } = await fetchObjectSchemas(derivedAccountId);
|
|
29
|
+
const schemaNames = results?.map(({ name: schemaName }) => schemaName);
|
|
30
|
+
name =
|
|
31
|
+
providedName && typeof providedName === 'string'
|
|
32
|
+
? providedName
|
|
33
|
+
: await listPrompt(commands.customObject.subcommands.updateSchema.selectSchema, {
|
|
34
|
+
choices: schemaNames,
|
|
35
|
+
});
|
|
36
|
+
const { data } = await updateObjectSchema(derivedAccountId, name, schemaJson);
|
|
37
|
+
uiLogger.success(commands.customObject.subcommands.updateSchema.success.viewAtUrl(`${getHubSpotWebsiteOrigin(getEnv() === 'qa' ? ENVIRONMENTS.QA : ENVIRONMENTS.PROD)}/contacts/${derivedAccountId}/objects/${data.objectTypeId}`));
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
logError(e, { accountId: derivedAccountId });
|
|
41
|
+
uiLogger.error(commands.customObject.subcommands.updateSchema.errors.update(path));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function schemaUpdateBuilder(yargs) {
|
|
45
|
+
yargs
|
|
46
|
+
.positional('name', {
|
|
47
|
+
describe: commands.customObject.subcommands.updateSchema.positionals.name
|
|
48
|
+
.describe,
|
|
49
|
+
type: 'string',
|
|
50
|
+
})
|
|
51
|
+
.option('path', {
|
|
52
|
+
describe: commands.customObject.subcommands.updateSchema.options.path.describe,
|
|
53
|
+
type: 'string',
|
|
54
|
+
required: true,
|
|
55
|
+
});
|
|
56
|
+
return yargs;
|
|
57
|
+
}
|
|
58
|
+
const builder = makeYargsBuilder(schemaUpdateBuilder, command, describe, {
|
|
59
|
+
useGlobalOptions: true,
|
|
60
|
+
useConfigOptions: true,
|
|
61
|
+
useAccountOptions: true,
|
|
62
|
+
useEnvironmentOptions: true,
|
|
63
|
+
useTestingOptions: true,
|
|
64
|
+
});
|
|
65
|
+
const updateSchemaCommand = {
|
|
66
|
+
command,
|
|
67
|
+
describe,
|
|
68
|
+
handler,
|
|
69
|
+
builder,
|
|
70
|
+
};
|
|
71
|
+
export default updateSchemaCommand;
|
package/commands/customObject.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import schemaCommand from './customObject/schema.js';
|
|
2
2
|
import createCommand from './customObject/create.js';
|
|
3
|
+
import createSchemaCommand from './customObject/createSchema.js';
|
|
4
|
+
import deleteSchemaCommand from './customObject/deleteSchema.js';
|
|
5
|
+
import fetchSchemaCommand from './customObject/fetchSchema.js';
|
|
6
|
+
import fetchAllSchemasCommand from './customObject/fetchAllSchemas.js';
|
|
7
|
+
import listSchemasCommand from './customObject/listSchemas.js';
|
|
8
|
+
import updateSchemaCommand from './customObject/updateSchema.js';
|
|
3
9
|
import { commands } from '../lang/en.js';
|
|
4
10
|
import { uiBetaTag } from '../lib/ui/index.js';
|
|
5
11
|
import { makeYargsBuilder } from '../lib/yargsUtils.js';
|
|
@@ -12,7 +18,16 @@ function logBetaMessage() {
|
|
|
12
18
|
}
|
|
13
19
|
function customObjectBuilder(yargs) {
|
|
14
20
|
yargs.middleware([logBetaMessage]);
|
|
15
|
-
yargs
|
|
21
|
+
yargs
|
|
22
|
+
.command(schemaCommand)
|
|
23
|
+
.command(createCommand)
|
|
24
|
+
.command(createSchemaCommand)
|
|
25
|
+
.command(deleteSchemaCommand)
|
|
26
|
+
.command(fetchSchemaCommand)
|
|
27
|
+
.command(fetchAllSchemasCommand)
|
|
28
|
+
.command(listSchemasCommand)
|
|
29
|
+
.command(updateSchemaCommand)
|
|
30
|
+
.demandCommand(1, '');
|
|
16
31
|
return yargs;
|
|
17
32
|
}
|
|
18
33
|
const builder = makeYargsBuilder(customObjectBuilder, command, describe);
|
package/commands/feedback.js
CHANGED
|
@@ -11,7 +11,7 @@ async function handler() {
|
|
|
11
11
|
const shouldOpen = await confirmPrompt(commands.project.feedback.openPrompt);
|
|
12
12
|
if (!shouldOpen) {
|
|
13
13
|
uiLogger.log(commands.project.feedback.error(FEEDBACK_URL));
|
|
14
|
-
process.exit(EXIT_CODES.
|
|
14
|
+
process.exit(EXIT_CODES.SUCCESS);
|
|
15
15
|
}
|
|
16
16
|
open(FEEDBACK_URL, { url: true });
|
|
17
17
|
uiLogger.success(commands.project.feedback.success(FEEDBACK_URL));
|
package/commands/fetch.d.ts
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
dest?: string;
|
|
6
|
-
cmsPublishMode?: CmsPublishMode;
|
|
7
|
-
staging?: boolean;
|
|
8
|
-
assetVersion?: number;
|
|
9
|
-
overwrite?: boolean;
|
|
10
|
-
} & ConfigArgs & AccountArgs & EnvironmentArgs & CommonArgs;
|
|
11
|
-
declare const fetchCommand: YargsCommandModule<unknown, FetchCommandArgs>;
|
|
12
|
-
export default fetchCommand;
|
|
1
|
+
import { YargsCommandModule } from '../types/Yargs.js';
|
|
2
|
+
import { FetchCommandArgs } from './cms/fetch.js';
|
|
3
|
+
declare const deprecatedCmsFetchCommand: YargsCommandModule<unknown, FetchCommandArgs>;
|
|
4
|
+
export default deprecatedCmsFetchCommand;
|
package/commands/fetch.js
CHANGED
|
@@ -1,53 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { resolveLocalPath } from '../lib/filesystem.js';
|
|
4
|
-
import { validateCmsPublishMode } from '../lib/validation.js';
|
|
5
|
-
import { trackCommandUsage } from '../lib/usageTracking.js';
|
|
1
|
+
import { uiCommandRelocatedMessage, uiCommandRenamedDescription, uiDeprecatedTag, } from '../lib/ui/index.js';
|
|
2
|
+
import cmsFetchCommand from './cms/fetch.js';
|
|
6
3
|
import { makeYargsBuilder } from '../lib/yargsUtils.js';
|
|
7
|
-
import { EXIT_CODES } from '../lib/enums/exitCodes.js';
|
|
8
|
-
import { logError } from '../lib/errorHandlers/index.js';
|
|
9
4
|
import { commands } from '../lang/en.js';
|
|
10
|
-
import {
|
|
5
|
+
import { addCmsPublishModeOptions, addOverwriteOptions, } from '../lib/commonOpts.js';
|
|
11
6
|
const command = 'fetch <src> [dest]';
|
|
12
|
-
const describe =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (typeof src !== 'string') {
|
|
19
|
-
uiLogger.error(commands.fetch.errors.sourceRequired);
|
|
20
|
-
process.exit(EXIT_CODES.ERROR);
|
|
21
|
-
}
|
|
22
|
-
const { derivedAccountId } = options;
|
|
23
|
-
const cmsPublishMode = getCmsPublishMode(options);
|
|
24
|
-
trackCommandUsage('fetch', { mode: cmsPublishMode }, derivedAccountId);
|
|
25
|
-
const { assetVersion, staging, overwrite } = options;
|
|
26
|
-
try {
|
|
27
|
-
// Fetch and write file/folder.
|
|
28
|
-
await downloadFileOrFolder(derivedAccountId, src, resolveLocalPath(dest), cmsPublishMode, {
|
|
29
|
-
assetVersion: assetVersion !== undefined ? `${assetVersion}` : assetVersion,
|
|
30
|
-
staging,
|
|
31
|
-
overwrite,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
catch (err) {
|
|
35
|
-
logError(err);
|
|
36
|
-
process.exit(EXIT_CODES.ERROR);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
const fetchBuilder = (yargs) => {
|
|
7
|
+
const describe = uiDeprecatedTag(cmsFetchCommand.describe, false);
|
|
8
|
+
async function handler(args) {
|
|
9
|
+
uiCommandRelocatedMessage('hs cms fetch');
|
|
10
|
+
await cmsFetchCommand.handler(args);
|
|
11
|
+
}
|
|
12
|
+
function deprecatedCmsFetchBuilder(yargs) {
|
|
40
13
|
yargs.positional('src', {
|
|
41
|
-
describe: commands.fetch.positionals.src.describe,
|
|
14
|
+
describe: commands.cms.subcommands.fetch.positionals.src.describe,
|
|
42
15
|
type: 'string',
|
|
43
16
|
});
|
|
44
17
|
yargs.positional('dest', {
|
|
45
|
-
describe: commands.fetch.positionals.dest.describe,
|
|
18
|
+
describe: commands.cms.subcommands.fetch.positionals.dest.describe,
|
|
46
19
|
type: 'string',
|
|
47
20
|
});
|
|
48
21
|
yargs.options({
|
|
49
22
|
staging: {
|
|
50
|
-
describe: commands.fetch.options.staging.describe,
|
|
23
|
+
describe: commands.cms.subcommands.fetch.options.staging.describe,
|
|
51
24
|
type: 'boolean',
|
|
52
25
|
default: false,
|
|
53
26
|
hidden: true,
|
|
@@ -56,24 +29,24 @@ const fetchBuilder = (yargs) => {
|
|
|
56
29
|
yargs.options({
|
|
57
30
|
assetVersion: {
|
|
58
31
|
type: 'number',
|
|
59
|
-
describe: commands.fetch.options.assetVersion.describe,
|
|
32
|
+
describe: commands.cms.subcommands.fetch.options.assetVersion.describe,
|
|
60
33
|
},
|
|
61
34
|
});
|
|
62
35
|
addCmsPublishModeOptions(yargs, { read: true });
|
|
63
36
|
addOverwriteOptions(yargs);
|
|
64
37
|
return yargs;
|
|
65
|
-
}
|
|
66
|
-
const
|
|
38
|
+
}
|
|
39
|
+
const verboseDescribe = uiCommandRenamedDescription(cmsFetchCommand.describe, 'hs cms fetch');
|
|
40
|
+
const builder = makeYargsBuilder(deprecatedCmsFetchBuilder, command, verboseDescribe, {
|
|
67
41
|
useConfigOptions: true,
|
|
68
42
|
useAccountOptions: true,
|
|
69
43
|
useGlobalOptions: true,
|
|
70
44
|
useEnvironmentOptions: true,
|
|
71
|
-
useTestingOptions: false,
|
|
72
45
|
});
|
|
73
|
-
const
|
|
74
|
-
|
|
46
|
+
const deprecatedCmsFetchCommand = {
|
|
47
|
+
...cmsFetchCommand,
|
|
75
48
|
describe,
|
|
76
49
|
handler,
|
|
77
50
|
builder,
|
|
78
51
|
};
|
|
79
|
-
export default
|
|
52
|
+
export default deprecatedCmsFetchCommand;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declare const functionDeployCommand: YargsCommandModule<unknown, FunctionDeployArgs>;
|
|
6
|
-
export default functionDeployCommand;
|
|
1
|
+
import { YargsCommandModule } from '../../types/Yargs.js';
|
|
2
|
+
import { FunctionDeployArgs } from '../cms/function/deploy.js';
|
|
3
|
+
declare const deprecatedFunctionDeployCommand: YargsCommandModule<unknown, FunctionDeployArgs>;
|
|
4
|
+
export default deprecatedFunctionDeployCommand;
|
|
@@ -1,88 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
|
|
4
|
-
import SpinniesManager from '../../lib/ui/SpinniesManager.js';
|
|
5
|
-
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
6
|
-
import { logError, ApiErrorContext } from '../../lib/errorHandlers/index.js';
|
|
7
|
-
import { uiAccountDescription } from '../../lib/ui/index.js';
|
|
8
|
-
import { poll } from '../../lib/polling.js';
|
|
9
|
-
import { outputBuildLog } from '../../lib/serverlessLogs.js';
|
|
10
|
-
import { commands } from '../../lang/en.js';
|
|
1
|
+
import { uiCommandRelocatedMessage, uiCommandRenamedDescription, uiDeprecatedTag, } from '../../lib/ui/index.js';
|
|
2
|
+
import cmsFunctionDeployCommand from '../cms/function/deploy.js';
|
|
11
3
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
12
|
-
|
|
13
|
-
return (typeof e === 'object' && e !== null && 'status' in e && e.status === 'ERROR');
|
|
14
|
-
}
|
|
4
|
+
import { commands } from '../../lang/en.js';
|
|
15
5
|
const command = 'deploy <path>';
|
|
16
|
-
const describe =
|
|
6
|
+
const describe = uiDeprecatedTag(cmsFunctionDeployCommand.describe, false);
|
|
17
7
|
async function handler(args) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
trackCommandUsage('function-deploy', undefined, derivedAccountId);
|
|
21
|
-
if (!splitFunctionPath.length ||
|
|
22
|
-
splitFunctionPath[splitFunctionPath.length - 1] !== 'functions') {
|
|
23
|
-
uiLogger.error(commands.function.subcommands.deploy.errors.notFunctionsFolder(functionPath));
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
uiLogger.debug(commands.function.subcommands.deploy.debug.startingBuildAndDeploy(functionPath));
|
|
27
|
-
SpinniesManager.init();
|
|
28
|
-
SpinniesManager.add('loading', {
|
|
29
|
-
text: commands.function.subcommands.deploy.loading(functionPath, uiAccountDescription(derivedAccountId)),
|
|
30
|
-
});
|
|
31
|
-
try {
|
|
32
|
-
const { data: buildId } = await buildPackage(derivedAccountId, functionPath);
|
|
33
|
-
const successResp = await poll(() => getBuildStatus(derivedAccountId, Number(buildId)));
|
|
34
|
-
if (successResp) {
|
|
35
|
-
const buildTimeSeconds = successResp.buildTime
|
|
36
|
-
? (successResp.buildTime / 1000).toFixed(2)
|
|
37
|
-
: 0;
|
|
38
|
-
SpinniesManager.succeed('loading');
|
|
39
|
-
if (successResp.cdnUrl) {
|
|
40
|
-
await outputBuildLog(successResp.cdnUrl);
|
|
41
|
-
}
|
|
42
|
-
uiLogger.success(commands.function.subcommands.deploy.success.deployed(functionPath, derivedAccountId, buildTimeSeconds));
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
catch (e) {
|
|
46
|
-
SpinniesManager.fail('loading', {
|
|
47
|
-
text: commands.function.subcommands.deploy.loadingFailed(functionPath, uiAccountDescription(derivedAccountId)),
|
|
48
|
-
});
|
|
49
|
-
if (isHubSpotHttpError(e) && e.status === 404) {
|
|
50
|
-
uiLogger.error(commands.function.subcommands.deploy.errors.noPackageJson(functionPath));
|
|
51
|
-
}
|
|
52
|
-
else if (isFunctionBuildError(e)) {
|
|
53
|
-
await outputBuildLog(e.cdnUrl);
|
|
54
|
-
uiLogger.error(commands.function.subcommands.deploy.errors.buildError(String(e.errorReason)));
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
logError(e, new ApiErrorContext({
|
|
58
|
-
accountId: derivedAccountId,
|
|
59
|
-
request: functionPath,
|
|
60
|
-
}));
|
|
61
|
-
}
|
|
62
|
-
}
|
|
8
|
+
uiCommandRelocatedMessage('hs cms function deploy');
|
|
9
|
+
await cmsFunctionDeployCommand.handler(args);
|
|
63
10
|
}
|
|
64
|
-
function
|
|
11
|
+
function deprecatedFunctionDeployBuilder(yargs) {
|
|
65
12
|
yargs.positional('path', {
|
|
66
|
-
describe: commands.function.subcommands.deploy.positionals.path
|
|
13
|
+
describe: commands.cms.subcommands.function.subcommands.deploy.positionals.path
|
|
14
|
+
.describe,
|
|
67
15
|
type: 'string',
|
|
68
16
|
});
|
|
69
|
-
yargs.example([
|
|
70
|
-
[
|
|
71
|
-
'$0 functions deploy myFunctionFolder.functions',
|
|
72
|
-
commands.function.subcommands.deploy.examples.default,
|
|
73
|
-
],
|
|
74
|
-
]);
|
|
75
17
|
return yargs;
|
|
76
18
|
}
|
|
77
|
-
const
|
|
19
|
+
const verboseDescribe = uiCommandRenamedDescription(cmsFunctionDeployCommand.describe, 'hs cms function deploy');
|
|
20
|
+
const builder = makeYargsBuilder(deprecatedFunctionDeployBuilder, command, verboseDescribe, {
|
|
78
21
|
useConfigOptions: true,
|
|
79
22
|
useAccountOptions: true,
|
|
80
23
|
useEnvironmentOptions: true,
|
|
81
24
|
});
|
|
82
|
-
const
|
|
83
|
-
|
|
25
|
+
const deprecatedFunctionDeployCommand = {
|
|
26
|
+
...cmsFunctionDeployCommand,
|
|
84
27
|
describe,
|
|
85
28
|
handler,
|
|
86
29
|
builder,
|
|
87
30
|
};
|
|
88
|
-
export default
|
|
31
|
+
export default deprecatedFunctionDeployCommand;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declare const functionListCommand: YargsCommandModule<unknown, FunctionListArgs>;
|
|
6
|
-
export default functionListCommand;
|
|
1
|
+
import { YargsCommandModule } from '../../types/Yargs.js';
|
|
2
|
+
import { FunctionListArgs } from '../cms/function/list.js';
|
|
3
|
+
declare const deprecatedFunctionListCommand: YargsCommandModule<unknown, FunctionListArgs>;
|
|
4
|
+
export default deprecatedFunctionListCommand;
|