@hubspot/cli 7.8.12-experimental.1 → 7.9.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +560 -425
- package/lang/en.js +562 -427
- package/lang/en.lyaml +2 -2
- package/lib/__tests__/buildAccount.test.js +2 -2
- 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/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.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 +9 -3
- package/lib/projects/localDev/AppDevModeInterface.js +116 -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/{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/{create/__tests__/v3.test.d.ts → __tests__/DevServerManager.test.d.ts} +0 -0
- /package/lib/projects/localDev/{LocalDevManager.d.ts → LocalDevManager_DEPRECATED.d.ts} +0 -0
|
@@ -2,10 +2,36 @@ import yargs from 'yargs';
|
|
|
2
2
|
import lighthouseScore from '../cms/lighthouseScore.js';
|
|
3
3
|
import convertFields from '../cms/convertFields.js';
|
|
4
4
|
import getReactModule from '../cms/getReactModule.js';
|
|
5
|
+
import watchCommand from '../cms/watch.js';
|
|
6
|
+
import listCommand from '../cms/list.js';
|
|
7
|
+
import uploadCommand from '../cms/upload.js';
|
|
8
|
+
import fetchCommand from '../cms/fetch.js';
|
|
9
|
+
import deleteCommand from '../cms/delete.js';
|
|
10
|
+
import mvCommand from '../cms/mv.js';
|
|
11
|
+
import functionCommand from '../cms/function.js';
|
|
12
|
+
import lintCommand from '../cms/lint.js';
|
|
13
|
+
import themeCommand from '../cms/theme.js';
|
|
14
|
+
import moduleCommand from '../cms/module.js';
|
|
15
|
+
import webpackCommand from '../cms/webpack.js';
|
|
16
|
+
import appCommand from '../cms/app.js';
|
|
17
|
+
import templateCommand from '../cms/template.js';
|
|
5
18
|
import cmsCommand from '../cms.js';
|
|
6
19
|
vi.mock('../cms/lighthouseScore');
|
|
7
20
|
vi.mock('../cms/convertFields');
|
|
8
21
|
vi.mock('../cms/getReactModule');
|
|
22
|
+
vi.mock('../cms/watch');
|
|
23
|
+
vi.mock('../cms/list');
|
|
24
|
+
vi.mock('../cms/upload');
|
|
25
|
+
vi.mock('../cms/fetch');
|
|
26
|
+
vi.mock('../cms/delete');
|
|
27
|
+
vi.mock('../cms/mv');
|
|
28
|
+
vi.mock('../cms/function');
|
|
29
|
+
vi.mock('../cms/lint');
|
|
30
|
+
vi.mock('../cms/theme');
|
|
31
|
+
vi.mock('../cms/module');
|
|
32
|
+
vi.mock('../cms/webpack');
|
|
33
|
+
vi.mock('../cms/app');
|
|
34
|
+
vi.mock('../cms/template');
|
|
9
35
|
vi.mock('../../lib/commonOpts');
|
|
10
36
|
const commandSpy = vi
|
|
11
37
|
.spyOn(yargs, 'command')
|
|
@@ -25,7 +51,24 @@ describe('commands/cms', () => {
|
|
|
25
51
|
});
|
|
26
52
|
});
|
|
27
53
|
describe('builder', () => {
|
|
28
|
-
const subcommands = [
|
|
54
|
+
const subcommands = [
|
|
55
|
+
lighthouseScore,
|
|
56
|
+
convertFields,
|
|
57
|
+
getReactModule,
|
|
58
|
+
watchCommand,
|
|
59
|
+
listCommand,
|
|
60
|
+
uploadCommand,
|
|
61
|
+
fetchCommand,
|
|
62
|
+
deleteCommand,
|
|
63
|
+
mvCommand,
|
|
64
|
+
functionCommand,
|
|
65
|
+
lintCommand,
|
|
66
|
+
themeCommand,
|
|
67
|
+
moduleCommand,
|
|
68
|
+
webpackCommand,
|
|
69
|
+
appCommand,
|
|
70
|
+
templateCommand,
|
|
71
|
+
];
|
|
29
72
|
it('should demand the command takes one positional argument', () => {
|
|
30
73
|
cmsCommand.builder(yargs);
|
|
31
74
|
expect(demandCommandSpy).toHaveBeenCalledTimes(1);
|
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import yargs from 'yargs';
|
|
2
2
|
import create from '../customObject/create.js';
|
|
3
3
|
import schema from '../customObject/schema.js';
|
|
4
|
+
import createSchema from '../customObject/createSchema.js';
|
|
5
|
+
import updateSchema from '../customObject/updateSchema.js';
|
|
6
|
+
import listSchemas from '../customObject/listSchemas.js';
|
|
7
|
+
import deleteSchema from '../customObject/deleteSchema.js';
|
|
8
|
+
import fetchSchema from '../customObject/fetchSchema.js';
|
|
9
|
+
import fetchAllSchemas from '../customObject/fetchAllSchemas.js';
|
|
4
10
|
import customObjectCommands from '../customObject.js';
|
|
5
11
|
vi.mock('../customObject/create');
|
|
6
12
|
vi.mock('../customObject/schema');
|
|
13
|
+
vi.mock('../customObject/createSchema');
|
|
14
|
+
vi.mock('../customObject/updateSchema');
|
|
15
|
+
vi.mock('../customObject/listSchemas');
|
|
16
|
+
vi.mock('../customObject/deleteSchema');
|
|
17
|
+
vi.mock('../customObject/fetchSchema');
|
|
18
|
+
vi.mock('../customObject/fetchAllSchemas');
|
|
7
19
|
vi.mock('../../lib/commonOpts');
|
|
8
20
|
const commandSpy = vi
|
|
9
21
|
.spyOn(yargs, 'command')
|
|
@@ -31,7 +43,16 @@ describe('commands/customObject', () => {
|
|
|
31
43
|
commandSpy.mockClear();
|
|
32
44
|
demandCommandSpy.mockClear();
|
|
33
45
|
});
|
|
34
|
-
const subcommands = [
|
|
46
|
+
const subcommands = [
|
|
47
|
+
create,
|
|
48
|
+
schema,
|
|
49
|
+
createSchema,
|
|
50
|
+
updateSchema,
|
|
51
|
+
listSchemas,
|
|
52
|
+
deleteSchema,
|
|
53
|
+
fetchSchema,
|
|
54
|
+
fetchAllSchemas,
|
|
55
|
+
];
|
|
35
56
|
it('should demand the command takes one positional argument', () => {
|
|
36
57
|
customObjectCommands.builder(yargs);
|
|
37
58
|
expect(demandCommandSpy).toHaveBeenCalledTimes(1);
|
|
@@ -15,6 +15,7 @@ import cloneApp from '../project/cloneApp.js';
|
|
|
15
15
|
import installDeps from '../project/installDeps.js';
|
|
16
16
|
import validate from '../project/validate.js';
|
|
17
17
|
import profileCommands from '../project/profile.js';
|
|
18
|
+
import list from '../project/list.js';
|
|
18
19
|
import projectCommand from '../project.js';
|
|
19
20
|
vi.mock('../project/deploy');
|
|
20
21
|
vi.mock('../project/create');
|
|
@@ -73,6 +74,7 @@ describe('commands/project', () => {
|
|
|
73
74
|
installDeps,
|
|
74
75
|
profileCommands,
|
|
75
76
|
validate,
|
|
77
|
+
list,
|
|
76
78
|
];
|
|
77
79
|
it('should demand the command takes one positional argument', () => {
|
|
78
80
|
projectCommand.builder(yargs);
|
package/commands/account/auth.js
CHANGED
package/commands/auth.js
CHANGED
|
@@ -121,6 +121,7 @@ async function handler(args) {
|
|
|
121
121
|
await setAsDefaultAccountPrompt(accountName);
|
|
122
122
|
uiLogger.success(commands.auth.success.configFileUpdated(accountName, DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME, successAuthMethod));
|
|
123
123
|
uiFeatureHighlight([
|
|
124
|
+
'getStartedCommand',
|
|
124
125
|
'accountsUseCommand',
|
|
125
126
|
'accountOption',
|
|
126
127
|
'accountsListCommand',
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import yargs from 'yargs';
|
|
2
|
-
import * as commonOpts from '
|
|
3
|
-
import
|
|
4
|
-
vi.mock('
|
|
2
|
+
import * as commonOpts from '../../../lib/commonOpts.js';
|
|
3
|
+
import deleteCommand from '../delete.js';
|
|
4
|
+
vi.mock('../../../lib/commonOpts');
|
|
5
5
|
const positionalSpy = vi
|
|
6
6
|
.spyOn(yargs, 'positional')
|
|
7
7
|
.mockReturnValue(yargs);
|
|
8
|
-
describe('commands/
|
|
8
|
+
describe('commands/cms/delete', () => {
|
|
9
9
|
describe('command', () => {
|
|
10
10
|
it('should have the correct command structure', () => {
|
|
11
|
-
expect(
|
|
11
|
+
expect(deleteCommand.command).toBe('delete <path>');
|
|
12
12
|
});
|
|
13
13
|
});
|
|
14
14
|
describe('describe', () => {
|
|
15
15
|
it('should provide a description', () => {
|
|
16
|
-
expect(
|
|
16
|
+
expect(deleteCommand.describe).toBeDefined();
|
|
17
17
|
});
|
|
18
18
|
});
|
|
19
19
|
describe('builder', () => {
|
|
20
20
|
it('should support the correct options', () => {
|
|
21
|
-
|
|
21
|
+
deleteCommand.builder(yargs);
|
|
22
22
|
expect(commonOpts.addGlobalOptions).toHaveBeenCalledTimes(1);
|
|
23
23
|
expect(commonOpts.addGlobalOptions).toHaveBeenCalledWith(yargs);
|
|
24
24
|
expect(commonOpts.addConfigOptions).toHaveBeenCalledTimes(1);
|
|
@@ -29,7 +29,7 @@ describe('commands/remove', () => {
|
|
|
29
29
|
expect(commonOpts.addUseEnvironmentOptions).toHaveBeenCalledWith(yargs);
|
|
30
30
|
});
|
|
31
31
|
it('should add the path positional argument', () => {
|
|
32
|
-
|
|
32
|
+
deleteCommand.builder(yargs);
|
|
33
33
|
expect(positionalSpy).toHaveBeenCalledWith('path', {
|
|
34
34
|
describe: expect.any(String),
|
|
35
35
|
type: 'string',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import yargs from 'yargs';
|
|
2
|
-
import { addAccountOptions, addConfigOptions, addOverwriteOptions, addCmsPublishModeOptions, addUseEnvironmentOptions, } from '
|
|
3
|
-
vi.mock('
|
|
2
|
+
import { addAccountOptions, addConfigOptions, addOverwriteOptions, addCmsPublishModeOptions, addUseEnvironmentOptions, } from '../../../lib/commonOpts.js';
|
|
3
|
+
vi.mock('../../../lib/commonOpts');
|
|
4
4
|
// Import this last so mocks apply
|
|
5
5
|
import fetchCommand from '../fetch.js';
|
|
6
6
|
const positionalSpy = vi
|
|
@@ -9,7 +9,7 @@ const positionalSpy = vi
|
|
|
9
9
|
const optionsSpy = vi
|
|
10
10
|
.spyOn(yargs, 'options')
|
|
11
11
|
.mockReturnValue(yargs);
|
|
12
|
-
describe('commands/fetch', () => {
|
|
12
|
+
describe('commands/cms/fetch', () => {
|
|
13
13
|
describe('command', () => {
|
|
14
14
|
it('should have the correct command structure', () => {
|
|
15
15
|
expect(fetchCommand.command).toEqual('fetch <src> [dest]');
|
|
@@ -2,18 +2,22 @@ import yargs from 'yargs';
|
|
|
2
2
|
import list from '../function/list.js';
|
|
3
3
|
import deploy from '../function/deploy.js';
|
|
4
4
|
import server from '../function/server.js';
|
|
5
|
+
import logs from '../function/logs.js';
|
|
6
|
+
import create from '../function/create.js';
|
|
5
7
|
import functionCommands from '../function.js';
|
|
6
8
|
vi.mock('../function/list');
|
|
7
9
|
vi.mock('../function/deploy');
|
|
8
10
|
vi.mock('../function/server');
|
|
9
|
-
vi.mock('
|
|
11
|
+
vi.mock('../function/logs');
|
|
12
|
+
vi.mock('../function/create');
|
|
13
|
+
vi.mock('../../../lib/commonOpts');
|
|
10
14
|
const commandSpy = vi
|
|
11
15
|
.spyOn(yargs, 'command')
|
|
12
16
|
.mockReturnValue(yargs);
|
|
13
17
|
const demandCommandSpy = vi
|
|
14
18
|
.spyOn(yargs, 'demandCommand')
|
|
15
19
|
.mockReturnValue(yargs);
|
|
16
|
-
describe('commands/function', () => {
|
|
20
|
+
describe('commands/cms/function', () => {
|
|
17
21
|
describe('command', () => {
|
|
18
22
|
it('should have the correct command structure', () => {
|
|
19
23
|
expect(functionCommands.command).toEqual(['function', 'functions']);
|
|
@@ -25,7 +29,7 @@ describe('commands/function', () => {
|
|
|
25
29
|
});
|
|
26
30
|
});
|
|
27
31
|
describe('builder', () => {
|
|
28
|
-
const subcommands = [list, deploy, server];
|
|
32
|
+
const subcommands = [list, deploy, server, logs, create];
|
|
29
33
|
it('should demand the command takes one positional argument', () => {
|
|
30
34
|
functionCommands.builder(yargs);
|
|
31
35
|
expect(demandCommandSpy).toHaveBeenCalledTimes(1);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import yargs from 'yargs';
|
|
2
|
-
import { addConfigOptions, addAccountOptions } from '
|
|
2
|
+
import { addConfigOptions, addAccountOptions, } from '../../../lib/commonOpts.js';
|
|
3
3
|
import lintCommand from '../lint.js';
|
|
4
|
-
vi.mock('
|
|
4
|
+
vi.mock('../../../lib/commonOpts');
|
|
5
5
|
const positionalSpy = vi
|
|
6
6
|
.spyOn(yargs, 'positional')
|
|
7
7
|
.mockReturnValue(yargs);
|
|
8
|
-
describe('commands/lint', () => {
|
|
8
|
+
describe('commands/cms/lint', () => {
|
|
9
9
|
describe('command', () => {
|
|
10
10
|
it('should have the correct command structure', () => {
|
|
11
11
|
expect(lintCommand.command).toEqual('lint <path>');
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import yargs from 'yargs';
|
|
2
|
-
import { addConfigOptions, addAccountOptions, addUseEnvironmentOptions, } from '
|
|
2
|
+
import { addConfigOptions, addAccountOptions, addUseEnvironmentOptions, } from '../../../lib/commonOpts.js';
|
|
3
3
|
import listCommand from '../list.js';
|
|
4
|
-
vi.mock('
|
|
4
|
+
vi.mock('../../../lib/commonOpts');
|
|
5
5
|
const positionalSpy = vi
|
|
6
6
|
.spyOn(yargs, 'positional')
|
|
7
7
|
.mockReturnValue(yargs);
|
|
8
8
|
const exampleSpy = vi
|
|
9
9
|
.spyOn(yargs, 'example')
|
|
10
10
|
.mockReturnValue(yargs);
|
|
11
|
-
describe('commands/list', () => {
|
|
11
|
+
describe('commands/cms/list', () => {
|
|
12
12
|
describe('command', () => {
|
|
13
13
|
it('should have the correct command structure', () => {
|
|
14
14
|
expect(listCommand.command).toEqual(['list [path]', 'ls [path]']);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import yargs from 'yargs';
|
|
2
|
-
import * as commonOpts from '
|
|
2
|
+
import * as commonOpts from '../../../lib/commonOpts.js';
|
|
3
3
|
import mvCommand from '../mv.js';
|
|
4
|
-
vi.mock('
|
|
4
|
+
vi.mock('../../../lib/commonOpts');
|
|
5
5
|
const positionalSpy = vi
|
|
6
6
|
.spyOn(yargs, 'positional')
|
|
7
7
|
.mockReturnValue(yargs);
|
|
8
|
-
describe('commands/mv', () => {
|
|
8
|
+
describe('commands/cms/mv', () => {
|
|
9
9
|
describe('command', () => {
|
|
10
10
|
it('should have the correct command structure', () => {
|
|
11
11
|
expect(mvCommand.command).toBe('mv <srcPath> <destPath>');
|
|
@@ -2,10 +2,12 @@ import yargs from 'yargs';
|
|
|
2
2
|
import preview from '../theme/preview.js';
|
|
3
3
|
import generateSelectors from '../theme/generate-selectors.js';
|
|
4
4
|
import marketplaceValidate from '../theme/marketplace-validate.js';
|
|
5
|
+
import create from '../theme/create.js';
|
|
5
6
|
import themeCommands from '../theme.js';
|
|
6
7
|
vi.mock('../theme/preview');
|
|
7
8
|
vi.mock('../theme/generate-selectors');
|
|
8
9
|
vi.mock('../theme/marketplace-validate');
|
|
10
|
+
vi.mock('../theme/create');
|
|
9
11
|
vi.mock('../../lib/commonOpts');
|
|
10
12
|
const commandSpy = vi
|
|
11
13
|
.spyOn(yargs, 'command')
|
|
@@ -13,7 +15,7 @@ const commandSpy = vi
|
|
|
13
15
|
const demandCommandSpy = vi
|
|
14
16
|
.spyOn(yargs, 'demandCommand')
|
|
15
17
|
.mockReturnValue(yargs);
|
|
16
|
-
describe('commands/theme', () => {
|
|
18
|
+
describe('commands/cms/theme', () => {
|
|
17
19
|
describe('command', () => {
|
|
18
20
|
it('should have the correct command structure', () => {
|
|
19
21
|
expect(themeCommands.command).toEqual(['theme', 'themes']);
|
|
@@ -29,7 +31,12 @@ describe('commands/theme', () => {
|
|
|
29
31
|
commandSpy.mockClear();
|
|
30
32
|
demandCommandSpy.mockClear();
|
|
31
33
|
});
|
|
32
|
-
const subcommands = [
|
|
34
|
+
const subcommands = [
|
|
35
|
+
preview,
|
|
36
|
+
generateSelectors,
|
|
37
|
+
marketplaceValidate,
|
|
38
|
+
create,
|
|
39
|
+
];
|
|
33
40
|
it('should demand the command takes one positional argument', () => {
|
|
34
41
|
themeCommands.builder(yargs);
|
|
35
42
|
expect(demandCommandSpy).toHaveBeenCalledTimes(1);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CommonArgs, ConfigArgs, YargsCommandModule } from '../../../types/Yargs.js';
|
|
2
|
+
type AppCreateArgs = CommonArgs & ConfigArgs & {
|
|
3
|
+
type: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
dest?: string;
|
|
6
|
+
internal?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const appCreateCommand: YargsCommandModule<unknown, AppCreateArgs>;
|
|
9
|
+
export default appCreateCommand;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import { logError } from '../../../lib/errorHandlers/index.js';
|
|
3
|
+
import { resolveLocalPath } from '../../../lib/filesystem.js';
|
|
4
|
+
import { trackCommandUsage } from '../../../lib/usageTracking.js';
|
|
5
|
+
import { commands } from '../../../lang/en.js';
|
|
6
|
+
import { uiLogger } from '../../../lib/ui/logger.js';
|
|
7
|
+
import { makeYargsBuilder } from '../../../lib/yargsUtils.js';
|
|
8
|
+
import { EXIT_CODES } from '../../../lib/enums/exitCodes.js';
|
|
9
|
+
import assets from '../../../lib/cmsAssets/index.js';
|
|
10
|
+
const APP_ASSET_TYPES = ['api-sample', 'app', 'react-app', 'vue-app'];
|
|
11
|
+
const SUPPORTED_APP_TYPES = APP_ASSET_TYPES.filter(t => !assets[t].hidden).join(', ');
|
|
12
|
+
const command = 'create <type> [name] [dest]';
|
|
13
|
+
const describe = commands.cms.subcommands.app.subcommands.create.describe;
|
|
14
|
+
async function handler(args) {
|
|
15
|
+
const { derivedAccountId, name, internal: getInternalVersion, type, dest, } = args;
|
|
16
|
+
const assetType = type.toLowerCase();
|
|
17
|
+
if (!assetType || !APP_ASSET_TYPES.includes(assetType)) {
|
|
18
|
+
uiLogger.error(commands.cms.subcommands.app.subcommands.create.errors.unsupportedAssetType(assetType, SUPPORTED_APP_TYPES));
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
trackCommandUsage('create', { assetType }, derivedAccountId);
|
|
22
|
+
const asset = assets[assetType];
|
|
23
|
+
const argsToPass = {
|
|
24
|
+
commandArgs: args,
|
|
25
|
+
assetType,
|
|
26
|
+
name,
|
|
27
|
+
dest,
|
|
28
|
+
getInternalVersion: getInternalVersion || false,
|
|
29
|
+
};
|
|
30
|
+
if (!argsToPass.dest) {
|
|
31
|
+
argsToPass.dest = resolveLocalPath(asset.dest(argsToPass));
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
await fs.ensureDir(argsToPass.dest);
|
|
35
|
+
}
|
|
36
|
+
catch (e) {
|
|
37
|
+
uiLogger.error(commands.cms.subcommands.app.subcommands.create.errors.unusablePath(argsToPass.dest));
|
|
38
|
+
logError(e);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (asset.validate && !asset.validate(argsToPass))
|
|
42
|
+
return;
|
|
43
|
+
try {
|
|
44
|
+
await asset.execute(argsToPass);
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
logError(e);
|
|
48
|
+
process.exit(EXIT_CODES.ERROR);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function appCreateBuilder(yargs) {
|
|
52
|
+
yargs.positional('type', {
|
|
53
|
+
describe: commands.cms.subcommands.app.subcommands.create.positionals.type,
|
|
54
|
+
type: 'string',
|
|
55
|
+
choices: APP_ASSET_TYPES.filter(t => !assets[t].hidden),
|
|
56
|
+
});
|
|
57
|
+
yargs.positional('name', {
|
|
58
|
+
describe: commands.cms.subcommands.app.subcommands.create.positionals.name,
|
|
59
|
+
type: 'string',
|
|
60
|
+
});
|
|
61
|
+
yargs.positional('dest', {
|
|
62
|
+
describe: commands.cms.subcommands.app.subcommands.create.positionals.dest,
|
|
63
|
+
type: 'string',
|
|
64
|
+
});
|
|
65
|
+
yargs.option('internal', {
|
|
66
|
+
describe: 'Internal HubSpot version of creation command',
|
|
67
|
+
type: 'boolean',
|
|
68
|
+
hidden: true,
|
|
69
|
+
});
|
|
70
|
+
return yargs;
|
|
71
|
+
}
|
|
72
|
+
const builder = makeYargsBuilder(appCreateBuilder, command, describe, {
|
|
73
|
+
useGlobalOptions: true,
|
|
74
|
+
useConfigOptions: true,
|
|
75
|
+
});
|
|
76
|
+
const appCreateCommand = {
|
|
77
|
+
command,
|
|
78
|
+
describe,
|
|
79
|
+
builder,
|
|
80
|
+
handler,
|
|
81
|
+
};
|
|
82
|
+
export default appCreateCommand;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import createCommand from './app/create.js';
|
|
2
|
+
import { commands } from '../../lang/en.js';
|
|
3
|
+
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
4
|
+
const command = ['app', 'apps'];
|
|
5
|
+
const describe = commands.cms.subcommands.app.describe;
|
|
6
|
+
function appBuilder(yargs) {
|
|
7
|
+
yargs.command(createCommand).demandCommand(1, '');
|
|
8
|
+
return yargs;
|
|
9
|
+
}
|
|
10
|
+
const builder = makeYargsBuilder(appBuilder, command, describe);
|
|
11
|
+
const appCommand = {
|
|
12
|
+
command,
|
|
13
|
+
describe,
|
|
14
|
+
builder,
|
|
15
|
+
handler: () => { },
|
|
16
|
+
};
|
|
17
|
+
export default appCommand;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AccountArgs, CommonArgs, ConfigArgs, EnvironmentArgs, YargsCommandModule } from '../../types/Yargs.js';
|
|
2
|
+
export type DeleteArgs = CommonArgs & ConfigArgs & EnvironmentArgs & AccountArgs & {
|
|
3
|
+
path: string;
|
|
4
|
+
};
|
|
5
|
+
declare const cmsDeleteCommand: YargsCommandModule<unknown, DeleteArgs>;
|
|
6
|
+
export default cmsDeleteCommand;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { deleteFile } from '@hubspot/local-dev-lib/api/fileMapper';
|
|
2
|
+
import { logError, ApiErrorContext } from '../../lib/errorHandlers/index.js';
|
|
3
|
+
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
4
|
+
import { commands } from '../../lang/en.js';
|
|
5
|
+
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
6
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
7
|
+
const command = 'delete <path>';
|
|
8
|
+
const describe = commands.cms.subcommands.delete.describe;
|
|
9
|
+
async function handler(args) {
|
|
10
|
+
const { path: hsPath, derivedAccountId } = args;
|
|
11
|
+
trackCommandUsage('delete', undefined, derivedAccountId);
|
|
12
|
+
try {
|
|
13
|
+
await deleteFile(derivedAccountId, hsPath);
|
|
14
|
+
uiLogger.log(commands.cms.subcommands.delete.deleted(hsPath, derivedAccountId));
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
uiLogger.error(commands.cms.subcommands.delete.errors.deleteFailed(hsPath, derivedAccountId));
|
|
18
|
+
logError(error, new ApiErrorContext({
|
|
19
|
+
accountId: derivedAccountId,
|
|
20
|
+
request: hsPath,
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function cmsDeleteBuilder(yargs) {
|
|
25
|
+
yargs.positional('path', {
|
|
26
|
+
describe: commands.cms.subcommands.delete.positionals.path,
|
|
27
|
+
type: 'string',
|
|
28
|
+
});
|
|
29
|
+
return yargs;
|
|
30
|
+
}
|
|
31
|
+
const builder = makeYargsBuilder(cmsDeleteBuilder, command, describe, {
|
|
32
|
+
useGlobalOptions: true,
|
|
33
|
+
useConfigOptions: true,
|
|
34
|
+
useAccountOptions: true,
|
|
35
|
+
useEnvironmentOptions: true,
|
|
36
|
+
});
|
|
37
|
+
const cmsDeleteCommand = {
|
|
38
|
+
command,
|
|
39
|
+
describe,
|
|
40
|
+
handler,
|
|
41
|
+
builder,
|
|
42
|
+
};
|
|
43
|
+
export default cmsDeleteCommand;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CmsPublishMode } from '@hubspot/local-dev-lib/types/Files';
|
|
2
|
+
import { AccountArgs, CommonArgs, ConfigArgs, EnvironmentArgs, YargsCommandModule } from '../../types/Yargs.js';
|
|
3
|
+
export type FetchCommandArgs = {
|
|
4
|
+
src: string;
|
|
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;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { downloadFileOrFolder } from '@hubspot/local-dev-lib/fileMapper';
|
|
2
|
+
import { addCmsPublishModeOptions, addOverwriteOptions, getCmsPublishMode, } from '../../lib/commonOpts.js';
|
|
3
|
+
import { resolveLocalPath } from '../../lib/filesystem.js';
|
|
4
|
+
import { validateCmsPublishMode } from '../../lib/validation.js';
|
|
5
|
+
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
6
|
+
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
7
|
+
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
8
|
+
import { logError } from '../../lib/errorHandlers/index.js';
|
|
9
|
+
import { commands } from '../../lang/en.js';
|
|
10
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
11
|
+
const command = 'fetch <src> [dest]';
|
|
12
|
+
const describe = commands.cms.subcommands.fetch.describe;
|
|
13
|
+
async function handler(options) {
|
|
14
|
+
const { src, dest } = options;
|
|
15
|
+
if (!validateCmsPublishMode(options)) {
|
|
16
|
+
process.exit(EXIT_CODES.ERROR);
|
|
17
|
+
}
|
|
18
|
+
if (typeof src !== 'string') {
|
|
19
|
+
uiLogger.error(commands.cms.subcommands.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) => {
|
|
40
|
+
yargs.positional('src', {
|
|
41
|
+
describe: commands.cms.subcommands.fetch.positionals.src.describe,
|
|
42
|
+
type: 'string',
|
|
43
|
+
});
|
|
44
|
+
yargs.positional('dest', {
|
|
45
|
+
describe: commands.cms.subcommands.fetch.positionals.dest.describe,
|
|
46
|
+
type: 'string',
|
|
47
|
+
});
|
|
48
|
+
yargs.options({
|
|
49
|
+
staging: {
|
|
50
|
+
describe: commands.cms.subcommands.fetch.options.staging.describe,
|
|
51
|
+
type: 'boolean',
|
|
52
|
+
default: false,
|
|
53
|
+
hidden: true,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
yargs.options({
|
|
57
|
+
assetVersion: {
|
|
58
|
+
type: 'number',
|
|
59
|
+
describe: commands.cms.subcommands.fetch.options.assetVersion.describe,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
addCmsPublishModeOptions(yargs, { read: true });
|
|
63
|
+
addOverwriteOptions(yargs);
|
|
64
|
+
return yargs;
|
|
65
|
+
};
|
|
66
|
+
const builder = makeYargsBuilder(fetchBuilder, command, describe, {
|
|
67
|
+
useConfigOptions: true,
|
|
68
|
+
useAccountOptions: true,
|
|
69
|
+
useGlobalOptions: true,
|
|
70
|
+
useEnvironmentOptions: true,
|
|
71
|
+
useTestingOptions: false,
|
|
72
|
+
});
|
|
73
|
+
const fetchCommand = {
|
|
74
|
+
command,
|
|
75
|
+
describe,
|
|
76
|
+
handler,
|
|
77
|
+
builder,
|
|
78
|
+
};
|
|
79
|
+
export default fetchCommand;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import yargs from 'yargs';
|
|
2
|
-
import { addConfigOptions, addAccountOptions, addUseEnvironmentOptions, } from '
|
|
3
|
-
|
|
2
|
+
import { addConfigOptions, addAccountOptions, addUseEnvironmentOptions, } from '../../../../lib/commonOpts.js';
|
|
3
|
+
import logsCommand from '../logs.js';
|
|
4
|
+
vi.mock('../../../../lib/commonOpts');
|
|
4
5
|
const optionsSpy = vi
|
|
5
6
|
.spyOn(yargs, 'options')
|
|
6
7
|
.mockReturnValue(yargs);
|
|
@@ -13,9 +14,7 @@ const exampleSpy = vi
|
|
|
13
14
|
const positionalSpy = vi
|
|
14
15
|
.spyOn(yargs, 'positional')
|
|
15
16
|
.mockReturnValue(yargs);
|
|
16
|
-
|
|
17
|
-
import logsCommand from '../logs.js';
|
|
18
|
-
describe('commands/logs', () => {
|
|
17
|
+
describe('commands/cms/function/logs', () => {
|
|
19
18
|
describe('command', () => {
|
|
20
19
|
it('should have the correct command structure', () => {
|
|
21
20
|
expect(logsCommand.command).toEqual('logs [endpoint]');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HttpMethod } from '../../../types/Cms.js';
|
|
2
|
+
import { CommonArgs, ConfigArgs, YargsCommandModule } from '../../../types/Yargs.js';
|
|
3
|
+
type FunctionCreateArgs = CommonArgs & ConfigArgs & {
|
|
4
|
+
name?: string;
|
|
5
|
+
dest?: string;
|
|
6
|
+
functionsFolder?: string;
|
|
7
|
+
filename?: string;
|
|
8
|
+
endpointMethod?: HttpMethod;
|
|
9
|
+
endpointPath?: string;
|
|
10
|
+
};
|
|
11
|
+
declare const functionCreateCommand: YargsCommandModule<unknown, FunctionCreateArgs>;
|
|
12
|
+
export default functionCreateCommand;
|