@hubspot/cli 7.5.11-experimental.0 → 7.6.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/bin/cli.js +102 -95
- package/commands/account/auth.d.ts +5 -7
- package/commands/account/auth.js +74 -87
- package/commands/account/clean.d.ts +3 -7
- package/commands/account/clean.js +16 -9
- package/commands/account/createOverride.d.ts +3 -7
- package/commands/account/createOverride.js +23 -6
- package/commands/account/info.d.ts +3 -7
- package/commands/account/info.js +13 -5
- package/commands/account/list.d.ts +3 -7
- package/commands/account/list.js +15 -8
- package/commands/account/remove.d.ts +3 -7
- package/commands/account/remove.js +21 -9
- package/commands/account/removeOverride.d.ts +3 -7
- package/commands/account/removeOverride.js +23 -6
- package/commands/account/rename.d.ts +3 -7
- package/commands/account/rename.js +16 -9
- package/commands/account/use.d.ts +5 -9
- package/commands/account/use.js +14 -6
- package/commands/account.d.ts +3 -4
- package/commands/account.js +33 -58
- package/commands/app/migrate.d.ts +1 -2
- package/commands/app/migrate.js +7 -8
- package/commands/app/secret/add.d.ts +7 -0
- package/commands/app/secret/add.js +64 -0
- package/commands/app/secret/delete.d.ts +8 -0
- package/commands/app/secret/delete.js +87 -0
- package/commands/app/secret/list.d.ts +6 -0
- package/commands/app/secret/list.js +64 -0
- package/commands/app/secret/update.d.ts +7 -0
- package/commands/app/secret/update.js +77 -0
- package/commands/app/secret.d.ts +3 -0
- package/commands/app/secret.js +30 -0
- package/commands/app.d.ts +2 -5
- package/commands/app.js +10 -8
- package/commands/auth.d.ts +5 -7
- package/commands/auth.js +29 -28
- package/commands/cms/convertFields.d.ts +7 -1
- package/commands/cms/convertFields.js +57 -41
- package/commands/cms/getReactModule.d.ts +7 -1
- package/commands/cms/getReactModule.js +52 -34
- package/commands/cms/lighthouseScore.d.ts +8 -1
- package/commands/cms/lighthouseScore.js +129 -100
- package/commands/cms.d.ts +3 -1
- package/commands/cms.js +22 -15
- package/commands/completion.d.ts +3 -1
- package/commands/completion.js +23 -12
- package/commands/config/migrate.d.ts +3 -7
- package/commands/config/migrate.js +37 -46
- package/commands/config/set.d.ts +5 -6
- package/commands/config/set.js +38 -14
- package/commands/config.d.ts +3 -4
- package/commands/config.js +18 -44
- package/commands/create/api-sample.d.ts +3 -1
- package/commands/create/api-sample.js +34 -38
- package/commands/create/app.d.ts +3 -1
- package/commands/create/app.js +9 -7
- package/commands/create/function.d.ts +3 -1
- package/commands/create/function.js +11 -10
- package/commands/create/index.d.ts +5 -1
- package/commands/create/index.js +23 -11
- package/commands/create/module.d.ts +3 -1
- package/commands/create/module.js +14 -13
- package/commands/create/react-app.d.ts +3 -1
- package/commands/create/react-app.js +10 -7
- package/commands/create/template.d.ts +3 -1
- package/commands/create/template.js +14 -14
- package/commands/create/vue-app.d.ts +3 -1
- package/commands/create/vue-app.js +10 -7
- package/commands/create/webpack-serverless.d.ts +3 -1
- package/commands/create/webpack-serverless.js +10 -7
- package/commands/create/website-theme.d.ts +3 -1
- package/commands/create/website-theme.js +10 -9
- package/commands/create.d.ts +4 -24
- package/commands/create.js +62 -74
- package/commands/customObject/create.d.ts +4 -9
- package/commands/customObject/create.js +17 -10
- package/commands/customObject/schema/create.d.ts +4 -9
- package/commands/customObject/schema/create.js +18 -11
- package/commands/customObject/schema/delete.d.ts +4 -9
- package/commands/customObject/schema/delete.js +17 -10
- package/commands/customObject/schema/fetch-all.d.ts +4 -9
- package/commands/customObject/schema/fetch-all.js +17 -10
- package/commands/customObject/schema/fetch.d.ts +4 -9
- package/commands/customObject/schema/fetch.js +17 -10
- package/commands/customObject/schema/list.d.ts +4 -8
- package/commands/customObject/schema/list.js +17 -10
- package/commands/customObject/schema/update.d.ts +4 -9
- package/commands/customObject/schema/update.js +18 -11
- package/commands/customObject/schema.d.ts +3 -5
- package/commands/customObject/schema.js +27 -54
- package/commands/customObject.d.ts +3 -4
- package/commands/customObject.js +18 -45
- package/commands/doctor.d.ts +6 -8
- package/commands/doctor.js +30 -21
- package/commands/feedback.d.ts +4 -1
- package/commands/feedback.js +38 -47
- package/commands/fetch.d.ts +12 -1
- package/commands/fetch.js +49 -33
- package/commands/filemanager/fetch.d.ts +4 -9
- package/commands/filemanager/fetch.js +18 -11
- package/commands/filemanager/upload.d.ts +4 -9
- package/commands/filemanager/upload.js +17 -11
- package/commands/filemanager.d.ts +3 -4
- package/commands/filemanager.js +18 -41
- package/commands/function/deploy.d.ts +6 -1
- package/commands/function/deploy.js +70 -50
- package/commands/function/list.d.ts +6 -1
- package/commands/function/list.js +44 -32
- package/commands/function/server.d.ts +10 -1
- package/commands/function/server.js +49 -38
- package/commands/function.d.ts +5 -1
- package/commands/function.js +22 -10
- package/commands/getStarted.d.ts +9 -0
- package/commands/getStarted.js +227 -0
- package/commands/hubdb/clear.d.ts +4 -9
- package/commands/hubdb/clear.js +17 -10
- package/commands/hubdb/create.d.ts +4 -9
- package/commands/hubdb/create.js +17 -10
- package/commands/hubdb/delete.d.ts +4 -9
- package/commands/hubdb/delete.js +17 -10
- package/commands/hubdb/fetch.d.ts +4 -9
- package/commands/hubdb/fetch.js +17 -10
- package/commands/hubdb/list.d.ts +4 -0
- package/commands/hubdb/list.js +83 -0
- package/commands/hubdb.d.ts +3 -2
- package/commands/hubdb.js +23 -45
- package/commands/init.d.ts +3 -7
- package/commands/init.js +17 -8
- package/commands/lint.d.ts +6 -4
- package/commands/lint.js +42 -43
- package/commands/list.d.ts +3 -7
- package/commands/list.js +17 -11
- package/commands/logs.d.ts +10 -1
- package/commands/logs.js +53 -44
- package/commands/mcp/setup.d.ts +7 -0
- package/commands/mcp/setup.js +52 -0
- package/commands/mcp/start.d.ts +3 -0
- package/commands/mcp/start.js +77 -0
- package/commands/mcp.d.ts +3 -0
- package/commands/mcp.js +26 -0
- package/commands/module/marketplace-validate.d.ts +6 -1
- package/commands/module/marketplace-validate.js +39 -29
- package/commands/module.d.ts +3 -1
- package/commands/module.js +23 -10
- package/commands/mv.d.ts +3 -7
- package/commands/mv.js +17 -11
- package/commands/open.d.ts +3 -7
- package/commands/open.js +17 -11
- package/commands/project/add.d.ts +5 -2
- package/commands/project/add.js +43 -80
- package/commands/project/cloneApp.d.ts +1 -1
- package/commands/project/cloneApp.js +2 -2
- package/commands/project/create.d.ts +2 -8
- package/commands/project/create.js +84 -55
- package/commands/project/deploy.d.ts +2 -0
- package/commands/project/deploy.js +67 -13
- package/commands/project/dev/deprecatedFlow.d.ts +8 -2
- package/commands/project/dev/deprecatedFlow.js +9 -1
- package/commands/project/dev/index.d.ts +1 -4
- package/commands/project/dev/index.js +88 -31
- package/commands/project/dev/unifiedFlow.d.ts +11 -2
- package/commands/project/dev/unifiedFlow.js +81 -41
- package/commands/project/listBuilds.js +2 -5
- package/commands/project/migrate.d.ts +1 -0
- package/commands/project/profile/add.d.ts +7 -0
- package/commands/project/profile/add.js +209 -0
- package/commands/project/profile/delete.d.ts +6 -0
- package/commands/project/profile/delete.js +123 -0
- package/commands/project/profile.d.ts +3 -0
- package/commands/project/profile.js +25 -0
- package/commands/project/upload.d.ts +1 -0
- package/commands/project/upload.js +22 -8
- package/commands/project/validate.d.ts +6 -0
- package/commands/project/validate.js +82 -0
- package/commands/project.js +4 -2
- package/commands/remove.d.ts +3 -7
- package/commands/remove.js +22 -22
- package/commands/sandbox/create.d.ts +4 -9
- package/commands/sandbox/create.js +18 -11
- package/commands/sandbox/delete.d.ts +4 -9
- package/commands/sandbox/delete.js +18 -11
- package/commands/sandbox.d.ts +3 -4
- package/commands/sandbox.js +18 -43
- package/commands/secret/addSecret.d.ts +4 -9
- package/commands/secret/addSecret.js +17 -10
- package/commands/secret/deleteSecret.d.ts +4 -9
- package/commands/secret/deleteSecret.js +17 -10
- package/commands/secret/listSecret.d.ts +4 -9
- package/commands/secret/listSecret.js +17 -10
- package/commands/secret/updateSecret.d.ts +4 -9
- package/commands/secret/updateSecret.js +17 -10
- package/commands/secret.d.ts +3 -4
- package/commands/secret.js +23 -48
- package/commands/testAccount/create.d.ts +6 -0
- package/commands/testAccount/create.js +100 -0
- package/commands/testAccount/createConfig.d.ts +10 -0
- package/commands/testAccount/createConfig.js +98 -0
- package/commands/testAccount/delete.d.ts +6 -0
- package/commands/testAccount/delete.js +48 -0
- package/commands/testAccount.d.ts +3 -0
- package/commands/testAccount.js +28 -0
- package/commands/theme/generate-selectors.d.ts +3 -7
- package/commands/theme/generate-selectors.js +20 -15
- package/commands/theme/marketplace-validate.d.ts +4 -9
- package/commands/theme/marketplace-validate.js +22 -17
- package/commands/theme/preview.d.ts +4 -9
- package/commands/theme/preview.js +32 -26
- package/commands/theme.d.ts +3 -4
- package/commands/theme.js +22 -47
- package/commands/upload.d.ts +12 -1
- package/commands/upload.js +116 -134
- package/commands/watch.d.ts +14 -1
- package/commands/watch.js +74 -75
- package/lang/en.d.ts +1135 -660
- package/lang/en.js +935 -471
- package/lang/en.lyaml +30 -213
- package/lib/accountTypes.js +1 -2
- package/lib/app/migrate.d.ts +23 -0
- package/lib/app/migrate.js +29 -6
- package/lib/app/migrate_legacy.js +7 -7
- package/lib/app/urls.d.ts +16 -0
- package/lib/app/urls.js +16 -0
- package/lib/commonOpts.d.ts +1 -3
- package/lib/commonOpts.js +1 -1
- package/lib/configMigrate.d.ts +2 -2
- package/lib/configMigrate.js +34 -55
- package/lib/configOptions.d.ts +4 -0
- package/lib/configOptions.js +41 -46
- package/lib/constants.d.ts +29 -0
- package/lib/constants.js +30 -1
- package/lib/dependencyManagement.d.ts +0 -5
- package/lib/dependencyManagement.js +13 -39
- package/lib/doctor/Doctor.js +3 -2
- package/lib/errorHandlers/index.js +7 -0
- package/lib/filesystem.d.ts +1 -1
- package/lib/generateSelectors.js +3 -5
- package/lib/interpolation.d.ts +2 -3
- package/lib/lang.d.ts +2 -3
- package/lib/marketplaceValidate.d.ts +12 -2
- package/lib/marketplaceValidate.js +22 -29
- package/lib/mcp/setup.d.ts +21 -0
- package/lib/mcp/setup.js +218 -0
- package/lib/middleware/autoUpdateMiddleware.d.ts +1 -0
- package/lib/middleware/autoUpdateMiddleware.js +89 -0
- package/lib/middleware/configMiddleware.js +23 -0
- package/lib/middleware/fireAlarmMiddleware.d.ts +2 -2
- package/lib/middleware/fireAlarmMiddleware.js +5 -3
- package/lib/npm.d.ts +9 -0
- package/lib/npm.js +36 -0
- package/lib/projectProfiles.d.ts +7 -0
- package/lib/projectProfiles.js +83 -0
- package/lib/projects/add/legacyAddComponent.d.ts +5 -0
- package/lib/projects/add/legacyAddComponent.js +48 -0
- package/lib/projects/add/v3AddComponent.d.ts +8 -0
- package/lib/projects/add/v3AddComponent.js +85 -0
- package/lib/projects/buildAndDeploy.js +18 -3
- package/lib/projects/components.d.ts +2 -0
- package/lib/projects/components.js +82 -0
- package/lib/projects/create/index.d.ts +23 -0
- package/lib/projects/create/index.js +33 -0
- package/lib/projects/create/legacy.d.ts +6 -0
- package/lib/projects/{create.js → create/legacy.js} +20 -11
- package/lib/projects/create/v3.d.ts +27 -0
- package/lib/projects/create/v3.js +158 -0
- package/lib/projects/localDev/AppDevModeInterface.d.ts +30 -0
- package/lib/projects/localDev/AppDevModeInterface.js +215 -0
- package/lib/projects/localDev/DevServerManagerV2.d.ts +11 -22
- package/lib/projects/localDev/DevServerManagerV2.js +19 -15
- package/lib/projects/localDev/LocalDevLogger.d.ts +30 -0
- package/lib/projects/localDev/LocalDevLogger.js +159 -0
- package/lib/projects/localDev/LocalDevManager.js +12 -5
- package/lib/projects/localDev/LocalDevProcess.d.ts +34 -0
- package/lib/projects/localDev/LocalDevProcess.js +201 -0
- package/lib/projects/localDev/LocalDevState.d.ts +50 -0
- package/lib/projects/localDev/LocalDevState.js +119 -0
- package/lib/projects/localDev/LocalDevWatcher.d.ts +10 -0
- package/lib/projects/localDev/LocalDevWatcher.js +53 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +20 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.js +131 -0
- package/lib/projects/localDev/helpers.d.ts +3 -2
- package/lib/projects/localDev/helpers.js +32 -2
- package/lib/projects/upload.d.ts +5 -1
- package/lib/projects/upload.js +60 -20
- package/lib/projects/urls.d.ts +3 -0
- package/lib/projects/urls.js +17 -1
- package/lib/prompts/createApiSamplePrompt.d.ts +2 -10
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.d.ts +17 -0
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +96 -0
- package/lib/prompts/createProjectPrompt.d.ts +14 -5
- package/lib/prompts/createProjectPrompt.js +38 -13
- package/lib/prompts/createTemplatePrompt.d.ts +22 -4
- package/lib/prompts/installAppPrompt.d.ts +2 -0
- package/lib/prompts/installAppPrompt.js +45 -0
- package/lib/prompts/personalAccessKeyPrompt.js +35 -24
- package/lib/prompts/projectAddPrompt.d.ts +5 -1
- package/lib/prompts/projectAddPrompt.js +35 -7
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +6 -1
- package/lib/prompts/projectDevTargetAccountPrompt.js +6 -6
- package/lib/prompts/promptUtils.d.ts +4 -1
- package/lib/prompts/promptUtils.js +5 -1
- package/lib/prompts/selectAppPrompt.d.ts +2 -0
- package/lib/prompts/selectAppPrompt.js +40 -0
- package/lib/prompts/{selectPublicAppPrompt.d.ts → selectPublicAppForMigrationPrompt.d.ts} +1 -1
- package/lib/prompts/{selectPublicAppPrompt.js → selectPublicAppForMigrationPrompt.js} +8 -8
- package/lib/prompts/setAsDefaultAccountPrompt.js +10 -0
- package/lib/testUtils.d.ts +3 -3
- package/lib/testUtils.js +8 -9
- package/lib/ui/index.js +4 -1
- package/lib/upload.d.ts +1 -1
- package/lib/validation.js +4 -5
- package/lib/yargsUtils.d.ts +4 -0
- package/lib/yargsUtils.js +6 -0
- package/mcp-server/server.d.ts +1 -0
- package/mcp-server/server.js +18 -0
- package/mcp-server/tools/index.d.ts +2 -0
- package/mcp-server/tools/index.js +19 -0
- package/mcp-server/tools/project/AddFeatureToProject.d.ts +29 -0
- package/mcp-server/tools/project/AddFeatureToProject.js +85 -0
- package/mcp-server/tools/project/CreateProjectTool.d.ts +35 -0
- package/mcp-server/tools/project/CreateProjectTool.js +104 -0
- package/mcp-server/tools/project/DeployProject.d.ts +20 -0
- package/mcp-server/tools/project/DeployProject.js +50 -0
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +17 -0
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +58 -0
- package/mcp-server/tools/project/UploadProjectTools.d.ts +17 -0
- package/mcp-server/tools/project/UploadProjectTools.js +35 -0
- package/mcp-server/tools/project/ValidateProjectTool.d.ts +17 -0
- package/mcp-server/tools/project/ValidateProjectTool.js +35 -0
- package/mcp-server/tools/project/constants.d.ts +3 -0
- package/mcp-server/tools/project/constants.js +13 -0
- package/mcp-server/types.d.ts +14 -0
- package/mcp-server/types.js +17 -0
- package/mcp-server/utils/command.d.ts +3 -0
- package/mcp-server/utils/command.js +16 -0
- package/mcp-server/utils/content.d.ts +3 -0
- package/mcp-server/utils/content.js +21 -0
- package/mcp-server/utils/project.d.ts +5 -0
- package/mcp-server/utils/project.js +17 -0
- package/package.json +24 -16
- package/types/Cms.d.ts +30 -0
- package/types/Cms.js +2 -0
- package/types/LocalDev.d.ts +35 -0
- package/types/LocalDev.js +2 -0
- package/types/Projects.d.ts +19 -2
- package/types/Prompts.d.ts +0 -7
- package/types/Yargs.d.ts +10 -1
- package/lib/projects/create.d.ts +0 -5
- package/lib/projects/localDev/LocalDevManagerV2.d.ts +0 -64
- package/lib/projects/localDev/LocalDevManagerV2.js +0 -345
- package/lib/prompts/installPublicAppPrompt.d.ts +0 -1
- package/lib/prompts/installPublicAppPrompt.js +0 -41
package/commands/function.js
CHANGED
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
6
|
+
exports.describe = exports.command = void 0;
|
|
7
|
+
const list_1 = __importDefault(require("./function/list"));
|
|
8
|
+
const deploy_1 = __importDefault(require("./function/deploy"));
|
|
9
|
+
const server_1 = __importDefault(require("./function/server"));
|
|
10
|
+
const lang_1 = require("../lib/lang");
|
|
11
|
+
const yargsUtils_1 = require("../lib/yargsUtils");
|
|
9
12
|
exports.command = ['function', 'functions'];
|
|
10
|
-
exports.describe = i18n(`commands.function.describe`);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
yargs.command(list).command(deploy).command(server).demandCommand(1, '');
|
|
13
|
+
exports.describe = (0, lang_1.i18n)(`commands.function.describe`);
|
|
14
|
+
function functionBuilder(yargs) {
|
|
15
|
+
yargs.command(list_1.default).command(deploy_1.default).command(server_1.default).demandCommand(1, '');
|
|
14
16
|
return yargs;
|
|
17
|
+
}
|
|
18
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(functionBuilder, exports.command, exports.describe, {
|
|
19
|
+
useGlobalOptions: true,
|
|
20
|
+
});
|
|
21
|
+
const functionCommand = {
|
|
22
|
+
command: exports.command,
|
|
23
|
+
describe: exports.describe,
|
|
24
|
+
builder,
|
|
25
|
+
handler: () => { },
|
|
15
26
|
};
|
|
27
|
+
exports.default = functionCommand;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AccountArgs, YargsCommandModule, CommonArgs, ConfigArgs, EnvironmentArgs } from '../types/Yargs';
|
|
2
|
+
export declare const command = "get-started";
|
|
3
|
+
export declare const describe: undefined;
|
|
4
|
+
type GetStartedArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & {
|
|
5
|
+
name?: string;
|
|
6
|
+
dest?: string;
|
|
7
|
+
};
|
|
8
|
+
declare const getStartedCommand: YargsCommandModule<unknown, GetStartedArgs>;
|
|
9
|
+
export default getStartedCommand;
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.describe = exports.command = void 0;
|
|
7
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const open_1 = __importDefault(require("open"));
|
|
10
|
+
const path_2 = require("@hubspot/local-dev-lib/path");
|
|
11
|
+
const github_1 = require("@hubspot/local-dev-lib/github");
|
|
12
|
+
const en_1 = require("../lang/en");
|
|
13
|
+
const usageTracking_1 = require("../lib/usageTracking");
|
|
14
|
+
const exitCodes_1 = require("../lib/enums/exitCodes");
|
|
15
|
+
const yargsUtils_1 = require("../lib/yargsUtils");
|
|
16
|
+
const promptUtils_1 = require("../lib/prompts/promptUtils");
|
|
17
|
+
const createProjectPrompt_1 = require("../lib/prompts/createProjectPrompt");
|
|
18
|
+
const ui_1 = require("../lib/ui");
|
|
19
|
+
const logger_1 = require("../lib/ui/logger");
|
|
20
|
+
const errorHandlers_1 = require("../lib/errorHandlers");
|
|
21
|
+
const upload_1 = require("../lib/projects/upload");
|
|
22
|
+
const constants_1 = require("../lib/constants");
|
|
23
|
+
const config_1 = require("../lib/projects/config");
|
|
24
|
+
const buildAndDeploy_1 = require("../lib/projects/buildAndDeploy");
|
|
25
|
+
const urls_1 = require("../lib/projects/urls");
|
|
26
|
+
const links_1 = require("../lib/links");
|
|
27
|
+
exports.command = 'get-started';
|
|
28
|
+
exports.describe = undefined;
|
|
29
|
+
async function handler(args) {
|
|
30
|
+
const { derivedAccountId } = args;
|
|
31
|
+
// TODO: Put this in constants.ts once we have a defined place for the template before INBOUND
|
|
32
|
+
const templateSource = 'robrown-hubspot/hubspot-project-components-ua-app-objects-beta';
|
|
33
|
+
(0, usageTracking_1.trackCommandUsage)('get-started', {}, derivedAccountId);
|
|
34
|
+
(0, ui_1.uiInfoSection)(en_1.commands.getStarted.startTitle, () => {
|
|
35
|
+
logger_1.uiLogger.log(en_1.commands.getStarted.startDescription);
|
|
36
|
+
});
|
|
37
|
+
const { default: selectedOption } = await (0, promptUtils_1.promptUser)([
|
|
38
|
+
{
|
|
39
|
+
type: 'list',
|
|
40
|
+
name: 'default',
|
|
41
|
+
message: en_1.commands.getStarted.prompts.selectOption,
|
|
42
|
+
choices: [
|
|
43
|
+
{
|
|
44
|
+
name: en_1.commands.getStarted.prompts.options.app,
|
|
45
|
+
value: constants_1.GET_STARTED_OPTIONS.APP,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: en_1.commands.getStarted.prompts.options.cms,
|
|
49
|
+
value: constants_1.GET_STARTED_OPTIONS.CMS,
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
default: constants_1.GET_STARTED_OPTIONS.APP,
|
|
53
|
+
},
|
|
54
|
+
]);
|
|
55
|
+
if (selectedOption === constants_1.GET_STARTED_OPTIONS.CMS) {
|
|
56
|
+
logger_1.uiLogger.log(' ');
|
|
57
|
+
logger_1.uiLogger.log(en_1.commands.getStarted.designManager);
|
|
58
|
+
if (process.env.BROWSER !== 'none') {
|
|
59
|
+
logger_1.uiLogger.log(' ');
|
|
60
|
+
const { shouldOpen } = await (0, promptUtils_1.promptUser)([
|
|
61
|
+
{
|
|
62
|
+
name: 'shouldOpen',
|
|
63
|
+
type: 'confirm',
|
|
64
|
+
message: en_1.commands.getStarted.openDesignManagerPrompt,
|
|
65
|
+
},
|
|
66
|
+
]);
|
|
67
|
+
if (shouldOpen) {
|
|
68
|
+
logger_1.uiLogger.log('');
|
|
69
|
+
(0, links_1.openLink)(derivedAccountId, 'design-manager');
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
logger_1.uiLogger.log(' ');
|
|
76
|
+
logger_1.uiLogger.log(en_1.commands.getStarted.prompts.appSelected);
|
|
77
|
+
// 1. Fetch project templates
|
|
78
|
+
let latestRepoReleaseTag;
|
|
79
|
+
const { dest, name } = await (0, createProjectPrompt_1.createProjectPrompt)(args);
|
|
80
|
+
// Specific template for get-started command
|
|
81
|
+
const projectTemplate = {
|
|
82
|
+
name: 'private-app-get-started-template',
|
|
83
|
+
label: 'CRM getting started project with private apps',
|
|
84
|
+
path: 'projects/private-app-get-started-template',
|
|
85
|
+
};
|
|
86
|
+
// 3. Create the project files
|
|
87
|
+
const projectDest = path_1.default.resolve((0, path_2.getCwd)(), dest);
|
|
88
|
+
const { projectConfig: existingProjectConfig, projectDir: existingProjectDir, } = await (0, config_1.getProjectConfig)(projectDest);
|
|
89
|
+
if (existingProjectConfig &&
|
|
90
|
+
existingProjectDir &&
|
|
91
|
+
projectDest.startsWith(existingProjectDir)) {
|
|
92
|
+
logger_1.uiLogger.log(' ');
|
|
93
|
+
logger_1.uiLogger.error(en_1.commands.project.create.errors.cannotNestProjects(existingProjectDir));
|
|
94
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
95
|
+
}
|
|
96
|
+
const repo = templateSource || constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH;
|
|
97
|
+
// 4. Clone the project template from GitHub
|
|
98
|
+
// This is temporary until we have the UA template in the main repo
|
|
99
|
+
try {
|
|
100
|
+
await (0, github_1.cloneGithubRepo)(repo, projectDest, {
|
|
101
|
+
sourceDir: projectTemplate.path,
|
|
102
|
+
tag: latestRepoReleaseTag,
|
|
103
|
+
hideLogs: true,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
(0, errorHandlers_1.debugError)(err);
|
|
108
|
+
logger_1.uiLogger.log(' ');
|
|
109
|
+
logger_1.uiLogger.error(en_1.commands.project.create.errors.failedToDownloadProject);
|
|
110
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
111
|
+
}
|
|
112
|
+
const projectConfigPath = path_1.default.join(projectDest, constants_1.PROJECT_CONFIG_FILE);
|
|
113
|
+
const parsedConfigFile = JSON.parse(fs_extra_1.default.readFileSync(projectConfigPath).toString());
|
|
114
|
+
(0, config_1.writeProjectConfig)(projectConfigPath, {
|
|
115
|
+
...parsedConfigFile,
|
|
116
|
+
name,
|
|
117
|
+
});
|
|
118
|
+
logger_1.uiLogger.log(' ');
|
|
119
|
+
logger_1.uiLogger.success(en_1.commands.project.create.logs.success(name, projectDest));
|
|
120
|
+
logger_1.uiLogger.log(' ');
|
|
121
|
+
logger_1.uiLogger.log(en_1.commands.getStarted.prompts.projectCreated.title);
|
|
122
|
+
logger_1.uiLogger.log(' ');
|
|
123
|
+
logger_1.uiLogger.log(en_1.commands.getStarted.prompts.projectCreated.description);
|
|
124
|
+
logger_1.uiLogger.log(' ');
|
|
125
|
+
// 5. Ask user if they want to upload the project
|
|
126
|
+
const { shouldUpload } = await (0, promptUtils_1.promptUser)([
|
|
127
|
+
{
|
|
128
|
+
type: 'confirm',
|
|
129
|
+
name: 'shouldUpload',
|
|
130
|
+
message: en_1.commands.getStarted.prompts.uploadProject,
|
|
131
|
+
default: true,
|
|
132
|
+
},
|
|
133
|
+
]);
|
|
134
|
+
if (shouldUpload) {
|
|
135
|
+
try {
|
|
136
|
+
// Get the project config for the newly created project
|
|
137
|
+
const { projectConfig: newProjectConfig, projectDir: newProjectDir } = await (0, config_1.getProjectConfig)(projectDest);
|
|
138
|
+
if (!newProjectConfig || !newProjectDir) {
|
|
139
|
+
logger_1.uiLogger.log(' ');
|
|
140
|
+
logger_1.uiLogger.error(en_1.commands.getStarted.errors.configFileNotFound);
|
|
141
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
142
|
+
}
|
|
143
|
+
(0, config_1.validateProjectConfig)(newProjectConfig, newProjectDir);
|
|
144
|
+
const targetAccountId = derivedAccountId;
|
|
145
|
+
logger_1.uiLogger.log(' ');
|
|
146
|
+
logger_1.uiLogger.log(en_1.commands.getStarted.logs.uploadingProject);
|
|
147
|
+
logger_1.uiLogger.log(' ');
|
|
148
|
+
const { result, uploadError } = await (0, upload_1.handleProjectUpload)({
|
|
149
|
+
accountId: targetAccountId,
|
|
150
|
+
projectConfig: newProjectConfig,
|
|
151
|
+
projectDir: newProjectDir,
|
|
152
|
+
callbackFunc: buildAndDeploy_1.pollProjectBuildAndDeploy,
|
|
153
|
+
uploadMessage: 'Initial upload from get-started command',
|
|
154
|
+
forceCreate: true, // Auto-create project on HubSpot
|
|
155
|
+
isUploadCommand: false,
|
|
156
|
+
sendIR: (0, buildAndDeploy_1.useV3Api)(newProjectConfig.platformVersion),
|
|
157
|
+
skipValidation: false,
|
|
158
|
+
});
|
|
159
|
+
if (uploadError) {
|
|
160
|
+
logger_1.uiLogger.log(' ');
|
|
161
|
+
logger_1.uiLogger.error(en_1.commands.getStarted.errors.uploadFailed);
|
|
162
|
+
(0, errorHandlers_1.debugError)(uploadError);
|
|
163
|
+
}
|
|
164
|
+
else if (result) {
|
|
165
|
+
logger_1.uiLogger.log(' ');
|
|
166
|
+
logger_1.uiLogger.success(en_1.commands.getStarted.logs.uploadSuccess);
|
|
167
|
+
if (process.env.BROWSER !== 'none') {
|
|
168
|
+
logger_1.uiLogger.log(' ');
|
|
169
|
+
logger_1.uiLogger.log(en_1.commands.getStarted.developerOverviewBrowserOpenPrep);
|
|
170
|
+
logger_1.uiLogger.log(' ');
|
|
171
|
+
const { shouldOpenOverview } = await (0, promptUtils_1.promptUser)([
|
|
172
|
+
{
|
|
173
|
+
name: 'shouldOpenOverview',
|
|
174
|
+
type: 'confirm',
|
|
175
|
+
message: en_1.commands.getStarted.openDeveloperOverviewPrompt,
|
|
176
|
+
},
|
|
177
|
+
]);
|
|
178
|
+
if (shouldOpenOverview) {
|
|
179
|
+
(0, open_1.default)((0, urls_1.getProjectComponentDistributionUrl)(name, 'get_started_app', derivedAccountId), { url: true });
|
|
180
|
+
logger_1.uiLogger.log(' ');
|
|
181
|
+
logger_1.uiLogger.success(en_1.commands.getStarted.openedDeveloperOverview);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
logger_1.uiLogger.log(' ');
|
|
185
|
+
(0, ui_1.uiFeatureHighlight)(['projectDevCommand']);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
catch (err) {
|
|
189
|
+
logger_1.uiLogger.log(' ');
|
|
190
|
+
logger_1.uiLogger.error(en_1.commands.getStarted.errors.uploadFailed);
|
|
191
|
+
(0, errorHandlers_1.debugError)(err);
|
|
192
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
197
|
+
}
|
|
198
|
+
function getStartedBuilder(yargs) {
|
|
199
|
+
yargs.options({
|
|
200
|
+
name: {
|
|
201
|
+
describe: en_1.commands.getStarted.options.name.describe,
|
|
202
|
+
type: 'string',
|
|
203
|
+
},
|
|
204
|
+
dest: {
|
|
205
|
+
describe: en_1.commands.getStarted.options.dest.describe,
|
|
206
|
+
type: 'string',
|
|
207
|
+
},
|
|
208
|
+
'template-source': {
|
|
209
|
+
describe: en_1.commands.getStarted.options.templateSource.describe,
|
|
210
|
+
type: 'string',
|
|
211
|
+
},
|
|
212
|
+
});
|
|
213
|
+
return yargs;
|
|
214
|
+
}
|
|
215
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(getStartedBuilder, exports.command, en_1.commands.getStarted.verboseDescribe, {
|
|
216
|
+
useGlobalOptions: true,
|
|
217
|
+
useAccountOptions: true,
|
|
218
|
+
useConfigOptions: true,
|
|
219
|
+
useEnvironmentOptions: true,
|
|
220
|
+
});
|
|
221
|
+
const getStartedCommand = {
|
|
222
|
+
command: exports.command,
|
|
223
|
+
describe: exports.describe,
|
|
224
|
+
handler,
|
|
225
|
+
builder,
|
|
226
|
+
};
|
|
227
|
+
exports.default = getStartedCommand;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const command = "clear [table-id]";
|
|
4
|
-
export declare const describe: string;
|
|
5
|
-
type CombinedArgs = ConfigArgs & AccountArgs & EnvironmentArgs;
|
|
6
|
-
type HubdbClearArgs = CommonArgs & CombinedArgs & {
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, YargsCommandModule } from '../../types/Yargs';
|
|
2
|
+
type HubdbClearArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & {
|
|
7
3
|
tableId?: number;
|
|
8
4
|
dest?: string;
|
|
9
5
|
};
|
|
10
|
-
|
|
11
|
-
export
|
|
12
|
-
export {};
|
|
6
|
+
declare const hubdbClearCommand: YargsCommandModule<unknown, HubdbClearArgs>;
|
|
7
|
+
export default hubdbClearCommand;
|
package/commands/hubdb/clear.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.describe = exports.command = void 0;
|
|
4
|
-
exports.handler = handler;
|
|
5
|
-
exports.builder = builder;
|
|
6
3
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
7
4
|
const index_1 = require("../../lib/errorHandlers/index");
|
|
8
5
|
const hubdb_1 = require("@hubspot/local-dev-lib/hubdb");
|
|
9
6
|
const hubdb_2 = require("@hubspot/local-dev-lib/api/hubdb");
|
|
10
7
|
const selectHubDBTablePrompt_1 = require("../../lib/prompts/selectHubDBTablePrompt");
|
|
11
8
|
const usageTracking_1 = require("../../lib/usageTracking");
|
|
12
|
-
const commonOpts_1 = require("../../lib/commonOpts");
|
|
13
9
|
const lang_1 = require("../../lib/lang");
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
11
|
+
const command = 'clear [table-id]';
|
|
12
|
+
const describe = (0, lang_1.i18n)('commands.hubdb.subcommands.clear.describe');
|
|
16
13
|
async function handler(args) {
|
|
17
14
|
const { derivedAccountId } = args;
|
|
18
15
|
(0, usageTracking_1.trackCommandUsage)('hubdb-clear', {}, derivedAccountId);
|
|
@@ -45,13 +42,23 @@ async function handler(args) {
|
|
|
45
42
|
(0, index_1.logError)(e);
|
|
46
43
|
}
|
|
47
44
|
}
|
|
48
|
-
function
|
|
49
|
-
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
50
|
-
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
51
|
-
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
45
|
+
function hubdbClearBuilder(yargs) {
|
|
52
46
|
yargs.positional('table-id', {
|
|
53
47
|
describe: (0, lang_1.i18n)('commands.hubdb.subcommands.clear.positionals.tableId.describe'),
|
|
54
48
|
type: 'string',
|
|
55
49
|
});
|
|
56
50
|
return yargs;
|
|
57
51
|
}
|
|
52
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(hubdbClearBuilder, command, describe, {
|
|
53
|
+
useGlobalOptions: true,
|
|
54
|
+
useConfigOptions: true,
|
|
55
|
+
useAccountOptions: true,
|
|
56
|
+
useEnvironmentOptions: true,
|
|
57
|
+
});
|
|
58
|
+
const hubdbClearCommand = {
|
|
59
|
+
command,
|
|
60
|
+
describe,
|
|
61
|
+
handler,
|
|
62
|
+
builder,
|
|
63
|
+
};
|
|
64
|
+
exports.default = hubdbClearCommand;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const command = "create";
|
|
4
|
-
export declare const describe: string;
|
|
5
|
-
type CombinedArgs = ConfigArgs & AccountArgs & EnvironmentArgs;
|
|
6
|
-
type HubdbCreateArgs = CommonArgs & CombinedArgs & {
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, YargsCommandModule } from '../../types/Yargs';
|
|
2
|
+
type HubdbCreateArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & {
|
|
7
3
|
path?: string;
|
|
8
4
|
};
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
export {};
|
|
5
|
+
declare const hubdbCreateCommand: YargsCommandModule<unknown, HubdbCreateArgs>;
|
|
6
|
+
export default hubdbCreateCommand;
|
package/commands/hubdb/create.js
CHANGED
|
@@ -3,9 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.describe = exports.command = void 0;
|
|
7
|
-
exports.handler = handler;
|
|
8
|
-
exports.builder = builder;
|
|
9
6
|
const path_1 = __importDefault(require("path"));
|
|
10
7
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
11
8
|
const index_1 = require("../../lib/errorHandlers/index");
|
|
@@ -14,11 +11,11 @@ const hubdb_1 = require("@hubspot/local-dev-lib/hubdb");
|
|
|
14
11
|
const promptUtils_1 = require("../../lib/prompts/promptUtils");
|
|
15
12
|
const validation_1 = require("../../lib/validation");
|
|
16
13
|
const usageTracking_1 = require("../../lib/usageTracking");
|
|
17
|
-
const commonOpts_1 = require("../../lib/commonOpts");
|
|
18
14
|
const lang_1 = require("../../lib/lang");
|
|
19
15
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
17
|
+
const command = 'create';
|
|
18
|
+
const describe = (0, lang_1.i18n)(`commands.hubdb.subcommands.create.describe`);
|
|
22
19
|
function selectPathPrompt(options) {
|
|
23
20
|
return (0, promptUtils_1.promptUser)([
|
|
24
21
|
{
|
|
@@ -66,13 +63,23 @@ async function handler(args) {
|
|
|
66
63
|
(0, index_1.logError)(e);
|
|
67
64
|
}
|
|
68
65
|
}
|
|
69
|
-
function
|
|
70
|
-
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
71
|
-
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
72
|
-
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
66
|
+
function hubdbCreateBuilder(yargs) {
|
|
73
67
|
yargs.options('path', {
|
|
74
68
|
describe: (0, lang_1.i18n)(`commands.hubdb.subcommands.create.options.path.describe`),
|
|
75
69
|
type: 'string',
|
|
76
70
|
});
|
|
77
71
|
return yargs;
|
|
78
72
|
}
|
|
73
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(hubdbCreateBuilder, command, describe, {
|
|
74
|
+
useGlobalOptions: true,
|
|
75
|
+
useConfigOptions: true,
|
|
76
|
+
useAccountOptions: true,
|
|
77
|
+
useEnvironmentOptions: true,
|
|
78
|
+
});
|
|
79
|
+
const hubdbCreateCommand = {
|
|
80
|
+
command,
|
|
81
|
+
describe,
|
|
82
|
+
handler,
|
|
83
|
+
builder,
|
|
84
|
+
};
|
|
85
|
+
exports.default = hubdbCreateCommand;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const command = "delete [table-id]";
|
|
4
|
-
export declare const describe: string;
|
|
5
|
-
type CombinedArgs = ConfigArgs & AccountArgs & EnvironmentArgs;
|
|
6
|
-
type HubdbDeleteArgs = CommonArgs & CombinedArgs & {
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, YargsCommandModule } from '../../types/Yargs';
|
|
2
|
+
type HubdbDeleteArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & {
|
|
7
3
|
tableId?: number;
|
|
8
4
|
};
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
export {};
|
|
5
|
+
declare const hubdbDeleteCommand: YargsCommandModule<unknown, HubdbDeleteArgs>;
|
|
6
|
+
export default hubdbDeleteCommand;
|
package/commands/hubdb/delete.js
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.describe = exports.command = void 0;
|
|
4
|
-
exports.handler = handler;
|
|
5
|
-
exports.builder = builder;
|
|
6
3
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
7
4
|
const index_1 = require("../../lib/errorHandlers/index");
|
|
8
5
|
const hubdb_1 = require("@hubspot/local-dev-lib/api/hubdb");
|
|
9
6
|
const usageTracking_1 = require("../../lib/usageTracking");
|
|
10
|
-
const commonOpts_1 = require("../../lib/commonOpts");
|
|
11
7
|
const selectHubDBTablePrompt_1 = require("../../lib/prompts/selectHubDBTablePrompt");
|
|
12
8
|
const promptUtils_1 = require("../../lib/prompts/promptUtils");
|
|
13
9
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
14
10
|
const lang_1 = require("../../lib/lang");
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
12
|
+
const command = 'delete [table-id]';
|
|
13
|
+
const describe = (0, lang_1.i18n)('commands.hubdb.subcommands.delete.describe');
|
|
17
14
|
async function handler(args) {
|
|
18
15
|
const { force, derivedAccountId } = args;
|
|
19
16
|
(0, usageTracking_1.trackCommandUsage)('hubdb-delete', {}, derivedAccountId);
|
|
@@ -50,10 +47,7 @@ async function handler(args) {
|
|
|
50
47
|
(0, index_1.logError)(e);
|
|
51
48
|
}
|
|
52
49
|
}
|
|
53
|
-
function
|
|
54
|
-
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
55
|
-
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
56
|
-
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
50
|
+
function hubdbDeleteBuilder(yargs) {
|
|
57
51
|
yargs.positional('table-id', {
|
|
58
52
|
describe: (0, lang_1.i18n)('commands.hubdb.subcommands.delete.positionals.tableId.describe'),
|
|
59
53
|
type: 'string',
|
|
@@ -64,3 +58,16 @@ function builder(yargs) {
|
|
|
64
58
|
});
|
|
65
59
|
return yargs;
|
|
66
60
|
}
|
|
61
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(hubdbDeleteBuilder, command, describe, {
|
|
62
|
+
useGlobalOptions: true,
|
|
63
|
+
useConfigOptions: true,
|
|
64
|
+
useAccountOptions: true,
|
|
65
|
+
useEnvironmentOptions: true,
|
|
66
|
+
});
|
|
67
|
+
const hubdbDeleteCommand = {
|
|
68
|
+
command,
|
|
69
|
+
describe,
|
|
70
|
+
handler,
|
|
71
|
+
builder,
|
|
72
|
+
};
|
|
73
|
+
exports.default = hubdbDeleteCommand;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const command = "fetch [table-id] [dest]";
|
|
4
|
-
export declare const describe: string;
|
|
5
|
-
type CombinedArgs = ConfigArgs & AccountArgs & EnvironmentArgs;
|
|
6
|
-
type HubdbFetchArgs = CommonArgs & CombinedArgs & {
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, YargsCommandModule } from '../../types/Yargs';
|
|
2
|
+
type HubdbFetchArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & {
|
|
7
3
|
tableId?: number;
|
|
8
4
|
dest?: string;
|
|
9
5
|
};
|
|
10
|
-
|
|
11
|
-
export
|
|
12
|
-
export {};
|
|
6
|
+
declare const hubdbFetchCommand: YargsCommandModule<unknown, HubdbFetchArgs>;
|
|
7
|
+
export default hubdbFetchCommand;
|
package/commands/hubdb/fetch.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.describe = exports.command = void 0;
|
|
4
|
-
exports.handler = handler;
|
|
5
|
-
exports.builder = builder;
|
|
6
3
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
7
4
|
const index_1 = require("../../lib/errorHandlers/index");
|
|
8
5
|
const hubdb_1 = require("@hubspot/local-dev-lib/hubdb");
|
|
9
6
|
const selectHubDBTablePrompt_1 = require("../../lib/prompts/selectHubDBTablePrompt");
|
|
10
7
|
const usageTracking_1 = require("../../lib/usageTracking");
|
|
11
|
-
const commonOpts_1 = require("../../lib/commonOpts");
|
|
12
8
|
const lang_1 = require("../../lib/lang");
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
10
|
+
const command = 'fetch [table-id] [dest]';
|
|
11
|
+
const describe = (0, lang_1.i18n)('commands.hubdb.subcommands.fetch.describe');
|
|
15
12
|
async function handler(args) {
|
|
16
13
|
const { derivedAccountId } = args;
|
|
17
14
|
(0, usageTracking_1.trackCommandUsage)('hubdb-fetch', {}, derivedAccountId);
|
|
@@ -33,10 +30,7 @@ async function handler(args) {
|
|
|
33
30
|
(0, index_1.logError)(e);
|
|
34
31
|
}
|
|
35
32
|
}
|
|
36
|
-
function
|
|
37
|
-
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
38
|
-
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
39
|
-
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
33
|
+
function hubdbFetchBuilder(yargs) {
|
|
40
34
|
yargs.positional('table-id', {
|
|
41
35
|
describe: (0, lang_1.i18n)('commands.hubdb.subcommands.fetch.positionals.tableId.describe'),
|
|
42
36
|
type: 'string',
|
|
@@ -47,3 +41,16 @@ function builder(yargs) {
|
|
|
47
41
|
});
|
|
48
42
|
return yargs;
|
|
49
43
|
}
|
|
44
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(hubdbFetchBuilder, command, describe, {
|
|
45
|
+
useGlobalOptions: true,
|
|
46
|
+
useConfigOptions: true,
|
|
47
|
+
useAccountOptions: true,
|
|
48
|
+
useEnvironmentOptions: true,
|
|
49
|
+
});
|
|
50
|
+
const hubdbFetchCommand = {
|
|
51
|
+
command,
|
|
52
|
+
describe,
|
|
53
|
+
handler,
|
|
54
|
+
builder,
|
|
55
|
+
};
|
|
56
|
+
exports.default = hubdbFetchCommand;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, YargsCommandModule } from '../../types/Yargs';
|
|
2
|
+
type HubdbListArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs;
|
|
3
|
+
declare const hubdbListCommand: YargsCommandModule<unknown, HubdbListArgs>;
|
|
4
|
+
export default hubdbListCommand;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const hubdb_1 = require("@hubspot/local-dev-lib/api/hubdb");
|
|
4
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
5
|
+
const urls_1 = require("@hubspot/local-dev-lib/urls");
|
|
6
|
+
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
7
|
+
const logger_1 = require("../../lib/ui/logger");
|
|
8
|
+
const index_1 = require("../../lib/errorHandlers/index");
|
|
9
|
+
const en_1 = require("../../lang/en");
|
|
10
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
11
|
+
const usageTracking_1 = require("../../lib/usageTracking");
|
|
12
|
+
const table_1 = require("../../lib/ui/table");
|
|
13
|
+
const command = ['list', 'ls'];
|
|
14
|
+
const describe = en_1.commands.hubdb.subcommands.list.describe;
|
|
15
|
+
async function getTableData(accountId) {
|
|
16
|
+
try {
|
|
17
|
+
const response = await (0, hubdb_1.fetchTables)(accountId);
|
|
18
|
+
return response.data;
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
(0, index_1.logError)(err);
|
|
22
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
// stripping the types and unnecessary fields so this data can be turned into a UI table
|
|
26
|
+
function mapTablesToUI(tables) {
|
|
27
|
+
return tables.map(({ id, label, name, columnCount, rowCount }) => [
|
|
28
|
+
`${id}`,
|
|
29
|
+
label,
|
|
30
|
+
name,
|
|
31
|
+
`${columnCount || 0}`,
|
|
32
|
+
`${rowCount}`,
|
|
33
|
+
]);
|
|
34
|
+
}
|
|
35
|
+
async function handler(args) {
|
|
36
|
+
const { derivedAccountId } = args;
|
|
37
|
+
(0, usageTracking_1.trackCommandUsage)('hubdb-list', {}, derivedAccountId);
|
|
38
|
+
const { results: tables, total } = await getTableData(derivedAccountId);
|
|
39
|
+
const tableUIData = mapTablesToUI(tables);
|
|
40
|
+
tableUIData.unshift((0, table_1.getTableHeader)([
|
|
41
|
+
en_1.commands.hubdb.subcommands.list.labels.id,
|
|
42
|
+
en_1.commands.hubdb.subcommands.list.labels.label,
|
|
43
|
+
en_1.commands.hubdb.subcommands.list.labels.name,
|
|
44
|
+
en_1.commands.hubdb.subcommands.list.labels.columns,
|
|
45
|
+
en_1.commands.hubdb.subcommands.list.labels.rows,
|
|
46
|
+
]));
|
|
47
|
+
logger_1.uiLogger.success(en_1.commands.hubdb.subcommands.list.success(derivedAccountId));
|
|
48
|
+
logger_1.uiLogger.log(' ');
|
|
49
|
+
// link devs to the hubdb page in hubspot for easy access
|
|
50
|
+
// TODO: This is hacky, we should make a util like getBaseUrl()
|
|
51
|
+
const baseUrl = (0, urls_1.getHubSpotWebsiteOrigin)((0, config_1.getEnv)());
|
|
52
|
+
logger_1.uiLogger.log(en_1.commands.hubdb.subcommands.list.viewTablesLink(baseUrl, derivedAccountId));
|
|
53
|
+
// don't bother showing an empty list of tables
|
|
54
|
+
if (tables.length > 0) {
|
|
55
|
+
// if truncated is 0, it will be interpreted as falsy
|
|
56
|
+
const truncated = total - tables.length;
|
|
57
|
+
logger_1.uiLogger.log(en_1.commands.hubdb.subcommands.list.tablesDisplayed(tables.length, total, truncated));
|
|
58
|
+
logger_1.uiLogger.log('--------------------------------');
|
|
59
|
+
logger_1.uiLogger.log(en_1.commands.hubdb.subcommands.list.tables);
|
|
60
|
+
logger_1.uiLogger.log((0, table_1.getTableContents)(tableUIData, { border: { bodyLeft: ' ' } }));
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
logger_1.uiLogger.log(en_1.commands.hubdb.subcommands.list.noTables(derivedAccountId));
|
|
64
|
+
}
|
|
65
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
66
|
+
}
|
|
67
|
+
function hubdbListBuilder(yargs) {
|
|
68
|
+
yargs.example([['$0 hubdb list']]);
|
|
69
|
+
return yargs;
|
|
70
|
+
}
|
|
71
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(hubdbListBuilder, command, describe, {
|
|
72
|
+
useGlobalOptions: true,
|
|
73
|
+
useConfigOptions: true,
|
|
74
|
+
useAccountOptions: true,
|
|
75
|
+
useEnvironmentOptions: true,
|
|
76
|
+
});
|
|
77
|
+
const hubdbListCommand = {
|
|
78
|
+
command,
|
|
79
|
+
describe,
|
|
80
|
+
handler,
|
|
81
|
+
builder,
|
|
82
|
+
};
|
|
83
|
+
exports.default = hubdbListCommand;
|
package/commands/hubdb.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { YargsCommandModuleBucket } from '../types/Yargs';
|
|
2
2
|
export declare const command = "hubdb";
|
|
3
3
|
export declare const describe: string;
|
|
4
|
-
|
|
4
|
+
declare const hubdbCommand: YargsCommandModuleBucket;
|
|
5
|
+
export default hubdbCommand;
|