@hubspot/cli 7.1.0-beta.0 → 7.1.0-experimental.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.
Files changed (139) hide show
  1. package/commands/account/clean.d.ts +9 -0
  2. package/commands/account/clean.js +51 -45
  3. package/commands/account/list.d.ts +7 -0
  4. package/commands/account/list.js +69 -60
  5. package/commands/account/remove.d.ts +9 -0
  6. package/commands/account/remove.js +33 -31
  7. package/commands/account/rename.d.ts +10 -0
  8. package/commands/account/rename.js +36 -23
  9. package/commands/account/use.d.ts +9 -0
  10. package/commands/account/use.js +26 -24
  11. package/commands/account.d.ts +4 -1
  12. package/commands/account.js +47 -13
  13. package/commands/create/api-sample.js +14 -4
  14. package/commands/customObject/create.d.ts +11 -0
  15. package/commands/customObject/create.js +37 -28
  16. package/commands/customObject/schema/create.d.ts +10 -0
  17. package/commands/customObject/schema/create.js +40 -42
  18. package/commands/customObject/schema/delete.d.ts +11 -0
  19. package/commands/customObject/schema/delete.js +34 -27
  20. package/commands/customObject/schema/fetch-all.d.ts +10 -0
  21. package/commands/customObject/schema/fetch-all.js +31 -24
  22. package/commands/customObject/schema/fetch.d.ts +11 -0
  23. package/commands/customObject/schema/fetch.js +34 -42
  24. package/commands/customObject/schema/list.d.ts +7 -0
  25. package/commands/customObject/schema/list.js +23 -14
  26. package/commands/customObject/schema/update.d.ts +11 -0
  27. package/commands/customObject/schema/update.js +44 -46
  28. package/commands/customObject/schema.d.ts +5 -1
  29. package/commands/customObject/schema.js +49 -11
  30. package/commands/customObject.d.ts +4 -1
  31. package/commands/customObject.js +54 -21
  32. package/commands/filemanager/fetch.d.ts +12 -0
  33. package/commands/filemanager/fetch.js +33 -30
  34. package/commands/filemanager/upload.d.ts +11 -0
  35. package/commands/filemanager/upload.js +53 -47
  36. package/commands/filemanager.d.ts +4 -1
  37. package/commands/filemanager.js +41 -7
  38. package/commands/hubdb/clear.d.ts +11 -0
  39. package/commands/hubdb/clear.js +33 -30
  40. package/commands/hubdb/create.d.ts +10 -0
  41. package/commands/hubdb/create.js +46 -40
  42. package/commands/hubdb/delete.d.ts +10 -0
  43. package/commands/hubdb/delete.js +38 -35
  44. package/commands/hubdb/fetch.d.ts +11 -0
  45. package/commands/hubdb/fetch.js +30 -27
  46. package/commands/hubdb.d.ts +4 -1
  47. package/commands/hubdb.js +45 -11
  48. package/commands/init.js +2 -1
  49. package/commands/project/add.js +62 -16
  50. package/commands/project/cloneApp.js +3 -3
  51. package/commands/project/create.js +70 -15
  52. package/commands/project/dev/deprecatedFlow.d.ts +5 -0
  53. package/commands/project/dev/deprecatedFlow.js +137 -0
  54. package/commands/project/dev/index.d.ts +6 -0
  55. package/commands/project/dev/index.js +52 -0
  56. package/commands/project/dev/unifiedFlow.d.ts +5 -0
  57. package/commands/project/dev/unifiedFlow.js +110 -0
  58. package/commands/project/migrateApp.js +3 -3
  59. package/commands/project/upload.js +7 -2
  60. package/commands/sandbox/create.d.ts +12 -0
  61. package/commands/sandbox/create.js +90 -72
  62. package/commands/sandbox/delete.d.ts +11 -0
  63. package/commands/sandbox/delete.js +112 -95
  64. package/commands/sandbox.d.ts +4 -1
  65. package/commands/sandbox.js +44 -10
  66. package/commands/secret/addSecret.d.ts +10 -0
  67. package/commands/secret/addSecret.js +32 -31
  68. package/commands/secret/deleteSecret.d.ts +11 -0
  69. package/commands/secret/deleteSecret.js +31 -29
  70. package/commands/secret/listSecret.d.ts +9 -0
  71. package/commands/secret/listSecret.js +41 -0
  72. package/commands/secret/updateSecret.d.ts +10 -0
  73. package/commands/secret/updateSecret.js +33 -31
  74. package/commands/secret.d.ts +4 -1
  75. package/commands/secret.js +46 -12
  76. package/commands/theme/generate-selectors.d.ts +9 -0
  77. package/commands/theme/generate-selectors.js +61 -43
  78. package/commands/theme/marketplace-validate.d.ts +10 -0
  79. package/commands/theme/marketplace-validate.js +32 -26
  80. package/commands/theme/preview.d.ts +16 -0
  81. package/commands/theme/preview.js +104 -97
  82. package/commands/theme.d.ts +4 -1
  83. package/commands/theme.js +44 -10
  84. package/lang/en.lyaml +36 -16
  85. package/lib/DevServerManagerV2.d.ts +34 -0
  86. package/lib/DevServerManagerV2.js +85 -0
  87. package/lib/LocalDevManager.d.ts +2 -2
  88. package/lib/LocalDevManagerV2.d.ts +64 -0
  89. package/lib/LocalDevManagerV2.js +382 -0
  90. package/lib/buildAccount.d.ts +2 -3
  91. package/lib/constants.d.ts +12 -3
  92. package/lib/constants.js +13 -4
  93. package/lib/customObject.d.ts +3 -0
  94. package/lib/customObject.js +15 -0
  95. package/lib/doctor/DiagnosticInfoBuilder.d.ts +6 -0
  96. package/lib/doctor/DiagnosticInfoBuilder.js +5 -0
  97. package/lib/doctor/Doctor.d.ts +1 -0
  98. package/lib/doctor/Doctor.js +10 -0
  99. package/lib/localDev.d.ts +2 -1
  100. package/lib/marketplaceValidate.d.ts +2 -2
  101. package/lib/process.d.ts +1 -0
  102. package/lib/process.js +11 -10
  103. package/lib/projects/buildAndDeploy.js +4 -1
  104. package/lib/projects/create.d.ts +5 -0
  105. package/lib/projects/create.js +51 -0
  106. package/lib/projects/index.d.ts +1 -5
  107. package/lib/projects/index.js +1 -62
  108. package/lib/projects/structure.d.ts +4 -0
  109. package/lib/projects/structure.js +9 -0
  110. package/lib/projects/upload.d.ts +1 -1
  111. package/lib/projects/upload.js +2 -2
  112. package/lib/prompts/createProjectPrompt.d.ts +6 -8
  113. package/lib/prompts/createProjectPrompt.js +26 -54
  114. package/lib/prompts/projectAddPrompt.d.ts +3 -3
  115. package/lib/prompts/projectAddPrompt.js +16 -6
  116. package/lib/prompts/projectDevTargetAccountPrompt.d.ts +3 -2
  117. package/lib/prompts/sandboxesPrompt.d.ts +3 -2
  118. package/lib/prompts/sandboxesPrompt.js +1 -1
  119. package/lib/sandboxSync.js +6 -2
  120. package/lib/sandboxes.d.ts +3 -5
  121. package/lib/sandboxes.js +1 -0
  122. package/lib/testUtils.d.ts +12 -0
  123. package/lib/testUtils.js +10 -0
  124. package/lib/ui/index.d.ts +2 -2
  125. package/lib/ui/index.js +1 -0
  126. package/lib/upload.d.ts +1 -1
  127. package/lib/upload.js +20 -20
  128. package/lib/validation.d.ts +1 -1
  129. package/package.json +6 -5
  130. package/types/ProjectComponents.d.ts +38 -0
  131. package/types/ProjectComponents.js +3 -0
  132. package/types/Projects.d.ts +1 -6
  133. package/types/Prompts.d.ts +7 -0
  134. package/types/Sandboxes.d.ts +2 -0
  135. package/types/Yargs.d.ts +15 -0
  136. package/commands/project/dev.d.ts +0 -1
  137. package/commands/project/dev.js +0 -146
  138. package/commands/secret/listSecrets.d.ts +0 -1
  139. package/commands/secret/listSecrets.js +0 -39
package/lib/upload.js CHANGED
@@ -1,46 +1,49 @@
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
- // @ts-nocheck
4
- const path = require('path');
5
- const { walk } = require('@hubspot/local-dev-lib/fs');
6
- const { createIgnoreFilter } = require('@hubspot/local-dev-lib/ignoreRules');
7
- const { fieldsJsPrompt } = require('./prompts/cmsFieldPrompt');
8
- const { isAllowedExtension } = require('@hubspot/local-dev-lib/path');
9
- const { isConvertableFieldJs, } = require('@hubspot/local-dev-lib/cms/handleFieldsJS');
10
- const { logError } = require('./errorHandlers/index');
6
+ exports.getUploadableFileList = getUploadableFileList;
7
+ const path_1 = __importDefault(require("path"));
8
+ const fs_1 = require("@hubspot/local-dev-lib/fs");
9
+ const ignoreRules_1 = require("@hubspot/local-dev-lib/ignoreRules");
10
+ const handleFieldsJS_1 = require("@hubspot/local-dev-lib/cms/handleFieldsJS");
11
+ const path_2 = require("@hubspot/local-dev-lib/path");
12
+ const cmsFieldPrompt_1 = require("./prompts/cmsFieldPrompt");
13
+ const index_1 = require("./errorHandlers/index");
11
14
  /*
12
15
  * Walks the src folder for files, filters them based on ignore filter.
13
16
  * If convertFields is true then will check for any JS fields conflicts (i.e., JS fields file and fields.json file) and prompt to resolve
14
17
  */
15
- const getUploadableFileList = async (src, convertFields) => {
18
+ async function getUploadableFileList(src, convertFields) {
16
19
  let filePaths = [];
17
20
  try {
18
- filePaths = await walk(src);
21
+ filePaths = await (0, fs_1.walk)(src);
19
22
  }
20
23
  catch (e) {
21
- logError(e);
24
+ (0, index_1.logError)(e);
22
25
  }
23
26
  const allowedFiles = filePaths
24
27
  .filter(file => {
25
- if (!isAllowedExtension(file)) {
28
+ if (!(0, path_2.isAllowedExtension)(file)) {
26
29
  return false;
27
30
  }
28
31
  return true;
29
32
  })
30
- .filter(createIgnoreFilter());
33
+ .filter((0, ignoreRules_1.createIgnoreFilter)(false));
31
34
  if (!convertFields) {
32
35
  return allowedFiles;
33
36
  }
34
37
  const uploadableFiles = [];
35
38
  let skipFiles = [];
36
39
  for (const filePath of allowedFiles) {
37
- const fileName = path.basename(filePath);
40
+ const fileName = path_1.default.basename(filePath);
38
41
  if (skipFiles.includes(filePath))
39
42
  continue;
40
- const isConvertable = isConvertableFieldJs(src, filePath, convertFields);
43
+ const isConvertable = (0, handleFieldsJS_1.isConvertableFieldJs)(src, filePath, convertFields);
41
44
  if (isConvertable || fileName == 'fields.json') {
42
45
  // This prompt checks if there are multiple field files in the folder and gets user to choose.
43
- const [choice, updatedSkipFiles] = await fieldsJsPrompt(filePath, src, skipFiles);
46
+ const [choice, updatedSkipFiles] = await (0, cmsFieldPrompt_1.fieldsJsPrompt)(filePath, src, skipFiles);
44
47
  skipFiles = updatedSkipFiles;
45
48
  // If they chose something other than the current file, move on.
46
49
  if (choice !== filePath)
@@ -49,7 +52,4 @@ const getUploadableFileList = async (src, convertFields) => {
49
52
  uploadableFiles.push(filePath);
50
53
  }
51
54
  return uploadableFiles;
52
- };
53
- module.exports = {
54
- getUploadableFileList,
55
- };
55
+ }
@@ -10,4 +10,4 @@ export declare function validateCmsPublishMode(options: Arguments<{
10
10
  cmsPublishMode?: CmsPublishMode;
11
11
  }>): boolean;
12
12
  export declare function fileExists(_path: string): boolean;
13
- export declare function checkAndConvertToJson(_path: string): object | null;
13
+ export declare function checkAndConvertToJson(_path: string): unknown | null;
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "7.1.0-beta.0",
3
+ "version": "7.1.0-experimental.0",
4
4
  "description": "The official CLI for developing on HubSpot",
5
5
  "license": "Apache-2.0",
6
6
  "repository": "https://github.com/HubSpot/hubspot-cli",
7
7
  "dependencies": {
8
- "@hubspot/local-dev-lib": "3.3.0",
9
- "@hubspot/project-parsing-lib": "0.0.4",
8
+ "@hubspot/local-dev-lib": "3.3.2",
9
+ "@hubspot/project-parsing-lib": "0.0.9",
10
10
  "@hubspot/serverless-dev-runtime": "7.0.2",
11
11
  "@hubspot/theme-preview-dev-server": "0.0.10",
12
- "@hubspot/ui-extensions-dev-server": "0.8.42",
12
+ "@hubspot/ui-extensions-dev-server": "^0.8.46",
13
13
  "archiver": "7.0.1",
14
14
  "chalk": "4.1.2",
15
15
  "chokidar": "3.6.0",
@@ -32,6 +32,7 @@
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/archiver": "^6.0.3",
35
+ "@types/cli-progress": "^3.11.6",
35
36
  "@types/express": "^5.0.0",
36
37
  "@types/findup-sync": "^4.0.5",
37
38
  "@types/fs-extra": "^11.0.4",
@@ -64,7 +65,7 @@
64
65
  "lint": "eslint . && prettier --list-different ./**/*.{js,json}",
65
66
  "list-all-commands": "yarn ts-node ./scripts/get-all-commands.ts",
66
67
  "prettier:write": "prettier --write ./**/*.{ts,js,json}",
67
- "test": "jest",
68
+ "test": "yarn node --experimental-vm-modules $(yarn bin jest)",
68
69
  "test-cli": "yarn build && yarn --cwd 'acceptance-tests' test-ci",
69
70
  "test-cli-debug": "yarn build && yarn --cwd 'acceptance-tests' test-debug",
70
71
  "test-cli-qa": "yarn build && yarn --cwd 'acceptance-tests' test-qa",
@@ -0,0 +1,38 @@
1
+ import { IntermediateRepresentationNodeLocalDev } from '@hubspot/project-parsing-lib/src/lib/types';
2
+ import { IR_COMPONENT_TYPES, APP_DISTRIBUTION_TYPES, APP_AUTH_TYPES } from '../lib/constants';
3
+ import { ValueOf } from '@hubspot/local-dev-lib/types/Utils';
4
+ type AppDistributionType = ValueOf<typeof APP_DISTRIBUTION_TYPES>;
5
+ type AppAuthType = ValueOf<typeof APP_AUTH_TYPES>;
6
+ type AppConfig = {
7
+ description: string;
8
+ name: string;
9
+ logo: string;
10
+ distribution: AppDistributionType;
11
+ auth: {
12
+ type: AppAuthType;
13
+ redirectUrls: string[];
14
+ requiredScopes: string[];
15
+ optionalScopes: string[];
16
+ conditionallyRequiredScopes: string[];
17
+ };
18
+ };
19
+ type CardConfig = {
20
+ name: string;
21
+ description: string;
22
+ previewImage: {
23
+ file: string;
24
+ altText: string;
25
+ };
26
+ entrypoint: string;
27
+ location: string;
28
+ objectTypes: string[];
29
+ };
30
+ export interface AppIRNode extends IntermediateRepresentationNodeLocalDev {
31
+ componentType: typeof IR_COMPONENT_TYPES.APPLICATION;
32
+ config: AppConfig;
33
+ }
34
+ export interface CardIRNode extends IntermediateRepresentationNodeLocalDev {
35
+ componentType: typeof IR_COMPONENT_TYPES.CARD;
36
+ config: CardConfig;
37
+ }
38
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // These types are for Unified Apps and projects on platform version 2025.1 and above
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -7,8 +7,8 @@ export type ProjectTemplate = {
7
7
  insertPath: string;
8
8
  };
9
9
  export type ComponentTemplate = {
10
- label: string;
11
10
  path: string;
11
+ label: string;
12
12
  insertPath: string;
13
13
  };
14
14
  export type ProjectConfig = {
@@ -32,11 +32,6 @@ export type ProjectPollStatusFunctionText = {
32
32
  TYPE_KEY: string;
33
33
  SUBTASK_NAME_KEY: string;
34
34
  };
35
- export type ProjectAddComponentData = {
36
- path: string;
37
- label: string;
38
- insertPath: string;
39
- };
40
35
  export type ProjectTemplateRepoConfig = {
41
36
  projects?: ProjectTemplate[];
42
37
  components?: ComponentTemplate[];
@@ -1,3 +1,4 @@
1
+ import { DeveloperTestAccount } from '@hubspot/local-dev-lib/types/developerTestAccounts';
1
2
  export type GenericPromptResponse = {
2
3
  [key: string]: any;
3
4
  };
@@ -22,4 +23,10 @@ export type PromptConfig<T extends GenericPromptResponse> = {
22
23
  mask?: string;
23
24
  filter?: (input: string) => string;
24
25
  };
26
+ export type ProjectDevTargetAccountPromptResponse = {
27
+ targetAccountId: number | null;
28
+ createNestedAccount: boolean;
29
+ parentAccountId?: number | null;
30
+ notInConfigAccount?: DeveloperTestAccount | null;
31
+ };
25
32
  export {};
@@ -1,3 +1,5 @@
1
+ import { HUBSPOT_ACCOUNT_TYPES } from '@hubspot/local-dev-lib/constants/config';
1
2
  export type SandboxSyncTask = {
2
3
  type: string;
3
4
  };
5
+ export type SandboxAccountType = typeof HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX | typeof HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX;
package/types/Yargs.d.ts CHANGED
@@ -9,6 +9,21 @@ export type ConfigArgs = {
9
9
  c?: string;
10
10
  config?: string;
11
11
  };
12
+ export type AccountArgs = {
13
+ a?: string;
14
+ account?: string;
15
+ };
16
+ export type EnvironmentArgs = {
17
+ 'use-env'?: string;
18
+ };
19
+ export type OverwriteArgs = Options & {
20
+ o?: boolean;
21
+ overwrite?: boolean;
22
+ };
12
23
  export type StringArgType = Options & {
13
24
  type: 'string';
14
25
  };
26
+ export type ProjectDevArgs = CommonArgs & ConfigArgs & EnvironmentArgs;
27
+ export type TestingArgs = {
28
+ qa?: boolean;
29
+ };
@@ -1 +0,0 @@
1
- export {};
@@ -1,146 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- // @ts-nocheck
4
- const { addAccountOptions, addConfigOptions, addUseEnvironmentOptions, addTestingOptions, } = require('../../lib/commonOpts');
5
- const { trackCommandUsage } = require('../../lib/usageTracking');
6
- const { handleExit } = require('../../lib/process');
7
- const { i18n } = require('../../lib/lang');
8
- const { logger } = require('@hubspot/local-dev-lib/logger');
9
- const { getConfigAccounts, getAccountConfig, getEnv, } = require('@hubspot/local-dev-lib/config');
10
- const { getProjectConfig, ensureProjectExists, validateProjectConfig, } = require('../../lib/projects');
11
- const { EXIT_CODES } = require('../../lib/enums/exitCodes');
12
- const { uiBetaTag, uiCommandReference, uiLink } = require('../../lib/ui');
13
- const SpinniesManager = require('../../lib/ui/SpinniesManager');
14
- const LocalDevManager = require('../../lib/LocalDevManager');
15
- const { isSandbox, isDeveloperTestAccount, isStandardAccount, isAppDeveloperAccount, } = require('../../lib/accountTypes');
16
- const { getValidEnv } = require('@hubspot/local-dev-lib/environment');
17
- const { ComponentTypes } = require('../../types/Projects');
18
- const { findProjectComponents, getProjectComponentTypes, } = require('../../lib/projects/structure');
19
- const { confirmDefaultAccountIsTarget, suggestRecommendedNestedAccount, checkIfDefaultAccountIsSupported, createSandboxForLocalDev, createDeveloperTestAccountForLocalDev, createNewProjectForLocalDev, createInitialBuildForNewProject, useExistingDevTestAccount, checkIfAccountFlagIsSupported, checkIfParentAccountIsAuthed, } = require('../../lib/localDev');
20
- const i18nKey = 'commands.project.subcommands.dev';
21
- exports.command = 'dev';
22
- exports.describe = uiBetaTag(i18n(`${i18nKey}.describe`), false);
23
- exports.handler = async (options) => {
24
- const { derivedAccountId, providedAccountId } = options;
25
- const accountConfig = getAccountConfig(derivedAccountId);
26
- const env = getValidEnv(getEnv(derivedAccountId));
27
- trackCommandUsage('project-dev', null, derivedAccountId);
28
- const { projectConfig, projectDir } = await getProjectConfig();
29
- uiBetaTag(i18n(`${i18nKey}.logs.betaMessage`));
30
- logger.log(uiLink(i18n(`${i18nKey}.logs.learnMoreLocalDevServer`), 'https://developers.hubspot.com/docs/platform/project-cli-commands#start-a-local-development-server'));
31
- if (!projectConfig) {
32
- logger.error(i18n(`${i18nKey}.errors.noProjectConfig`));
33
- process.exit(EXIT_CODES.ERROR);
34
- }
35
- validateProjectConfig(projectConfig, projectDir);
36
- const components = await findProjectComponents(projectDir);
37
- const runnableComponents = components.filter(component => component.runnable);
38
- const componentTypes = getProjectComponentTypes(runnableComponents);
39
- const hasPrivateApps = !!componentTypes[ComponentTypes.PrivateApp];
40
- const hasPublicApps = !!componentTypes[ComponentTypes.PublicApp];
41
- if (runnableComponents.length === 0) {
42
- logger.error(i18n(`${i18nKey}.errors.noRunnableComponents`, {
43
- projectDir,
44
- command: uiCommandReference('hs project add'),
45
- }));
46
- process.exit(EXIT_CODES.SUCCESS);
47
- }
48
- else if (hasPrivateApps && hasPublicApps) {
49
- logger.error(i18n(`${i18nKey}.errors.invalidProjectComponents`));
50
- process.exit(EXIT_CODES.SUCCESS);
51
- }
52
- const accounts = getConfigAccounts();
53
- const defaultAccountIsRecommendedType = isDeveloperTestAccount(accountConfig) ||
54
- (!hasPublicApps && isSandbox(accountConfig));
55
- // targetProjectAccountId and targetTestingAccountId are set to null if --account flag is not provided.
56
- // By setting them to null, we can later check if they need to be assigned based on the default account configuration and the type of app.
57
- let targetProjectAccountId = providedAccountId ? derivedAccountId : null;
58
- // The account that we are locally testing against
59
- let targetTestingAccountId = providedAccountId ? derivedAccountId : null;
60
- // Check that the default account or flag option is valid for the type of app in this project
61
- if (providedAccountId) {
62
- checkIfAccountFlagIsSupported(accountConfig, hasPublicApps);
63
- if (hasPublicApps) {
64
- targetProjectAccountId = accountConfig.parentAccountId;
65
- }
66
- }
67
- else {
68
- checkIfDefaultAccountIsSupported(accountConfig, hasPublicApps);
69
- }
70
- // The user is targeting an account type that we recommend developing on
71
- if (!targetProjectAccountId && defaultAccountIsRecommendedType) {
72
- targetTestingAccountId = derivedAccountId;
73
- await confirmDefaultAccountIsTarget(accountConfig, hasPublicApps);
74
- if (hasPublicApps) {
75
- checkIfParentAccountIsAuthed(accountConfig);
76
- targetProjectAccountId = accountConfig.parentAccountId;
77
- }
78
- else {
79
- targetProjectAccountId = derivedAccountId;
80
- }
81
- }
82
- let createNewSandbox = false;
83
- let createNewDeveloperTestAccount = false;
84
- if (!targetProjectAccountId) {
85
- const { targetAccountId, parentAccountId, createNestedAccount, notInConfigAccount, } = await suggestRecommendedNestedAccount(accounts, accountConfig, hasPublicApps);
86
- targetProjectAccountId = hasPublicApps ? parentAccountId : targetAccountId;
87
- targetTestingAccountId = targetAccountId;
88
- // Only used for developer test accounts that are not yet in the config
89
- if (notInConfigAccount) {
90
- await useExistingDevTestAccount(env, notInConfigAccount);
91
- }
92
- createNewSandbox = isStandardAccount(accountConfig) && createNestedAccount;
93
- createNewDeveloperTestAccount =
94
- isAppDeveloperAccount(accountConfig) && createNestedAccount;
95
- }
96
- if (createNewSandbox) {
97
- targetProjectAccountId = await createSandboxForLocalDev(derivedAccountId, accountConfig, env);
98
- // We will be running our tests against this new sandbox account
99
- targetTestingAccountId = targetProjectAccountId;
100
- }
101
- if (createNewDeveloperTestAccount) {
102
- targetTestingAccountId = await createDeveloperTestAccountForLocalDev(derivedAccountId, accountConfig, env);
103
- targetProjectAccountId = derivedAccountId;
104
- }
105
- // eslint-disable-next-line prefer-const
106
- let { projectExists, project } = await ensureProjectExists(targetProjectAccountId, projectConfig.name, {
107
- allowCreate: false,
108
- noLogs: true,
109
- withPolling: createNewSandbox,
110
- });
111
- let deployedBuild;
112
- let isGithubLinked;
113
- SpinniesManager.init();
114
- if (projectExists) {
115
- deployedBuild = project.deployedBuild;
116
- isGithubLinked =
117
- project.sourceIntegration &&
118
- project.sourceIntegration.source === 'GITHUB';
119
- }
120
- else {
121
- project = await createNewProjectForLocalDev(projectConfig, targetProjectAccountId, createNewSandbox, hasPublicApps);
122
- deployedBuild = await createInitialBuildForNewProject(projectConfig, projectDir, targetProjectAccountId);
123
- }
124
- const LocalDev = new LocalDevManager({
125
- runnableComponents,
126
- debug: options.debug,
127
- deployedBuild,
128
- isGithubLinked,
129
- parentAccountId: targetProjectAccountId,
130
- projectConfig,
131
- projectDir,
132
- projectId: project.id,
133
- targetAccountId: targetTestingAccountId,
134
- env,
135
- });
136
- await LocalDev.start();
137
- handleExit(({ isSIGHUP }) => LocalDev.stop(!isSIGHUP));
138
- };
139
- exports.builder = yargs => {
140
- addConfigOptions(yargs);
141
- addAccountOptions(yargs);
142
- addUseEnvironmentOptions(yargs);
143
- addTestingOptions(yargs);
144
- yargs.example([['$0 project dev', i18n(`${i18nKey}.examples.default`)]]);
145
- return yargs;
146
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- // @ts-nocheck
4
- const { logger } = require('@hubspot/local-dev-lib/logger');
5
- const { logError, ApiErrorContext } = require('../../lib/errorHandlers/index');
6
- const { fetchSecrets } = require('@hubspot/local-dev-lib/api/secrets');
7
- const { trackCommandUsage } = require('../../lib/usageTracking');
8
- const { uiAccountDescription } = require('../../lib/ui');
9
- const { addConfigOptions, addAccountOptions, addUseEnvironmentOptions, } = require('../../lib/commonOpts');
10
- const { i18n } = require('../../lib/lang');
11
- const i18nKey = 'commands.secret.subcommands.list';
12
- exports.command = 'list';
13
- exports.describe = i18n(`${i18nKey}.describe`);
14
- exports.handler = async (options) => {
15
- const { derivedAccountId } = options;
16
- trackCommandUsage('secrets-list', null, derivedAccountId);
17
- try {
18
- const { data: { results }, } = await fetchSecrets(derivedAccountId);
19
- const groupLabel = i18n(`${i18nKey}.groupLabel`, {
20
- accountIdentifier: uiAccountDescription(derivedAccountId),
21
- });
22
- logger.group(groupLabel);
23
- results.forEach(secret => logger.log(secret));
24
- logger.groupEnd(groupLabel);
25
- }
26
- catch (err) {
27
- logger.error(i18n(`${i18nKey}.errors.list`));
28
- logError(err, new ApiErrorContext({
29
- request: 'add secret',
30
- accountId: derivedAccountId,
31
- }));
32
- }
33
- };
34
- exports.builder = yargs => {
35
- addConfigOptions(yargs);
36
- addAccountOptions(yargs);
37
- addUseEnvironmentOptions(yargs);
38
- return yargs;
39
- };