@hubspot/cli 5.1.4-beta.5 → 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.
- package/commands/create/api-sample.js +10 -15
- package/commands/create/app.js +5 -8
- package/commands/create/react-app.js +5 -8
- package/commands/create/vue-app.js +5 -8
- package/commands/create/webpack-serverless.js +5 -8
- package/commands/create/website-theme.js +8 -14
- package/commands/project/add.js +1 -1
- package/commands/project/create.js +1 -1
- package/lang/en.lyaml +0 -1
- package/lib/projects.js +7 -13
- package/lib/prompts/createProjectPrompt.js +3 -4
- package/lib/prompts/projectAddPrompt.js +2 -2
- package/package.json +4 -4
|
@@ -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 {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
|
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
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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`);
|
package/commands/create/app.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
const {
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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 {
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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 {
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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 {
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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 {
|
|
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
|
|
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.
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
options
|
|
24
|
-
);
|
|
14
|
+
cloneGithubRepo('HubSpot/cms-theme-boilerplate', dest, {
|
|
15
|
+
type: assetType,
|
|
16
|
+
sourceDir: 'src',
|
|
17
|
+
...options,
|
|
18
|
+
});
|
|
25
19
|
},
|
|
26
20
|
};
|
package/commands/project/add.js
CHANGED
|
@@ -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/
|
|
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/
|
|
22
|
+
const { fetchReleaseData } = require('@hubspot/local-dev-lib/github');
|
|
23
23
|
|
|
24
24
|
const i18nKey = 'cli.commands.project.subcommands.create';
|
|
25
25
|
|
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:
|
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 {
|
|
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
|
|
140
|
+
await downloadGithubRepoContents(
|
|
141
141
|
templateSource || HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH,
|
|
142
142
|
template.path,
|
|
143
143
|
projectPath,
|
|
144
|
-
hasCustomTemplateSource ?
|
|
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
|
-
|
|
385
|
-
accountIdentifier,
|
|
386
|
-
projectName,
|
|
387
|
-
}),
|
|
388
|
-
});
|
|
383
|
+
SpinniesManager.fail('upload');
|
|
384
|
+
logApiErrorInstance(err);
|
|
389
385
|
|
|
390
386
|
error = err;
|
|
391
387
|
}
|
|
@@ -861,13 +857,11 @@ const createProjectComponent = async (
|
|
|
861
857
|
componentName
|
|
862
858
|
);
|
|
863
859
|
|
|
864
|
-
await
|
|
860
|
+
await downloadGithubRepoContents(
|
|
865
861
|
HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH,
|
|
866
862
|
component.path,
|
|
867
863
|
componentPath,
|
|
868
|
-
|
|
869
|
-
ref: projectComponentsVersion,
|
|
870
|
-
}
|
|
864
|
+
projectComponentsVersion
|
|
871
865
|
);
|
|
872
866
|
};
|
|
873
867
|
|
|
@@ -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 {
|
|
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
|
|
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 {
|
|
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
|
|
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.
|
|
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.
|
|
13
|
-
"@hubspot/serverless-dev-runtime": "5.1.4-beta.
|
|
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": "
|
|
49
|
+
"gitHead": "9879ca31bcd37ca2c3b9f6d4d81fa69443d5dca4"
|
|
50
50
|
}
|