@hubspot/cli 7.2.0-experimental.0 → 7.2.2-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 (108) hide show
  1. package/bin/cli.js +52 -3
  2. package/commands/account/auth.d.ts +10 -0
  3. package/commands/account/auth.js +154 -0
  4. package/commands/account/createOverride.d.ts +10 -0
  5. package/commands/account/createOverride.js +62 -0
  6. package/commands/account/list.js +4 -0
  7. package/commands/account.js +4 -0
  8. package/commands/auth.js +9 -5
  9. package/commands/config/migrate.d.ts +10 -0
  10. package/commands/config/migrate.js +86 -0
  11. package/commands/config/set.d.ts +12 -0
  12. package/commands/config/set.js +30 -29
  13. package/commands/config.d.ts +4 -1
  14. package/commands/config.js +45 -10
  15. package/commands/create/api-sample.js +4 -14
  16. package/commands/customObject/create.d.ts +0 -11
  17. package/commands/customObject/create.js +28 -37
  18. package/commands/customObject/schema/create.d.ts +0 -10
  19. package/commands/customObject/schema/create.js +42 -40
  20. package/commands/customObject/schema/delete.d.ts +0 -11
  21. package/commands/customObject/schema/delete.js +27 -34
  22. package/commands/customObject/schema/fetch-all.d.ts +0 -10
  23. package/commands/customObject/schema/fetch-all.js +24 -31
  24. package/commands/customObject/schema/fetch.d.ts +0 -11
  25. package/commands/customObject/schema/fetch.js +42 -34
  26. package/commands/customObject/schema/list.d.ts +0 -7
  27. package/commands/customObject/schema/list.js +14 -23
  28. package/commands/customObject/schema/update.d.ts +0 -11
  29. package/commands/customObject/schema/update.js +46 -44
  30. package/commands/customObject/schema.d.ts +1 -5
  31. package/commands/customObject/schema.js +11 -49
  32. package/commands/customObject.d.ts +1 -4
  33. package/commands/customObject.js +21 -54
  34. package/commands/filemanager/fetch.d.ts +0 -12
  35. package/commands/filemanager/fetch.js +30 -33
  36. package/commands/filemanager/upload.d.ts +0 -11
  37. package/commands/filemanager/upload.js +47 -53
  38. package/commands/filemanager.d.ts +1 -4
  39. package/commands/filemanager.js +7 -41
  40. package/commands/init.js +15 -26
  41. package/commands/project/add.js +16 -62
  42. package/commands/project/cloneApp.js +3 -3
  43. package/commands/project/create.js +15 -70
  44. package/commands/project/dev.d.ts +0 -7
  45. package/commands/project/dev.js +75 -96
  46. package/commands/project/migrateApp.js +3 -3
  47. package/commands/project/upload.js +2 -7
  48. package/commands/sandbox/create.d.ts +0 -12
  49. package/commands/sandbox/create.js +72 -90
  50. package/commands/sandbox/delete.d.ts +0 -11
  51. package/commands/sandbox/delete.js +95 -112
  52. package/commands/sandbox.d.ts +1 -4
  53. package/commands/sandbox.js +10 -44
  54. package/commands/theme/generate-selectors.d.ts +0 -9
  55. package/commands/theme/generate-selectors.js +43 -61
  56. package/commands/theme/marketplace-validate.d.ts +0 -10
  57. package/commands/theme/marketplace-validate.js +26 -32
  58. package/commands/theme/preview.d.ts +0 -16
  59. package/commands/theme/preview.js +97 -104
  60. package/commands/theme.d.ts +1 -4
  61. package/commands/theme.js +10 -44
  62. package/lang/en.lyaml +67 -39
  63. package/lib/LocalDevManager.d.ts +2 -2
  64. package/lib/buildAccount.d.ts +3 -2
  65. package/lib/configMigrate.d.ts +2 -0
  66. package/lib/configMigrate.js +83 -0
  67. package/lib/constants.d.ts +3 -0
  68. package/lib/constants.js +4 -1
  69. package/lib/doctor/Diagnosis.d.ts +1 -0
  70. package/lib/doctor/Diagnosis.js +7 -0
  71. package/lib/doctor/DiagnosticInfoBuilder.d.ts +1 -6
  72. package/lib/doctor/DiagnosticInfoBuilder.js +1 -5
  73. package/lib/doctor/Doctor.d.ts +1 -1
  74. package/lib/doctor/Doctor.js +14 -6
  75. package/lib/localDev.d.ts +1 -2
  76. package/lib/marketplaceValidate.d.ts +2 -2
  77. package/lib/projects/buildAndDeploy.js +1 -4
  78. package/lib/projects/index.d.ts +5 -1
  79. package/lib/projects/index.js +62 -1
  80. package/lib/projects/upload.d.ts +1 -1
  81. package/lib/projects/upload.js +2 -2
  82. package/lib/prompts/accountNamePrompt.d.ts +1 -1
  83. package/lib/prompts/createProjectPrompt.d.ts +8 -6
  84. package/lib/prompts/createProjectPrompt.js +54 -26
  85. package/lib/prompts/projectAddPrompt.d.ts +3 -3
  86. package/lib/prompts/projectAddPrompt.js +6 -16
  87. package/lib/prompts/projectDevTargetAccountPrompt.d.ts +2 -3
  88. package/lib/prompts/sandboxesPrompt.d.ts +2 -3
  89. package/lib/prompts/sandboxesPrompt.js +1 -1
  90. package/lib/sandboxSync.js +2 -6
  91. package/lib/sandboxes.d.ts +5 -2
  92. package/lib/ui/index.d.ts +1 -1
  93. package/lib/ui/index.js +0 -1
  94. package/lib/upload.d.ts +1 -1
  95. package/lib/upload.js +20 -20
  96. package/lib/usageTracking.d.ts +1 -1
  97. package/lib/validation.d.ts +1 -1
  98. package/package.json +3 -4
  99. package/types/Projects.d.ts +6 -1
  100. package/types/Prompts.d.ts +0 -7
  101. package/types/Sandboxes.d.ts +0 -2
  102. package/types/Yargs.d.ts +0 -7
  103. package/lib/customObject.d.ts +0 -3
  104. package/lib/customObject.js +0 -15
  105. package/lib/projects/create.d.ts +0 -5
  106. package/lib/projects/create.js +0 -51
  107. package/lib/testUtils.d.ts +0 -12
  108. package/lib/testUtils.js +0 -10
@@ -6,13 +6,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.writeProjectConfig = writeProjectConfig;
7
7
  exports.getIsInProject = getIsInProject;
8
8
  exports.getProjectConfig = getProjectConfig;
9
+ exports.createProjectConfig = createProjectConfig;
9
10
  exports.validateProjectConfig = validateProjectConfig;
10
11
  exports.ensureProjectExists = ensureProjectExists;
11
12
  exports.logFeedbackMessage = logFeedbackMessage;
13
+ exports.createProjectComponent = createProjectComponent;
14
+ exports.getProjectComponentsByVersion = getProjectComponentsByVersion;
12
15
  const fs_extra_1 = __importDefault(require("fs-extra"));
13
16
  const path_1 = __importDefault(require("path"));
14
17
  const findup_sync_1 = __importDefault(require("findup-sync"));
15
18
  const logger_1 = require("@hubspot/local-dev-lib/logger");
19
+ const github_1 = require("@hubspot/local-dev-lib/github");
16
20
  const projects_1 = require("@hubspot/local-dev-lib/api/projects");
17
21
  const index_1 = require("@hubspot/local-dev-lib/errors/index");
18
22
  const path_2 = require("@hubspot/local-dev-lib/path");
@@ -49,7 +53,7 @@ function getProjectConfigPath(dir) {
49
53
  return configPath;
50
54
  }
51
55
  async function getProjectConfig(dir) {
52
- const configPath = getProjectConfigPath(dir);
56
+ const configPath = await getProjectConfigPath(dir);
53
57
  if (!configPath) {
54
58
  return { projectConfig: null, projectDir: null };
55
59
  }
@@ -66,6 +70,45 @@ async function getProjectConfig(dir) {
66
70
  return { projectConfig: null, projectDir: null };
67
71
  }
68
72
  }
73
+ async function createProjectConfig(projectPath, projectName, template, templateSource, githubRef) {
74
+ const { projectConfig, projectDir } = await getProjectConfig(projectPath);
75
+ if (projectConfig) {
76
+ logger_1.logger.warn(projectPath === projectDir
77
+ ? 'A project already exists in that location.'
78
+ : `Found an existing project definition in ${projectDir}.`);
79
+ const { shouldContinue } = await (0, promptUtils_1.promptUser)([
80
+ {
81
+ name: 'shouldContinue',
82
+ message: () => {
83
+ return projectPath === projectDir
84
+ ? 'Do you want to overwrite the existing project definition with a new one?'
85
+ : `Continue creating a new project in ${projectPath}?`;
86
+ },
87
+ type: 'confirm',
88
+ default: false,
89
+ },
90
+ ]);
91
+ if (!shouldContinue) {
92
+ return false;
93
+ }
94
+ }
95
+ const projectConfigPath = path_1.default.join(projectPath, constants_1.PROJECT_CONFIG_FILE);
96
+ logger_1.logger.log(`Creating project config in ${projectPath ? projectPath : 'the current folder'}`);
97
+ const hasCustomTemplateSource = Boolean(templateSource);
98
+ await (0, github_1.cloneGithubRepo)(templateSource || constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, projectPath, {
99
+ sourceDir: template.path,
100
+ tag: hasCustomTemplateSource ? undefined : githubRef,
101
+ });
102
+ const _config = JSON.parse(fs_extra_1.default.readFileSync(projectConfigPath).toString());
103
+ writeProjectConfig(projectConfigPath, {
104
+ ..._config,
105
+ name: projectName,
106
+ });
107
+ if (template.name === 'no-template') {
108
+ fs_extra_1.default.ensureDirSync(path_1.default.join(projectPath, 'src'));
109
+ }
110
+ return true;
111
+ }
69
112
  function validateProjectConfig(projectConfig, projectDir) {
70
113
  if (!projectConfig) {
71
114
  logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.validateProjectConfig.configNotFound`, {
@@ -192,3 +235,21 @@ function logFeedbackMessage(buildId) {
192
235
  logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.logFeedbackMessage.feedbackMessage`));
193
236
  }
194
237
  }
238
+ async function createProjectComponent(component, name, projectComponentsVersion) {
239
+ const i18nKey = 'commands.project.subcommands.add';
240
+ const componentName = name;
241
+ const configInfo = await getProjectConfig();
242
+ if (!configInfo.projectDir || !configInfo.projectConfig) {
243
+ logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.error.locationInProject`));
244
+ process.exit(exitCodes_1.EXIT_CODES.ERROR);
245
+ }
246
+ const componentPath = path_1.default.join(configInfo.projectDir, configInfo.projectConfig.srcDir, component.insertPath, componentName);
247
+ await (0, github_1.cloneGithubRepo)(constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, componentPath, {
248
+ sourceDir: component.path,
249
+ tag: projectComponentsVersion,
250
+ });
251
+ }
252
+ async function getProjectComponentsByVersion(projectComponentsVersion) {
253
+ const config = await (0, github_1.fetchFileFromRepository)(constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, 'config.json', projectComponentsVersion);
254
+ return config[constants_1.PROJECT_COMPONENT_TYPES.COMPONENTS] || [];
255
+ }
@@ -5,5 +5,5 @@ type ProjectUploadResult<T> = {
5
5
  result?: T;
6
6
  uploadError?: unknown;
7
7
  };
8
- export declare function handleProjectUpload<T>(accountId: number, projectConfig: ProjectConfig, projectDir: string, callbackFunc: ProjectUploadCallbackFunction<T>, uploadMessage: string, sendIR?: boolean, skipValidation?: boolean): Promise<ProjectUploadResult<T>>;
8
+ export declare function handleProjectUpload<T>(accountId: number, projectConfig: ProjectConfig, projectDir: string, callbackFunc: ProjectUploadCallbackFunction<T>, uploadMessage: string, sendIR?: boolean): Promise<ProjectUploadResult<T>>;
9
9
  export {};
@@ -58,7 +58,7 @@ async function uploadProjectFiles(accountId, projectName, filePath, uploadMessag
58
58
  }
59
59
  return { buildId, error };
60
60
  }
61
- async function handleProjectUpload(accountId, projectConfig, projectDir, callbackFunc, uploadMessage, sendIR = false, skipValidation = false) {
61
+ async function handleProjectUpload(accountId, projectConfig, projectDir, callbackFunc, uploadMessage, sendIR = false) {
62
62
  const srcDir = path_1.default.resolve(projectDir, projectConfig.srcDir);
63
63
  const filenames = fs_extra_1.default.readdirSync(srcDir);
64
64
  if (!filenames || filenames.length === 0) {
@@ -84,7 +84,7 @@ async function handleProjectUpload(accountId, projectConfig, projectDir, callbac
84
84
  projectSourceDir: path_1.default.join(projectDir, projectConfig.srcDir),
85
85
  platformVersion: projectConfig.platformVersion,
86
86
  accountId,
87
- }, { skipValidation });
87
+ });
88
88
  logger_1.logger.debug(node_util_1.default.inspect(intermediateRepresentation, false, null, true));
89
89
  }
90
90
  catch (e) {
@@ -4,7 +4,7 @@ type AccountNamePromptResponse = {
4
4
  name: string;
5
5
  };
6
6
  export declare function getCliAccountNamePromptConfig(defaultName?: string): PromptConfig<AccountNamePromptResponse>;
7
- export declare function cliAccountNamePrompt(defaultName: string): Promise<AccountNamePromptResponse>;
7
+ export declare function cliAccountNamePrompt(defaultName?: string): Promise<AccountNamePromptResponse>;
8
8
  export declare function hubspotAccountNamePrompt({ accountType, currentPortalCount, }: {
9
9
  accountType: AccountType;
10
10
  currentPortalCount?: number;
@@ -1,12 +1,14 @@
1
+ import { RepoPath } from '@hubspot/local-dev-lib/types/Github';
1
2
  import { ProjectTemplate } from '../../types/Projects';
2
3
  type CreateProjectPromptResponse = {
3
4
  name: string;
4
5
  dest: string;
5
- projectTemplate?: ProjectTemplate;
6
+ template: ProjectTemplate;
6
7
  };
7
- export declare function createProjectPrompt(promptOptions: {
8
- name?: string;
9
- dest?: string;
10
- template?: string;
11
- }, projectTemplates?: ProjectTemplate[]): Promise<CreateProjectPromptResponse>;
8
+ export declare function createProjectPrompt(githubRef: string, promptOptions: {
9
+ name: string;
10
+ dest: string;
11
+ template: string;
12
+ templateSource: RepoPath;
13
+ }, skipTemplatePrompt?: boolean): Promise<CreateProjectPromptResponse>;
12
14
  export {};
@@ -7,17 +7,52 @@ exports.createProjectPrompt = createProjectPrompt;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const path_2 = require("@hubspot/local-dev-lib/path");
10
+ const github_1 = require("@hubspot/local-dev-lib/github");
11
+ const logger_1 = require("@hubspot/local-dev-lib/logger");
12
+ const constants_1 = require("../constants");
10
13
  const promptUtils_1 = require("./promptUtils");
11
14
  const lang_1 = require("../lang");
15
+ const exitCodes_1 = require("../enums/exitCodes");
12
16
  const i18nKey = 'lib.prompts.createProjectPrompt';
13
- function findTemplateByNameOrLabel(projectTemplates, templateNameOrLabel) {
17
+ const PROJECT_TEMPLATE_PROPERTIES = ['name', 'label', 'path', 'insertPath'];
18
+ function hasAllProperties(projectList) {
19
+ return projectList.every(config => PROJECT_TEMPLATE_PROPERTIES.every(p => Object.prototype.hasOwnProperty.call(config, p)));
20
+ }
21
+ async function createTemplateOptions(templateSource, githubRef) {
22
+ const hasCustomTemplateSource = Boolean(templateSource);
23
+ const branch = hasCustomTemplateSource
24
+ ? constants_1.DEFAULT_PROJECT_TEMPLATE_BRANCH
25
+ : githubRef;
26
+ let config;
27
+ try {
28
+ config = await (0, github_1.fetchFileFromRepository)(templateSource || constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, 'config.json', branch);
29
+ }
30
+ catch (e) {
31
+ logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.errors.missingConfigFileTemplateSource`));
32
+ process.exit(exitCodes_1.EXIT_CODES.ERROR);
33
+ }
34
+ if (!config || !config[constants_1.PROJECT_COMPONENT_TYPES.PROJECTS]) {
35
+ logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.errors.noProjectsInConfig`));
36
+ process.exit(exitCodes_1.EXIT_CODES.ERROR);
37
+ }
38
+ if (!hasAllProperties(config[constants_1.PROJECT_COMPONENT_TYPES.PROJECTS])) {
39
+ logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.errors.missingPropertiesInConfig`));
40
+ process.exit(exitCodes_1.EXIT_CODES.ERROR);
41
+ }
42
+ return config[constants_1.PROJECT_COMPONENT_TYPES.PROJECTS];
43
+ }
44
+ function findTemplate(projectTemplates, templateNameOrLabel) {
14
45
  return projectTemplates.find(t => t.name === templateNameOrLabel || t.label === templateNameOrLabel);
15
46
  }
16
- async function createProjectPrompt(promptOptions, projectTemplates) {
17
- const createProjectFromTemplate = !!projectTemplates && projectTemplates.length > 0;
18
- const providedTemplateIsValid = createProjectFromTemplate &&
19
- !!promptOptions.template &&
20
- !!findTemplateByNameOrLabel(projectTemplates, promptOptions.template);
47
+ async function createProjectPrompt(githubRef, promptOptions, skipTemplatePrompt = false) {
48
+ let projectTemplates = [];
49
+ let selectedTemplate;
50
+ if (!skipTemplatePrompt) {
51
+ projectTemplates = await createTemplateOptions(promptOptions.templateSource, githubRef);
52
+ selectedTemplate =
53
+ promptOptions.template &&
54
+ findTemplate(projectTemplates, promptOptions.template);
55
+ }
21
56
  const result = await (0, promptUtils_1.promptUser)([
22
57
  {
23
58
  name: 'name',
@@ -35,7 +70,7 @@ async function createProjectPrompt(promptOptions, projectTemplates) {
35
70
  message: (0, lang_1.i18n)(`${i18nKey}.enterDest`),
36
71
  when: !promptOptions.dest,
37
72
  default: answers => {
38
- const projectName = (0, path_2.sanitizeFileName)(promptOptions.name || answers.name);
73
+ const projectName = (0, path_2.sanitizeFileName)(answers.name || promptOptions.name);
39
74
  return path_1.default.resolve((0, path_2.getCwd)(), projectName);
40
75
  },
41
76
  validate: (input) => {
@@ -55,34 +90,27 @@ async function createProjectPrompt(promptOptions, projectTemplates) {
55
90
  },
56
91
  },
57
92
  {
58
- name: 'projectTemplate',
93
+ name: 'template',
59
94
  message: () => {
60
- return promptOptions.template && !providedTemplateIsValid
95
+ return promptOptions.template &&
96
+ !findTemplate(projectTemplates, promptOptions.template)
61
97
  ? (0, lang_1.i18n)(`${i18nKey}.errors.invalidTemplate`, {
62
98
  template: promptOptions.template,
63
99
  })
64
100
  : (0, lang_1.i18n)(`${i18nKey}.selectTemplate`);
65
101
  },
66
- when: createProjectFromTemplate && !providedTemplateIsValid,
102
+ when: !skipTemplatePrompt && !selectedTemplate,
67
103
  type: 'list',
68
- choices: createProjectFromTemplate
69
- ? projectTemplates.map(template => {
70
- return {
71
- name: template.label,
72
- value: template,
73
- };
74
- })
75
- : undefined,
104
+ choices: projectTemplates.map(template => {
105
+ return {
106
+ name: template.label,
107
+ value: template,
108
+ };
109
+ }),
76
110
  },
77
111
  ]);
78
- if (!result.name) {
79
- result.name = promptOptions.name;
80
- }
81
- if (!result.dest) {
82
- result.dest = promptOptions.dest;
83
- }
84
- if (providedTemplateIsValid) {
85
- result.projectTemplate = findTemplateByNameOrLabel(projectTemplates, promptOptions.template);
112
+ if (selectedTemplate) {
113
+ result.template = selectedTemplate;
86
114
  }
87
115
  return result;
88
116
  }
@@ -1,9 +1,9 @@
1
- import { ComponentTemplate } from '../../types/Projects';
1
+ import { ProjectAddComponentData } from '../../types/Projects';
2
2
  type ProjectAddPromptResponse = {
3
- componentTemplate: ComponentTemplate;
3
+ component: ProjectAddComponentData;
4
4
  name: string;
5
5
  };
6
- export declare function projectAddPrompt(components: ComponentTemplate[], promptOptions?: {
6
+ export declare function projectAddPrompt(components: ProjectAddComponentData[], promptOptions?: {
7
7
  name?: string;
8
8
  type?: string;
9
9
  }): Promise<ProjectAddPromptResponse>;
@@ -4,23 +4,20 @@ exports.projectAddPrompt = projectAddPrompt;
4
4
  const promptUtils_1 = require("./promptUtils");
5
5
  const lang_1 = require("../lang");
6
6
  const i18nKey = 'lib.prompts.projectAddPrompt';
7
- function findComponentByPathOrLabel(components, componentPathOrLabel) {
8
- return components.find(c => c.path === componentPathOrLabel || c.label === componentPathOrLabel);
9
- }
10
7
  async function projectAddPrompt(components, promptOptions = {}) {
11
- const providedTypeIsValid = !!promptOptions.type &&
12
- !!findComponentByPathOrLabel(components, promptOptions.type);
13
- const result = await (0, promptUtils_1.promptUser)([
8
+ return (0, promptUtils_1.promptUser)([
14
9
  {
15
- name: 'componentTemplate',
10
+ name: 'component',
16
11
  message: () => {
17
- return promptOptions.type && !providedTypeIsValid
12
+ return promptOptions.type &&
13
+ !components.find(t => t.path === promptOptions.type)
18
14
  ? (0, lang_1.i18n)(`${i18nKey}.errors.invalidType`, {
19
15
  type: promptOptions.type,
20
16
  })
21
17
  : (0, lang_1.i18n)(`${i18nKey}.selectType`);
22
18
  },
23
- when: !providedTypeIsValid,
19
+ when: !promptOptions.type ||
20
+ !components.find(t => t.path === promptOptions.type),
24
21
  type: 'list',
25
22
  choices: components.map(type => {
26
23
  return {
@@ -41,11 +38,4 @@ async function projectAddPrompt(components, promptOptions = {}) {
41
38
  },
42
39
  },
43
40
  ]);
44
- if (!result.name) {
45
- result.name = promptOptions.name;
46
- }
47
- if (providedTypeIsValid) {
48
- result.componentTemplate = findComponentByPathOrLabel(components, promptOptions.type);
49
- }
50
- return result;
51
41
  }
@@ -1,7 +1,6 @@
1
1
  import { CLIAccount } from '@hubspot/local-dev-lib/types/Accounts';
2
2
  import { DeveloperTestAccount } from '@hubspot/local-dev-lib/types/developerTestAccounts';
3
- import { ProjectDevTargetAccountPromptResponse } from '../../types/Prompts';
4
- export declare function selectSandboxTargetAccountPrompt(accounts: CLIAccount[], defaultAccountConfig: CLIAccount): Promise<ProjectDevTargetAccountPromptResponse>;
5
- export declare function selectDeveloperTestTargetAccountPrompt(accounts: CLIAccount[], defaultAccountConfig: CLIAccount): Promise<ProjectDevTargetAccountPromptResponse>;
3
+ export declare function selectSandboxTargetAccountPrompt(accounts: CLIAccount[], defaultAccountConfig: CLIAccount): Promise<DeveloperTestAccount | CLIAccount>;
4
+ export declare function selectDeveloperTestTargetAccountPrompt(accounts: CLIAccount[], defaultAccountConfig: CLIAccount): Promise<DeveloperTestAccount | CLIAccount>;
6
5
  export declare function confirmDefaultAccountPrompt(accountName: string, accountType: string): Promise<boolean>;
7
6
  export declare function confirmUseExistingDeveloperTestAccountPrompt(account: DeveloperTestAccount): Promise<boolean>;
@@ -1,10 +1,9 @@
1
- import { SandboxAccountType } from '../../types/Sandboxes';
2
1
  type SandboxTypePromptResponse = {
3
- type: SandboxAccountType;
2
+ type: string;
4
3
  };
5
4
  type DeleteSandboxPromptResponse = {
6
5
  account: string;
7
6
  };
8
7
  export declare function sandboxTypePrompt(): Promise<SandboxTypePromptResponse>;
9
- export declare function deleteSandboxPrompt(promptParentAccount?: boolean): Promise<DeleteSandboxPromptResponse | undefined>;
8
+ export declare function deleteSandboxPrompt(promptParentAccount?: boolean): Promise<DeleteSandboxPromptResponse> | void;
10
9
  export {};
@@ -52,7 +52,7 @@ function deleteSandboxPrompt(promptParentAccount = false) {
52
52
  ? mapNonSandboxAccountChoices(accountsList)
53
53
  : mapSandboxAccountChoices(accountsList);
54
54
  if (!choices.length) {
55
- return Promise.resolve(undefined);
55
+ return;
56
56
  }
57
57
  return (0, promptUtils_1.promptUser)([
58
58
  {
@@ -26,12 +26,8 @@ async function syncSandbox(accountConfig, parentAccountConfig, env, syncTasks, s
26
26
  const isDevSandbox = (0, accountTypes_1.isDevelopmentSandbox)(accountConfig);
27
27
  if (!accountId || !parentAccountId) {
28
28
  throw new Error((0, lang_1.i18n)(`${i18nKey}.failure.invalidUser`, {
29
- accountName: accountId
30
- ? (0, ui_1.uiAccountDescription)(accountId)
31
- : id.toString(),
32
- parentAccountName: parentAccountId
33
- ? (0, ui_1.uiAccountDescription)(parentAccountId)
34
- : parentId.toString(),
29
+ accountName: (0, ui_1.uiAccountDescription)(accountId),
30
+ parentAccountName: (0, ui_1.uiAccountDescription)(parentAccountId),
35
31
  }));
36
32
  }
37
33
  SpinniesManager_1.default.init({
@@ -1,11 +1,14 @@
1
1
  import { AccountType, CLIAccount } from '@hubspot/local-dev-lib/types/Accounts';
2
2
  import { Environment } from '@hubspot/local-dev-lib/types/Config';
3
- import { SandboxSyncTask, SandboxAccountType } from '../types/Sandboxes';
3
+ import { SandboxSyncTask } from '../types/Sandboxes';
4
4
  export declare const SYNC_TYPES: {
5
5
  readonly OBJECT_RECORDS: "object-records";
6
6
  };
7
7
  export declare const SANDBOX_TYPE_MAP: {
8
- [key: string]: SandboxAccountType;
8
+ readonly dev: "DEVELOPMENT_SANDBOX";
9
+ readonly developer: "DEVELOPMENT_SANDBOX";
10
+ readonly development: "DEVELOPMENT_SANDBOX";
11
+ readonly standard: "STANDARD_SANDBOX";
9
12
  };
10
13
  export declare const SANDBOX_API_TYPE_MAP: {
11
14
  readonly STANDARD_SANDBOX: 1;
package/lib/ui/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export declare function uiAccountDescription(accountId?: number | null, bold?: b
9
9
  export declare function uiInfoSection(title: string, logContent: () => void): void;
10
10
  export declare function uiCommandReference(command: string): string;
11
11
  export declare function uiFeatureHighlight(commands: string[], title?: string): void;
12
- export declare function uiBetaTag(message: string, log?: boolean): string | undefined;
12
+ export declare function uiBetaTag(message: string, log?: boolean): void | string;
13
13
  export declare function uiDeprecatedTag(message: string): void;
14
14
  export declare function uiCommandDisabledBanner(command: string, url?: string, message?: string): void;
15
15
  export declare function uiDeprecatedDescription(message: string, command: string, url?: string): void;
package/lib/ui/index.js CHANGED
@@ -100,7 +100,6 @@ function uiBetaTag(message, log = true) {
100
100
  const result = `${terminalUISupport.color ? chalk_1.default.hex(exports.UI_COLORS.SORBET)(tag) : tag} ${message}`;
101
101
  if (log) {
102
102
  logger_1.logger.log(result);
103
- return;
104
103
  }
105
104
  else {
106
105
  return result;
package/lib/upload.d.ts CHANGED
@@ -1 +1 @@
1
- export declare function getUploadableFileList(src: string, convertFields: boolean): Promise<string[]>;
1
+ export {};
package/lib/upload.js CHANGED
@@ -1,49 +1,46 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
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");
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');
14
11
  /*
15
12
  * Walks the src folder for files, filters them based on ignore filter.
16
13
  * 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
17
14
  */
18
- async function getUploadableFileList(src, convertFields) {
15
+ const getUploadableFileList = async (src, convertFields) => {
19
16
  let filePaths = [];
20
17
  try {
21
- filePaths = await (0, fs_1.walk)(src);
18
+ filePaths = await walk(src);
22
19
  }
23
20
  catch (e) {
24
- (0, index_1.logError)(e);
21
+ logError(e);
25
22
  }
26
23
  const allowedFiles = filePaths
27
24
  .filter(file => {
28
- if (!(0, path_2.isAllowedExtension)(file)) {
25
+ if (!isAllowedExtension(file)) {
29
26
  return false;
30
27
  }
31
28
  return true;
32
29
  })
33
- .filter((0, ignoreRules_1.createIgnoreFilter)(false));
30
+ .filter(createIgnoreFilter());
34
31
  if (!convertFields) {
35
32
  return allowedFiles;
36
33
  }
37
34
  const uploadableFiles = [];
38
35
  let skipFiles = [];
39
36
  for (const filePath of allowedFiles) {
40
- const fileName = path_1.default.basename(filePath);
37
+ const fileName = path.basename(filePath);
41
38
  if (skipFiles.includes(filePath))
42
39
  continue;
43
- const isConvertable = (0, handleFieldsJS_1.isConvertableFieldJs)(src, filePath, convertFields);
40
+ const isConvertable = isConvertableFieldJs(src, filePath, convertFields);
44
41
  if (isConvertable || fileName == 'fields.json') {
45
42
  // This prompt checks if there are multiple field files in the folder and gets user to choose.
46
- const [choice, updatedSkipFiles] = await (0, cmsFieldPrompt_1.fieldsJsPrompt)(filePath, src, skipFiles);
43
+ const [choice, updatedSkipFiles] = await fieldsJsPrompt(filePath, src, skipFiles);
47
44
  skipFiles = updatedSkipFiles;
48
45
  // If they chose something other than the current file, move on.
49
46
  if (choice !== filePath)
@@ -52,4 +49,7 @@ async function getUploadableFileList(src, convertFields) {
52
49
  uploadableFiles.push(filePath);
53
50
  }
54
51
  return uploadableFiles;
55
- }
52
+ };
53
+ module.exports = {
54
+ getUploadableFileList,
55
+ };
@@ -16,6 +16,6 @@ type Meta = {
16
16
  export declare function trackCommandUsage(command: string, meta?: Meta, accountId?: number): Promise<void>;
17
17
  export declare function trackHelpUsage(command: string): Promise<void>;
18
18
  export declare function trackConvertFieldsUsage(command: string): Promise<void>;
19
- export declare function trackAuthAction(command: string, authType: string, step: string, accountId: number): Promise<void>;
19
+ export declare function trackAuthAction(command: string, authType: string, step: string, accountId?: number): Promise<void>;
20
20
  export declare function trackCommandMetadataUsage(command: string, meta?: Meta, accountId?: number): Promise<void>;
21
21
  export {};
@@ -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): unknown | null;
13
+ export declare function checkAndConvertToJson(_path: string): object | null;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "7.2.0-experimental.0",
3
+ "version": "7.2.2-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.2",
9
- "@hubspot/project-parsing-lib": "0.0.12-experimental.0",
8
+ "@hubspot/local-dev-lib": "0.2.1-experimental.0",
9
+ "@hubspot/project-parsing-lib": "0.0.4",
10
10
  "@hubspot/serverless-dev-runtime": "7.0.2",
11
11
  "@hubspot/theme-preview-dev-server": "0.0.10",
12
12
  "@hubspot/ui-extensions-dev-server": "0.8.42",
@@ -32,7 +32,6 @@
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/archiver": "^6.0.3",
35
- "@types/cli-progress": "^3.11.6",
36
35
  "@types/express": "^5.0.0",
37
36
  "@types/findup-sync": "^4.0.5",
38
37
  "@types/fs-extra": "^11.0.4",
@@ -7,8 +7,8 @@ export type ProjectTemplate = {
7
7
  insertPath: string;
8
8
  };
9
9
  export type ComponentTemplate = {
10
- path: string;
11
10
  label: string;
11
+ path: string;
12
12
  insertPath: string;
13
13
  };
14
14
  export type ProjectConfig = {
@@ -32,6 +32,11 @@ 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
+ };
35
40
  export type ProjectTemplateRepoConfig = {
36
41
  projects?: ProjectTemplate[];
37
42
  components?: ComponentTemplate[];
@@ -1,4 +1,3 @@
1
- import { DeveloperTestAccount } from '@hubspot/local-dev-lib/types/developerTestAccounts';
2
1
  export type GenericPromptResponse = {
3
2
  [key: string]: any;
4
3
  };
@@ -23,10 +22,4 @@ export type PromptConfig<T extends GenericPromptResponse> = {
23
22
  mask?: string;
24
23
  filter?: (input: string) => string;
25
24
  };
26
- export type ProjectDevTargetAccountPromptResponse = {
27
- targetAccountId: number | null;
28
- createNestedAccount: boolean;
29
- parentAccountId?: number | null;
30
- notInConfigAccount?: DeveloperTestAccount | null;
31
- };
32
25
  export {};
@@ -1,5 +1,3 @@
1
- import { HUBSPOT_ACCOUNT_TYPES } from '@hubspot/local-dev-lib/constants/config';
2
1
  export type SandboxSyncTask = {
3
2
  type: string;
4
3
  };
5
- export type SandboxAccountType = typeof HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX | typeof HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX;
package/types/Yargs.d.ts CHANGED
@@ -16,13 +16,6 @@ export type AccountArgs = {
16
16
  export type EnvironmentArgs = {
17
17
  'use-env'?: string;
18
18
  };
19
- export type OverwriteArgs = Options & {
20
- o?: boolean;
21
- overwrite?: boolean;
22
- };
23
19
  export type StringArgType = Options & {
24
20
  type: 'string';
25
21
  };
26
- export type TestingArgs = {
27
- qa?: boolean;
28
- };
@@ -1,3 +0,0 @@
1
- import { SchemaDefinition, ObjectDefinition } from '@hubspot/local-dev-lib/types/Schemas';
2
- export declare function isSchemaDefinition(schema: unknown): schema is SchemaDefinition;
3
- export declare function isObjectDefinition(object: unknown): object is ObjectDefinition;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isSchemaDefinition = isSchemaDefinition;
4
- exports.isObjectDefinition = isObjectDefinition;
5
- function isSchemaDefinition(schema) {
6
- return (typeof schema === 'object' &&
7
- schema !== null &&
8
- 'labels' in schema &&
9
- 'name' in schema &&
10
- 'properties' in schema &&
11
- 'requiredProperties' in schema);
12
- }
13
- function isObjectDefinition(object) {
14
- return typeof object === 'object' && object !== null && 'inputs' in object;
15
- }
@@ -1,5 +0,0 @@
1
- import { RepoPath } from '@hubspot/local-dev-lib/types/Github';
2
- import { ProjectTemplate, ComponentTemplate } from '../../types/Projects';
3
- export declare const EMPTY_PROJECT_TEMPLATE_NAME = "no-template";
4
- export declare function getProjectComponentListFromRepo(githubRef: string): Promise<ComponentTemplate[]>;
5
- export declare function getProjectTemplateListFromRepo(templateSource: RepoPath, githubRef: string): Promise<ProjectTemplate[]>;