@hubspot/cli 5.1.4-beta.4 → 5.1.4-beta.6

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.
@@ -8,10 +8,10 @@ const { logger } = require('@hubspot/local-dev-lib/logger');
8
8
  const path = require('path');
9
9
  const fs = require('fs-extra');
10
10
  const ora = require('ora');
11
- const { fetchJsonFromRepository } = require('@hubspot/cli-lib/github');
12
- // TODO: Swap to local-dev-lib after swapping github utils dep
13
- const { GITHUB_RELEASE_TYPES } = require('@hubspot/cli-lib/lib/constants');
14
- const { cloneGitHubRepo } = require('@hubspot/cli-lib/github');
11
+ const {
12
+ fetchFileFromRepository,
13
+ cloneGithubRepo,
14
+ } = require('@hubspot/local-dev-lib/github');
15
15
  const { i18n } = require('../../lib/lang');
16
16
 
17
17
  const i18nKey = 'cli.commands.create.subcommands.apiSample';
@@ -39,7 +39,7 @@ module.exports = {
39
39
  }
40
40
  const downloadSpinner = ora(i18n(`${i18nKey}.loading.apiSamples`));
41
41
  downloadSpinner.start();
42
- const samplesConfig = await fetchJsonFromRepository(
42
+ const samplesConfig = await fetchFileFromRepository(
43
43
  'HubSpot/sample-apps-list',
44
44
  'samples.json',
45
45
  'main'
@@ -62,16 +62,11 @@ module.exports = {
62
62
  sampleLanguage,
63
63
  })
64
64
  );
65
- const created = await cloneGitHubRepo(
66
- filePath,
67
- assetType,
68
- `HubSpot/${sampleType}`,
69
- sampleLanguage,
70
- {
71
- ...options,
72
- releaseType: GITHUB_RELEASE_TYPES.REPOSITORY,
73
- }
74
- );
65
+ const created = await cloneGithubRepo(`HubSpot/${sampleType}`, filePath, {
66
+ type: assetType,
67
+ sourceDir: sampleLanguage,
68
+ ...options,
69
+ });
75
70
  if (created) {
76
71
  if (fs.existsSync(`${filePath}/.env.template`)) {
77
72
  fs.copySync(`${filePath}/.env.template`, `${filePath}/.env`);
@@ -1,14 +1,11 @@
1
- const { cloneGitHubRepo } = require('@hubspot/cli-lib/github');
1
+ const { cloneGithubRepo } = require('@hubspot/local-dev-lib/github');
2
2
 
3
3
  module.exports = {
4
4
  hidden: true,
5
5
  dest: ({ name, assetType }) => name || assetType,
6
6
  execute: async ({ options, dest, assetType }) =>
7
- cloneGitHubRepo(
8
- dest,
9
- assetType,
10
- 'HubSpot/crm-card-weather-app',
11
- '',
12
- options
13
- ),
7
+ cloneGithubRepo('HubSpot/crm-card-weather-app', dest, {
8
+ type: assetType,
9
+ ...options,
10
+ }),
14
11
  };
@@ -1,13 +1,10 @@
1
- const { cloneGitHubRepo } = require('@hubspot/cli-lib/github');
1
+ const { cloneGithubRepo } = require('@hubspot/local-dev-lib/github');
2
2
 
3
3
  module.exports = {
4
4
  dest: ({ name, assetType }) => name || assetType,
5
5
  execute: async ({ options, dest, assetType }) =>
6
- cloneGitHubRepo(
7
- dest,
8
- assetType,
9
- 'HubSpot/cms-react-boilerplate',
10
- '',
11
- options
12
- ),
6
+ cloneGithubRepo('HubSpot/cms-react-boilerplate', dest, {
7
+ type: assetType,
8
+ ...options,
9
+ }),
13
10
  };
@@ -1,13 +1,10 @@
1
- const { cloneGitHubRepo } = require('@hubspot/cli-lib/github');
1
+ const { cloneGithubRepo } = require('@hubspot/local-dev-lib/github');
2
2
 
3
3
  module.exports = {
4
4
  dest: ({ name, assetType }) => name || assetType,
5
5
  execute: async ({ options, dest, assetType }) =>
6
- cloneGitHubRepo(
7
- dest,
8
- assetType,
9
- 'HubSpot/cms-vue-boilerplate',
10
- '',
11
- options
12
- ),
6
+ cloneGithubRepo('HubSpot/cms-vue-boilerplate', dest, {
7
+ type: assetType,
8
+ ...options,
9
+ }),
13
10
  };
@@ -1,13 +1,10 @@
1
- const { cloneGitHubRepo } = require('@hubspot/cli-lib/github');
1
+ const { cloneGithubRepo } = require('@hubspot/local-dev-lib/github');
2
2
 
3
3
  module.exports = {
4
4
  dest: ({ name, assetType }) => name || assetType,
5
5
  execute: async ({ options, dest, assetType }) =>
6
- cloneGitHubRepo(
7
- dest,
8
- assetType,
9
- 'HubSpot/cms-webpack-serverless-boilerplate',
10
- '',
11
- options
12
- ),
6
+ cloneGithubRepo('HubSpot/cms-webpack-serverless-boilerplate', dest, {
7
+ type: assetType,
8
+ ...options,
9
+ }),
13
10
  };
@@ -1,9 +1,7 @@
1
- const { cloneGitHubRepo } = require('@hubspot/cli-lib/github');
2
- // TODO: Swap to local-dev-lib after swapping github utils dep
3
- const { GITHUB_RELEASE_TYPES } = require('@hubspot/cli-lib/lib/constants');
1
+ const { cloneGithubRepo } = require('@hubspot/local-dev-lib/github');
4
2
  const { getIsInProject } = require('../../lib/projects');
5
3
 
6
- const PROJECT_BOILERPLATE_REF = 'cms-boilerplate-developer-projects';
4
+ const PROJECT_BOILERPLATE_BRANCH = 'cms-boilerplate-developer-projects';
7
5
 
8
6
  module.exports = {
9
7
  dest: ({ name, assetType }) => name || assetType,
@@ -11,16 +9,12 @@ module.exports = {
11
9
  const isInProject = await getIsInProject(dest);
12
10
 
13
11
  if (isInProject) {
14
- options.ref = PROJECT_BOILERPLATE_REF;
15
- // releaseType has to be 'REPOSITORY' to download a specific branch
16
- options.releaseType = GITHUB_RELEASE_TYPES.REPOSITORY;
12
+ options.branch = PROJECT_BOILERPLATE_BRANCH;
17
13
  }
18
- cloneGitHubRepo(
19
- dest,
20
- assetType,
21
- 'HubSpot/cms-theme-boilerplate',
22
- 'src',
23
- options
24
- );
14
+ cloneGithubRepo('HubSpot/cms-theme-boilerplate', dest, {
15
+ type: assetType,
16
+ sourceDir: 'src',
17
+ ...options,
18
+ });
25
19
  },
26
20
  };
@@ -1,7 +1,7 @@
1
1
  const { logger } = require('@hubspot/local-dev-lib/logger');
2
2
  const { getAccountId } = require('@hubspot/local-dev-lib/config');
3
3
  const { logErrorInstance } = require('../../lib/errorHandlers/standardErrors');
4
- const { fetchReleaseData } = require('@hubspot/cli-lib/github');
4
+ const { fetchReleaseData } = require('@hubspot/local-dev-lib/github');
5
5
 
6
6
  const { trackCommandUsage } = require('../../lib/usageTracking');
7
7
  const { i18n } = require('../../lib/lang');
@@ -19,7 +19,7 @@ const {
19
19
  HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH,
20
20
  } = require('../../lib/constants');
21
21
  const { logger } = require('@hubspot/local-dev-lib/logger');
22
- const { fetchReleaseData } = require('@hubspot/cli-lib/github');
22
+ const { fetchReleaseData } = require('@hubspot/local-dev-lib/github');
23
23
 
24
24
  const i18nKey = 'cli.commands.project.subcommands.create';
25
25
 
@@ -27,7 +27,6 @@ const {
27
27
  ensureProjectExists,
28
28
  handleProjectUpload,
29
29
  pollProjectBuildAndDeploy,
30
- showPlatformVersionWarning,
31
30
  validateProjectConfig,
32
31
  } = require('../../lib/projects');
33
32
  const { EXIT_CODES } = require('../../lib/enums/exitCodes');
@@ -264,8 +263,6 @@ exports.handler = async options => {
264
263
  }
265
264
 
266
265
  if (shouldCreateProject) {
267
- await showPlatformVersionWarning(accountId, projectConfig);
268
-
269
266
  SpinniesManager.add('createProject', {
270
267
  text: i18n(`${i18nKey}.status.creatingProject`, {
271
268
  accountIdentifier: uiAccountDescription(targetAccountId),
@@ -16,7 +16,6 @@ const {
16
16
  logFeedbackMessage,
17
17
  validateProjectConfig,
18
18
  pollProjectBuildAndDeploy,
19
- showPlatformVersionWarning,
20
19
  } = require('../../lib/projects');
21
20
  const { i18n } = require('../../lib/lang');
22
21
  const { getAccountConfig } = require('@hubspot/local-dev-lib/config');
@@ -47,8 +46,6 @@ exports.handler = async options => {
47
46
 
48
47
  validateProjectConfig(projectConfig, projectDir);
49
48
 
50
- await showPlatformVersionWarning(accountId, projectConfig);
51
-
52
49
  await ensureProjectExists(accountId, projectConfig.name, {
53
50
  forceCreate,
54
51
  uploadCommand: true,
@@ -22,7 +22,6 @@ const {
22
22
  pollDeployStatus,
23
23
  validateProjectConfig,
24
24
  logFeedbackMessage,
25
- showPlatformVersionWarning,
26
25
  } = require('../../lib/projects');
27
26
  const {
28
27
  cancelStagedBuild,
@@ -104,8 +103,6 @@ exports.handler = async options => {
104
103
 
105
104
  validateProjectConfig(projectConfig, projectDir);
106
105
 
107
- await showPlatformVersionWarning(accountId, projectConfig);
108
-
109
106
  await ensureProjectExists(accountId, projectConfig.name);
110
107
 
111
108
  try {
package/lang/en.lyaml CHANGED
@@ -957,7 +957,6 @@ en:
957
957
  srcOutsideProjectDir: "Invalid value for 'srcDir' in {{ projectConfig }}: {{#bold}}srcDir: \"{{ srcDir }}\"{{/bold}}\n\t'srcDir' must be a relative path to a folder under the project root, such as \".\" or \"./src\""
958
958
  uploadProjectFiles:
959
959
  add: "Uploading {{#bold}}{{ projectName }}{{/bold}} project files to {{ accountIdentifier }}"
960
- fail: "Failed to upload {{#bold}}{{ projectName }}{{/bold}} project files to {{ accountIdentifier }}"
961
960
  succeed: "Uploaded {{#bold}}{{ projectName }}{{/bold}} project files to {{ accountIdentifier }}"
962
961
  buildCreated: "Project \"{{ projectName }}\" uploaded and build #{{ buildId }} created"
963
962
  handleProjectUpload:
@@ -983,10 +982,6 @@ en:
983
982
  logFeedbackMessage:
984
983
  feedbackHeader: "We'd love to hear your feedback!"
985
984
  feedbackMessage: "How are you liking the new projects and developer tools? \n > Run `{{#yellow}}hs feedback{{/yellow}}` to let us know what you think!\n"
986
- showPlatformVersionWarning:
987
- docsLink: "Projects platform versioning (BETA)"
988
- noPlatformVersion: "No platformVersion found in hsproject.json. Falling back to default version. Starting Mar 31, 2024, new project builds without a specified version will no longer be supported. To update your project to the latest version, see {{ docsLink }}."
989
- deprecatedVersion: "Starting Mar 31, 2024, new project builds with platformVersion 2023.1 or unspecified versions will no longer be supported. It's recommended that you update your project to the latest version. For more info, see {{ docsLink }}."
990
985
  ui:
991
986
  betaTag: "{{#bold}}[BETA]{{/bold}}"
992
987
  betaWarning:
@@ -1357,7 +1352,7 @@ en:
1357
1352
  overrideErrors:
1358
1353
  platformVersionErrors:
1359
1354
  header: "Platform version update required"
1360
- unspecifiedPlatformVersion: "Projects with {{#bold}}unspecified platformVersion{{/bold}} are no longer supported."
1355
+ unspecifiedPlatformVersion: "Projects with an {{#bold}}{{platformVersion}}{{/bold}} are no longer supported."
1361
1356
  platformVersionRetired: "Projects with {{#bold}} platformVersion {{ platformVersion }}{{/bold}} are no longer supported."
1362
1357
  nonExistentPlatformVersion: "Projects with {{#bold}} platformVersion {{ platformVersion }}{{/bold}} are not supported."
1363
1358
  updateProject: "Please update your project to the latest version and try again."
@@ -7,13 +7,21 @@ const { uiLine, uiLink } = require('../ui');
7
7
 
8
8
  const i18nKey = 'cli.lib.errorHandlers.overrideErrors';
9
9
 
10
- function createPlatformVersionError(subCategory, errorData) {
11
- const platformVersion = errorData.context.PLATFORM_VERSION[0];
10
+ function createPlatformVersionError(subCategory, errData) {
12
11
  const docsLink = uiLink(
13
12
  i18n(`${i18nKey}.platformVersionErrors.docsLink`),
14
13
  'https://developers.hubspot.com/docs/platform/platform-versioning'
15
14
  );
16
15
 
16
+ const platformVersionKey = {
17
+ [PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_NOT_SPECIFIED]:
18
+ 'unspecified platformVersion',
19
+ [PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_RETIRED]:
20
+ errData.context.RETIRED_PLATFORM_VERSION,
21
+ [PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_SPECIFIED_DOES_NOT_EXIST]:
22
+ errData.context.PLATFORM_VERSION,
23
+ };
24
+
17
25
  const errorTypeToTranslationKey = {
18
26
  [PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_NOT_SPECIFIED]:
19
27
  'unspecifiedPlatformVersion',
@@ -23,6 +31,7 @@ function createPlatformVersionError(subCategory, errorData) {
23
31
  'nonExistentPlatformVersion',
24
32
  };
25
33
 
34
+ const platformVersion = platformVersionKey[subCategory] || '';
26
35
  const translationKey = errorTypeToTranslationKey[subCategory];
27
36
 
28
37
  uiLine();
package/lib/projects.js CHANGED
@@ -30,7 +30,7 @@ const {
30
30
  const { isSpecifiedError } = require('@hubspot/local-dev-lib/errors/apiErrors');
31
31
  const { shouldIgnoreFile } = require('@hubspot/local-dev-lib/ignoreRules');
32
32
  const { getCwd, getAbsoluteFilePath } = require('@hubspot/local-dev-lib/path');
33
- const { downloadGitHubRepoContents } = require('@hubspot/cli-lib/github');
33
+ const { downloadGithubRepoContents } = require('@hubspot/local-dev-lib/github');
34
34
  const { promptUser } = require('./prompts/promptUtils');
35
35
  const { EXIT_CODES } = require('./enums/exitCodes');
36
36
  const { uiLine, uiLink, uiAccountDescription } = require('../lib/ui');
@@ -137,11 +137,11 @@ const createProjectConfig = async (
137
137
 
138
138
  const hasCustomTemplateSource = Boolean(templateSource);
139
139
 
140
- await downloadGitHubRepoContents(
140
+ await downloadGithubRepoContents(
141
141
  templateSource || HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH,
142
142
  template.path,
143
143
  projectPath,
144
- hasCustomTemplateSource ? {} : { ref: githubRef }
144
+ hasCustomTemplateSource ? undefined : githubRef
145
145
  );
146
146
  const _config = JSON.parse(fs.readFileSync(projectConfigPath));
147
147
  writeProjectConfig(projectConfigPath, {
@@ -380,12 +380,8 @@ const uploadProjectFiles = async (
380
380
  })
381
381
  );
382
382
  } catch (err) {
383
- SpinniesManager.fail('upload', {
384
- text: i18n(`${i18nKey}.uploadProjectFiles.fail`, {
385
- accountIdentifier,
386
- projectName,
387
- }),
388
- });
383
+ SpinniesManager.fail('upload');
384
+ logApiErrorInstance(err);
389
385
 
390
386
  error = err;
391
387
  }
@@ -861,40 +857,12 @@ const createProjectComponent = async (
861
857
  componentName
862
858
  );
863
859
 
864
- await downloadGitHubRepoContents(
860
+ await downloadGithubRepoContents(
865
861
  HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH,
866
862
  component.path,
867
863
  componentPath,
868
- {
869
- ref: projectComponentsVersion,
870
- }
871
- );
872
- };
873
-
874
- const showPlatformVersionWarning = async (accountId, projectConfig) => {
875
- const platformVersion = projectConfig.platformVersion;
876
- const docsLink = uiLink(
877
- i18n(`${i18nKey}.showPlatformVersionWarning.docsLink`),
878
- 'https://developers.hubspot.com/docs/platform/platform-versioning'
864
+ projectComponentsVersion
879
865
  );
880
-
881
- if (!platformVersion) {
882
- logger.log('');
883
- logger.warn(
884
- i18n(`${i18nKey}.showPlatformVersionWarning.noPlatformVersion`, {
885
- docsLink,
886
- })
887
- );
888
- logger.log('');
889
- } else if (platformVersion === '2023.1') {
890
- logger.log('');
891
- logger.warn(
892
- i18n(`${i18nKey}.showPlatformVersionWarning.deprecatedVersion`, {
893
- docsLink,
894
- })
895
- );
896
- logger.log('');
897
- }
898
866
  };
899
867
 
900
868
  module.exports = {
@@ -913,5 +881,4 @@ module.exports = {
913
881
  ensureProjectExists,
914
882
  logFeedbackMessage,
915
883
  createProjectComponent,
916
- showPlatformVersionWarning,
917
884
  };
@@ -2,7 +2,7 @@ const path = require('path');
2
2
  const { getCwd } = require('@hubspot/local-dev-lib/path');
3
3
  const { PROJECT_COMPONENT_TYPES } = require('../../lib/constants');
4
4
  const { promptUser } = require('./promptUtils');
5
- const { fetchJsonFromRepository } = require('@hubspot/cli-lib/github');
5
+ const { fetchFileFromRepository } = require('@hubspot/local-dev-lib/github');
6
6
  const { i18n } = require('../lang');
7
7
  const { logger } = require('@hubspot/local-dev-lib/logger');
8
8
  const { EXIT_CODES } = require('../../lib/enums/exitCodes');
@@ -29,11 +29,10 @@ const createTemplateOptions = async (templateSource, githubRef) => {
29
29
  ? DEFAULT_PROJECT_TEMPLATE_BRANCH
30
30
  : githubRef;
31
31
 
32
- const config = await fetchJsonFromRepository(
32
+ const config = await fetchFileFromRepository(
33
33
  templateSource || HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH,
34
34
  'config.json',
35
- branch,
36
- hasCustomTemplateSource
35
+ branch
37
36
  );
38
37
 
39
38
  if (!config || !config[PROJECT_COMPONENT_TYPES.PROJECTS]) {
@@ -1,5 +1,5 @@
1
1
  const { promptUser } = require('./promptUtils');
2
- const { fetchJsonFromRepository } = require('@hubspot/cli-lib/github');
2
+ const { fetchFileFromRepository } = require('@hubspot/local-dev-lib/github');
3
3
  const { i18n } = require('../lang');
4
4
  const { HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH } = require('../constants');
5
5
  const { PROJECT_COMPONENT_TYPES } = require('../constants');
@@ -7,7 +7,7 @@ const { PROJECT_COMPONENT_TYPES } = require('../constants');
7
7
  const i18nKey = 'cli.lib.prompts.projectAddPrompt';
8
8
 
9
9
  const createTypeOptions = async projectComponentsVersion => {
10
- const config = await fetchJsonFromRepository(
10
+ const config = await fetchFileFromRepository(
11
11
  HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH,
12
12
  'config.json',
13
13
  projectComponentsVersion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "5.1.4-beta.4",
3
+ "version": "5.1.4-beta.6",
4
4
  "description": "CLI for working with HubSpot",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -9,8 +9,8 @@
9
9
  },
10
10
  "dependencies": {
11
11
  "@hubspot/cli-lib": "^9.0.0",
12
- "@hubspot/local-dev-lib": "^0.3.9",
13
- "@hubspot/serverless-dev-runtime": "5.1.4-beta.4",
12
+ "@hubspot/local-dev-lib": "^0.3.10",
13
+ "@hubspot/serverless-dev-runtime": "5.1.4-beta.6",
14
14
  "@hubspot/theme-preview-dev-server": "0.0.4",
15
15
  "@hubspot/ui-extensions-dev-server": "0.8.11",
16
16
  "archiver": "^5.3.0",
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "ae2685fbfe44d8f2570787b9e1f818202c98f70a"
49
+ "gitHead": "9879ca31bcd37ca2c3b9f6d4d81fa69443d5dca4"
50
50
  }