@hubspot/cli 5.1.4-beta.5 → 5.1.4-beta.7

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
 
@@ -125,12 +125,33 @@ exports.handler = async options => {
125
125
 
126
126
  // Upload all files if no build exists for this project yet
127
127
  if (initialUpload || hasNoBuilds) {
128
- await handleProjectUpload(
128
+ const result = await handleProjectUpload(
129
129
  accountId,
130
130
  projectConfig,
131
131
  projectDir,
132
132
  startWatching
133
133
  );
134
+
135
+ if (result.uploadError) {
136
+ if (
137
+ isSpecifiedError(result.uploadError, {
138
+ subCategory: PROJECT_ERROR_TYPES.PROJECT_LOCKED,
139
+ })
140
+ ) {
141
+ logger.log();
142
+ logger.error(i18n(`${i18nKey}.errors.projectLockedError`));
143
+ logger.log();
144
+ } else {
145
+ logApiErrorInstance(
146
+ result.uploadError,
147
+ new ApiErrorContext({
148
+ accountId,
149
+ projectName: projectConfig.name,
150
+ })
151
+ );
152
+ }
153
+ process.exit(EXIT_CODES.ERROR);
154
+ }
134
155
  } else {
135
156
  await startWatching();
136
157
  }
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, {
@@ -861,13 +861,11 @@ const createProjectComponent = async (
861
861
  componentName
862
862
  );
863
863
 
864
- await downloadGitHubRepoContents(
864
+ await downloadGithubRepoContents(
865
865
  HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH,
866
866
  component.path,
867
867
  componentPath,
868
- {
869
- ref: projectComponentsVersion,
870
- }
868
+ projectComponentsVersion
871
869
  );
872
870
  };
873
871
 
@@ -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.5",
3
+ "version": "5.1.4-beta.7",
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": "dc62da1131e837df474dcac43252f3b1f67139f5"
49
+ "gitHead": "8e157c07923d5efa727a44f7ac542e9d13eac113"
50
50
  }