@hubspot/cli 5.3.0 → 5.4.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.
- package/bin/cli.js +24 -5
- package/bin/hs +1 -1
- package/commands/cms/convertFields.js +13 -7
- package/commands/project/add.js +24 -12
- package/commands/project/cloneApp.js +10 -5
- package/commands/project/dev.js +7 -5
- package/commands/project/download.js +2 -2
- package/commands/project/migrateApp.js +5 -3
- package/lang/en.lyaml +15 -5
- package/lib/localDev.js +25 -10
- package/lib/projects.js +14 -1
- package/lib/prompts/projectAddPrompt.js +4 -21
- package/package.json +3 -3
package/bin/cli.js
CHANGED
|
@@ -15,6 +15,8 @@ const {
|
|
|
15
15
|
const { getIsInProject } = require('../lib/projects');
|
|
16
16
|
const pkg = require('../package.json');
|
|
17
17
|
const { i18n } = require('../lib/lang');
|
|
18
|
+
const { EXIT_CODES } = require('../lib/enums/exitCodes');
|
|
19
|
+
const { UI_COLORS, uiCommandReference } = require('../lib/ui');
|
|
18
20
|
|
|
19
21
|
const removeCommand = require('../commands/remove');
|
|
20
22
|
const initCommand = require('../commands/init');
|
|
@@ -41,7 +43,6 @@ const accountsCommand = require('../commands/accounts');
|
|
|
41
43
|
const sandboxesCommand = require('../commands/sandbox');
|
|
42
44
|
const cmsCommand = require('../commands/cms');
|
|
43
45
|
const feedbackCommand = require('../commands/feedback');
|
|
44
|
-
const { EXIT_CODES } = require('../lib/enums/exitCodes');
|
|
45
46
|
|
|
46
47
|
const notifier = updateNotifier({
|
|
47
48
|
pkg: { ...pkg, name: '@hubspot/cli' },
|
|
@@ -51,12 +52,30 @@ const notifier = updateNotifier({
|
|
|
51
52
|
|
|
52
53
|
const i18nKey = 'commands.generalErrors';
|
|
53
54
|
|
|
54
|
-
const
|
|
55
|
-
chalk.bold('The CMS CLI is now the HubSpot CLI') +
|
|
56
|
-
'\n\nTo upgrade, run:\n\nnpm uninstall -g @hubspot/cms-cli\nand npm install -g @hubspot/cli';
|
|
55
|
+
const CMS_CLI_PACKAGE_NAME = '@hubspot/cms-cli';
|
|
57
56
|
|
|
58
57
|
notifier.notify({
|
|
59
|
-
message:
|
|
58
|
+
message:
|
|
59
|
+
pkg.name === CMS_CLI_PACKAGE_NAME
|
|
60
|
+
? i18n(`${i18nKey}.updateNotify.cmsUpdateNotification`, {
|
|
61
|
+
packageName: CMS_CLI_PACKAGE_NAME,
|
|
62
|
+
updateCommand: uiCommandReference('{updateCommand}'),
|
|
63
|
+
})
|
|
64
|
+
: i18n(`${i18nKey}.updateNotify.cliUpdateNotification`, {
|
|
65
|
+
updateCommand: uiCommandReference('{updateCommand}'),
|
|
66
|
+
}),
|
|
67
|
+
defer: false,
|
|
68
|
+
boxenOptions: {
|
|
69
|
+
borderColor: UI_COLORS.MARIGOLD_DARK,
|
|
70
|
+
margin: 1,
|
|
71
|
+
padding: 1,
|
|
72
|
+
textAlignment: 'center',
|
|
73
|
+
borderStyle: 'round',
|
|
74
|
+
title:
|
|
75
|
+
pkg.name === CMS_CLI_PACKAGE_NAME
|
|
76
|
+
? null
|
|
77
|
+
: chalk.bold(i18n(`${i18nKey}.updateNotify.notifyTitle`)),
|
|
78
|
+
},
|
|
60
79
|
});
|
|
61
80
|
|
|
62
81
|
const getTerminalWidth = () => {
|
package/bin/hs
CHANGED
|
@@ -13,6 +13,7 @@ const {
|
|
|
13
13
|
|
|
14
14
|
const { trackConvertFieldsUsage } = require('../../lib/usageTracking');
|
|
15
15
|
const { logErrorInstance } = require('../../lib/errorHandlers/standardErrors');
|
|
16
|
+
const { EXIT_CODES } = require('../../lib/enums/exitCodes');
|
|
16
17
|
const i18nKey = 'commands.convertFields';
|
|
17
18
|
|
|
18
19
|
exports.command = 'convert-fields';
|
|
@@ -24,23 +25,27 @@ const invalidPath = src => {
|
|
|
24
25
|
path: src,
|
|
25
26
|
})
|
|
26
27
|
);
|
|
28
|
+
process.exit(EXIT_CODES.ERROR);
|
|
27
29
|
};
|
|
28
30
|
|
|
29
31
|
exports.handler = async options => {
|
|
30
|
-
const src = path.resolve(getCwd(), options.src);
|
|
31
|
-
const themeJSONPath = getThemeJSONPath(src);
|
|
32
|
-
const projectRoot = themeJSONPath
|
|
33
|
-
? path.dirname(themeJSONPath)
|
|
34
|
-
: path.dirname(getCwd());
|
|
35
32
|
let stats;
|
|
33
|
+
let projectRoot;
|
|
34
|
+
let src;
|
|
35
|
+
|
|
36
36
|
try {
|
|
37
|
+
src = path.resolve(getCwd(), options.src);
|
|
38
|
+
const themeJSONPath = getThemeJSONPath(options.src);
|
|
39
|
+
projectRoot = themeJSONPath
|
|
40
|
+
? path.dirname(themeJSONPath)
|
|
41
|
+
: path.dirname(getCwd());
|
|
37
42
|
stats = fs.statSync(src);
|
|
38
43
|
if (!stats.isFile() && !stats.isDirectory()) {
|
|
39
|
-
invalidPath(src);
|
|
44
|
+
invalidPath(options.src);
|
|
40
45
|
return;
|
|
41
46
|
}
|
|
42
47
|
} catch (e) {
|
|
43
|
-
invalidPath(src);
|
|
48
|
+
invalidPath(options.src);
|
|
44
49
|
}
|
|
45
50
|
|
|
46
51
|
trackConvertFieldsUsage('process');
|
|
@@ -88,6 +93,7 @@ exports.builder = yargs => {
|
|
|
88
93
|
yargs.option('src', {
|
|
89
94
|
describe: i18n(`${i18nKey}.positionals.src.describe`),
|
|
90
95
|
type: 'string',
|
|
96
|
+
demandOption: i18n(`${i18nKey}.errors.missingSrc`),
|
|
91
97
|
});
|
|
92
98
|
yargs.option('fieldOptions', {
|
|
93
99
|
describe: i18n(`${i18nKey}.options.options.describe`),
|
package/commands/project/add.js
CHANGED
|
@@ -6,7 +6,10 @@ const { fetchReleaseData } = require('@hubspot/local-dev-lib/github');
|
|
|
6
6
|
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
7
7
|
const { i18n } = require('../../lib/lang');
|
|
8
8
|
const { projectAddPrompt } = require('../../lib/prompts/projectAddPrompt');
|
|
9
|
-
const {
|
|
9
|
+
const {
|
|
10
|
+
createProjectComponent,
|
|
11
|
+
getProjectComponentsByVersion,
|
|
12
|
+
} = require('../../lib/projects');
|
|
10
13
|
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
11
14
|
const { uiBetaTag } = require('../../lib/ui');
|
|
12
15
|
const {
|
|
@@ -21,34 +24,37 @@ exports.describe = uiBetaTag(i18n(`${i18nKey}.describe`), false);
|
|
|
21
24
|
exports.handler = async options => {
|
|
22
25
|
await loadAndValidateOptions(options);
|
|
23
26
|
|
|
24
|
-
const accountId = getAccountId(options);
|
|
25
|
-
|
|
26
27
|
logger.log('');
|
|
27
28
|
logger.log(i18n(`${i18nKey}.creatingComponent.message`));
|
|
28
29
|
logger.log('');
|
|
29
30
|
|
|
31
|
+
const accountId = getAccountId(options);
|
|
32
|
+
|
|
30
33
|
const releaseData = await fetchReleaseData(
|
|
31
34
|
HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH
|
|
32
35
|
);
|
|
33
36
|
const projectComponentsVersion = releaseData.tag_name;
|
|
34
37
|
|
|
35
|
-
const
|
|
36
|
-
projectComponentsVersion
|
|
37
|
-
options
|
|
38
|
+
const components = await getProjectComponentsByVersion(
|
|
39
|
+
projectComponentsVersion
|
|
38
40
|
);
|
|
39
41
|
|
|
42
|
+
let { component, name } = await projectAddPrompt(components, options);
|
|
43
|
+
|
|
44
|
+
name = name || options.name;
|
|
45
|
+
|
|
46
|
+
if (!component) {
|
|
47
|
+
component = components.find(t => t.path === options.type);
|
|
48
|
+
}
|
|
49
|
+
|
|
40
50
|
trackCommandUsage('project-add', null, accountId);
|
|
41
51
|
|
|
42
52
|
try {
|
|
43
|
-
await createProjectComponent(
|
|
44
|
-
options.type || type,
|
|
45
|
-
options.name || name,
|
|
46
|
-
projectComponentsVersion
|
|
47
|
-
);
|
|
53
|
+
await createProjectComponent(component, name, projectComponentsVersion);
|
|
48
54
|
logger.log('');
|
|
49
55
|
logger.log(
|
|
50
56
|
i18n(`${i18nKey}.success.message`, {
|
|
51
|
-
componentName:
|
|
57
|
+
componentName: name,
|
|
52
58
|
})
|
|
53
59
|
);
|
|
54
60
|
} catch (error) {
|
|
@@ -69,6 +75,12 @@ exports.builder = yargs => {
|
|
|
69
75
|
});
|
|
70
76
|
|
|
71
77
|
yargs.example([['$0 project add', i18n(`${i18nKey}.examples.default`)]]);
|
|
78
|
+
yargs.example([
|
|
79
|
+
[
|
|
80
|
+
'$0 project add --name="my-component" --type="components/example-app"',
|
|
81
|
+
i18n(`${i18nKey}.examples.withFlags`),
|
|
82
|
+
],
|
|
83
|
+
]);
|
|
72
84
|
|
|
73
85
|
return yargs;
|
|
74
86
|
};
|
|
@@ -38,7 +38,7 @@ const {
|
|
|
38
38
|
checkCloneStatus,
|
|
39
39
|
downloadClonedProject,
|
|
40
40
|
} = require('@hubspot/local-dev-lib/api/projects');
|
|
41
|
-
const { getCwd } = require('@hubspot/local-dev-lib/path');
|
|
41
|
+
const { getCwd, sanitizeFileName } = require('@hubspot/local-dev-lib/path');
|
|
42
42
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
43
43
|
const { getAccountConfig } = require('@hubspot/local-dev-lib/config');
|
|
44
44
|
const { extractZipArchive } = require('@hubspot/local-dev-lib/archive');
|
|
@@ -119,10 +119,15 @@ exports.handler = async options => {
|
|
|
119
119
|
|
|
120
120
|
// Extract zipped app files and place them in correct directory
|
|
121
121
|
const zippedApp = await downloadClonedProject(accountId, exportId);
|
|
122
|
-
await extractZipArchive(
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
await extractZipArchive(
|
|
123
|
+
zippedApp,
|
|
124
|
+
sanitizeFileName(name),
|
|
125
|
+
absoluteDestPath,
|
|
126
|
+
{
|
|
127
|
+
includesRootDir: true,
|
|
128
|
+
hideLogs: true,
|
|
129
|
+
}
|
|
130
|
+
);
|
|
126
131
|
|
|
127
132
|
// Create hsproject.json file
|
|
128
133
|
const configPath = path.join(baseDestPath, PROJECT_CONFIG_FILE);
|
package/commands/project/dev.js
CHANGED
|
@@ -46,12 +46,12 @@ const {
|
|
|
46
46
|
confirmDefaultAccountIsTarget,
|
|
47
47
|
suggestRecommendedNestedAccount,
|
|
48
48
|
checkIfAppDeveloperAccount,
|
|
49
|
-
checkIfDeveloperTestAccount,
|
|
50
49
|
createSandboxForLocalDev,
|
|
51
50
|
createDeveloperTestAccountForLocalDev,
|
|
52
51
|
createNewProjectForLocalDev,
|
|
53
52
|
createInitialBuildForNewProject,
|
|
54
53
|
useExistingDevTestAccount,
|
|
54
|
+
validateAccountOption,
|
|
55
55
|
} = require('../../lib/localDev');
|
|
56
56
|
|
|
57
57
|
const i18nKey = 'commands.project.subcommands.dev';
|
|
@@ -106,10 +106,12 @@ exports.handler = async options => {
|
|
|
106
106
|
// The account that we are locally testing against
|
|
107
107
|
let targetTestingAccountId = options.account ? accountId : null;
|
|
108
108
|
|
|
109
|
-
if (options.account
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
if (options.account) {
|
|
110
|
+
validateAccountOption(accountConfig, hasPublicApps);
|
|
111
|
+
|
|
112
|
+
if (hasPublicApps) {
|
|
113
|
+
targetProjectAccountId = accountConfig.parentAccountId;
|
|
114
|
+
}
|
|
113
115
|
}
|
|
114
116
|
|
|
115
117
|
let createNewSandbox = false;
|
|
@@ -6,7 +6,7 @@ const {
|
|
|
6
6
|
addUseEnvironmentOptions,
|
|
7
7
|
} = require('../../lib/commonOpts');
|
|
8
8
|
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
9
|
-
const { getCwd } = require('@hubspot/local-dev-lib/path');
|
|
9
|
+
const { getCwd, sanitizeFileName } = require('@hubspot/local-dev-lib/path');
|
|
10
10
|
const {
|
|
11
11
|
logApiErrorInstance,
|
|
12
12
|
ApiErrorContext,
|
|
@@ -95,7 +95,7 @@ exports.handler = async options => {
|
|
|
95
95
|
|
|
96
96
|
await extractZipArchive(
|
|
97
97
|
zippedProject,
|
|
98
|
-
projectName,
|
|
98
|
+
sanitizeFileName(projectName),
|
|
99
99
|
path.resolve(absoluteDestPath),
|
|
100
100
|
{ includesRootDir: false }
|
|
101
101
|
);
|
|
@@ -39,7 +39,7 @@ const {
|
|
|
39
39
|
migrateApp,
|
|
40
40
|
checkMigrationStatus,
|
|
41
41
|
} = require('@hubspot/local-dev-lib/api/projects');
|
|
42
|
-
const { getCwd } = require('@hubspot/local-dev-lib/path');
|
|
42
|
+
const { getCwd, sanitizeFileName } = require('@hubspot/local-dev-lib/path');
|
|
43
43
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
44
44
|
const { getAccountConfig } = require('@hubspot/local-dev-lib/config');
|
|
45
45
|
const { downloadProject } = require('@hubspot/local-dev-lib/api/projects');
|
|
@@ -186,7 +186,7 @@ exports.handler = async options => {
|
|
|
186
186
|
|
|
187
187
|
await extractZipArchive(
|
|
188
188
|
zippedProject,
|
|
189
|
-
projectName,
|
|
189
|
+
sanitizeFileName(projectName),
|
|
190
190
|
path.resolve(absoluteDestPath),
|
|
191
191
|
{ includesRootDir: true, hideLogs: true }
|
|
192
192
|
);
|
|
@@ -209,7 +209,9 @@ exports.handler = async options => {
|
|
|
209
209
|
logger.log(
|
|
210
210
|
uiLink(
|
|
211
211
|
i18n(`${i18nKey}.projectDetailsLink`),
|
|
212
|
-
`${baseUrl}/developer-projects/${accountId}/project/${
|
|
212
|
+
`${baseUrl}/developer-projects/${accountId}/project/${encodeURIComponent(
|
|
213
|
+
project.name
|
|
214
|
+
)}`
|
|
213
215
|
)
|
|
214
216
|
);
|
|
215
217
|
process.exit(EXIT_CODES.SUCCESS);
|
package/lang/en.lyaml
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
en:
|
|
2
2
|
commands:
|
|
3
3
|
generalErrors:
|
|
4
|
+
updateNotify:
|
|
5
|
+
notifyTitle: "Update available"
|
|
6
|
+
cmsUpdateNotification: "{{#bold}}The CMS CLI is now the HubSpot CLI{{/bold}}\n\nTo upgrade, uninstall {{#bold}}{{ packageName }}{{/bold}}\nand then run {{ updateCommand }}"
|
|
7
|
+
cliUpdateNotification: "HubSpot CLI version {{#cyan}}{{#bold}}{currentVersion}{{/bold}}{{/cyan}} is outdated.\nRun {{ updateCommand }} to upgrade to version {{#cyan}}{{#bold}}{latestVersion}{{/bold}}{{/cyan}}"
|
|
4
8
|
srcIsProject: "\"{{ src }}\" is in a project folder. Did you mean \"hs project {{command}}\"?"
|
|
5
9
|
setDefaultAccountMoved: "This command has moved. Try `hs accounts use` instead"
|
|
6
10
|
accounts:
|
|
@@ -550,9 +554,9 @@ en:
|
|
|
550
554
|
describe: "Create a new component within a project"
|
|
551
555
|
options:
|
|
552
556
|
name:
|
|
553
|
-
describe: "
|
|
557
|
+
describe: "The name for your newly created component"
|
|
554
558
|
type:
|
|
555
|
-
describe: "The type
|
|
559
|
+
describe: "The path to the component type's location within the hubspot-project-components Github repo: https://github.com/HubSpot/hubspot-project-components"
|
|
556
560
|
creatingComponent:
|
|
557
561
|
message: "Adding a new component to your project"
|
|
558
562
|
success:
|
|
@@ -561,6 +565,7 @@ en:
|
|
|
561
565
|
locationInProject: "The component location must be within a project folder"
|
|
562
566
|
examples:
|
|
563
567
|
default: "Create a component within your project"
|
|
568
|
+
withFlags: "Use --name and --type flags to bypass the prompt."
|
|
564
569
|
deploy:
|
|
565
570
|
describe: "Deploy a project build"
|
|
566
571
|
debug:
|
|
@@ -964,6 +969,10 @@ en:
|
|
|
964
969
|
options:
|
|
965
970
|
options:
|
|
966
971
|
describe: "Options to pass to javascript fields files"
|
|
972
|
+
errors:
|
|
973
|
+
invalidPath: "The path \"{{ path }}\" specified in the \"--src\" flag is not a path to a file or directory"
|
|
974
|
+
missingSrc: "Please specify the path to your javascript fields file or directory with the --src flag."
|
|
975
|
+
|
|
967
976
|
lib:
|
|
968
977
|
process:
|
|
969
978
|
exitDebug: "Attempting to gracefully exit. Triggered by {{ signal }}"
|
|
@@ -1009,9 +1018,10 @@ en:
|
|
|
1009
1018
|
localDev:
|
|
1010
1019
|
confirmDefaultAccountIsTarget:
|
|
1011
1020
|
declineDefaultAccountExplanation: "To develop on a different account, run {{ useCommand }} to change your default account, then re-run {{ devCommand }}."
|
|
1012
|
-
checkIfAppDevloperAccount: "This project contains a public app. Local development of public apps is only supported on developer accounts and developer test accounts. Change your default account using {{
|
|
1013
|
-
|
|
1014
|
-
|
|
1021
|
+
checkIfAppDevloperAccount: "This project contains a public app. Local development of public apps is only supported on developer accounts and developer test accounts. Change your default account using {{ useCommand }}, or link a new account with {{ authCommand }}."
|
|
1022
|
+
validateAccountOption:
|
|
1023
|
+
invalidPublicAppAccount: "This project contains a public app. The \"--account\" flag must point to a developer test account to develop this project locally. Alternatively, change your default account to an App Developer Account using {{ useCommand }} and run {{ devCommand }} to set up a new Developer Test Account."
|
|
1024
|
+
invalidPrivateAppAccount: "This project contains a private app. The account specified with the \"--account\" flag points to a developer account, which do not support the local development of private apps. Update the \"--account\" flag to point to a standard, sandbox, or developer test account, or change your default account by running {{ useCommand }}."
|
|
1015
1025
|
nonSandboxWarning: "Testing in a sandbox is strongly recommended. To switch the target account, select an option below or run {{#bold}}`hs accounts use`{{/bold}} before running the command again."
|
|
1016
1026
|
publicAppNonDeveloperTestAccountWarning: "Local development of public apps is only supported in {{#bold}}developer test accounts{{/bold}}."
|
|
1017
1027
|
privateAppInAppDeveloperAccountError: "Local development of private apps is not supported in {{#bold}}app developer accounts{{/bold}}"
|
package/lib/localDev.js
CHANGED
|
@@ -85,15 +85,32 @@ const confirmDefaultAccountIsTarget = async accountConfig => {
|
|
|
85
85
|
// Confirm the default account is a developer account if developing public apps
|
|
86
86
|
const checkIfAppDeveloperAccount = accountConfig => {
|
|
87
87
|
if (!isAppDeveloperAccount(accountConfig)) {
|
|
88
|
-
logger.error(
|
|
88
|
+
logger.error(
|
|
89
|
+
i18n(`${i18nKey}.checkIfAppDevloperAccount`, {
|
|
90
|
+
useCommand: uiCommandReference('hs accounts use'),
|
|
91
|
+
authCommand: uiCommandReference('hs auth'),
|
|
92
|
+
})
|
|
93
|
+
);
|
|
89
94
|
process.exit(EXIT_CODES.SUCCESS);
|
|
90
95
|
}
|
|
91
96
|
};
|
|
92
97
|
|
|
93
98
|
// Confirm the default account is a developer account if developing public apps
|
|
94
|
-
const
|
|
95
|
-
if (!isDeveloperTestAccount(accountConfig)) {
|
|
96
|
-
logger.error(
|
|
99
|
+
const validateAccountOption = (accountConfig, hasPublicApps) => {
|
|
100
|
+
if (hasPublicApps && !isDeveloperTestAccount(accountConfig)) {
|
|
101
|
+
logger.error(
|
|
102
|
+
i18n(`${i18nKey}.validateAccountOption.invalidPublicAppAccount`, {
|
|
103
|
+
useCommand: uiCommandReference('hs accounts use'),
|
|
104
|
+
devCommand: uiCommandReference('hs project dev'),
|
|
105
|
+
})
|
|
106
|
+
);
|
|
107
|
+
process.exit(EXIT_CODES.SUCCESS);
|
|
108
|
+
} else if (isAppDeveloperAccount(accountConfig)) {
|
|
109
|
+
logger.error(
|
|
110
|
+
i18n(`${i18nKey}.validateAccountOption.invalidPrivateAppAccount`, {
|
|
111
|
+
useCommand: uiCommandReference('hs accounts use'),
|
|
112
|
+
})
|
|
113
|
+
);
|
|
97
114
|
process.exit(EXIT_CODES.SUCCESS);
|
|
98
115
|
}
|
|
99
116
|
};
|
|
@@ -109,20 +126,18 @@ const suggestRecommendedNestedAccount = async (
|
|
|
109
126
|
if (hasPublicApps) {
|
|
110
127
|
logger.log(
|
|
111
128
|
i18n(
|
|
112
|
-
`${i18nKey}.
|
|
129
|
+
`${i18nKey}.validateAccountOption.publicAppNonDeveloperTestAccountWarning`
|
|
113
130
|
)
|
|
114
131
|
);
|
|
115
132
|
} else if (isAppDeveloperAccount(accountConfig)) {
|
|
116
133
|
logger.error(
|
|
117
134
|
i18n(
|
|
118
|
-
`${i18nKey}.
|
|
135
|
+
`${i18nKey}.validateAccountOption.privateAppInAppDeveloperAccountError`
|
|
119
136
|
)
|
|
120
137
|
);
|
|
121
138
|
process.exit(EXIT_CODES.ERROR);
|
|
122
139
|
} else {
|
|
123
|
-
logger.log(
|
|
124
|
-
i18n(`${i18nKey}.suggestRecommendedNestedAccount.nonSandboxWarning`)
|
|
125
|
-
);
|
|
140
|
+
logger.log(i18n(`${i18nKey}.validateAccountOption.nonSandboxWarning`));
|
|
126
141
|
}
|
|
127
142
|
uiLine();
|
|
128
143
|
logger.log();
|
|
@@ -439,7 +454,7 @@ const getAccountHomeUrl = accountId => {
|
|
|
439
454
|
module.exports = {
|
|
440
455
|
confirmDefaultAccountIsTarget,
|
|
441
456
|
checkIfAppDeveloperAccount,
|
|
442
|
-
|
|
457
|
+
validateAccountOption,
|
|
443
458
|
suggestRecommendedNestedAccount,
|
|
444
459
|
createSandboxForLocalDev,
|
|
445
460
|
createDeveloperTestAccountForLocalDev,
|
package/lib/projects.js
CHANGED
|
@@ -7,6 +7,7 @@ const findup = require('findup-sync');
|
|
|
7
7
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
8
8
|
const { getEnv } = require('@hubspot/local-dev-lib/config');
|
|
9
9
|
const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
|
|
10
|
+
const { fetchFileFromRepository } = require('@hubspot/local-dev-lib/github');
|
|
10
11
|
const {
|
|
11
12
|
ENVIRONMENTS,
|
|
12
13
|
} = require('@hubspot/local-dev-lib/constants/environments');
|
|
@@ -18,6 +19,8 @@ const {
|
|
|
18
19
|
PROJECT_CONFIG_FILE,
|
|
19
20
|
PROJECT_TASK_TYPES,
|
|
20
21
|
PROJECT_ERROR_TYPES,
|
|
22
|
+
HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH,
|
|
23
|
+
PROJECT_COMPONENT_TYPES,
|
|
21
24
|
} = require('./constants');
|
|
22
25
|
const {
|
|
23
26
|
createProject,
|
|
@@ -46,7 +49,6 @@ const {
|
|
|
46
49
|
logApiErrorInstance,
|
|
47
50
|
ApiErrorContext,
|
|
48
51
|
} = require('./errorHandlers/apiErrors');
|
|
49
|
-
const { HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH } = require('./constants');
|
|
50
52
|
|
|
51
53
|
const i18nKey = 'lib.projects';
|
|
52
54
|
|
|
@@ -1002,6 +1004,16 @@ const displayWarnLogs = async (
|
|
|
1002
1004
|
}
|
|
1003
1005
|
};
|
|
1004
1006
|
|
|
1007
|
+
const getProjectComponentsByVersion = async projectComponentsVersion => {
|
|
1008
|
+
const config = await fetchFileFromRepository(
|
|
1009
|
+
HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH,
|
|
1010
|
+
'config.json',
|
|
1011
|
+
projectComponentsVersion
|
|
1012
|
+
);
|
|
1013
|
+
|
|
1014
|
+
return config[PROJECT_COMPONENT_TYPES.COMPONENTS];
|
|
1015
|
+
};
|
|
1016
|
+
|
|
1005
1017
|
module.exports = {
|
|
1006
1018
|
writeProjectConfig,
|
|
1007
1019
|
getProjectConfig,
|
|
@@ -1019,4 +1031,5 @@ module.exports = {
|
|
|
1019
1031
|
logFeedbackMessage,
|
|
1020
1032
|
createProjectComponent,
|
|
1021
1033
|
displayWarnLogs,
|
|
1034
|
+
getProjectComponentsByVersion,
|
|
1022
1035
|
};
|
|
@@ -1,32 +1,15 @@
|
|
|
1
1
|
const { promptUser } = require('./promptUtils');
|
|
2
|
-
const { fetchFileFromRepository } = require('@hubspot/local-dev-lib/github');
|
|
3
2
|
const { i18n } = require('../lang');
|
|
4
|
-
const { HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH } = require('../constants');
|
|
5
|
-
const { PROJECT_COMPONENT_TYPES } = require('../constants');
|
|
6
3
|
|
|
7
4
|
const i18nKey = 'lib.prompts.projectAddPrompt';
|
|
8
5
|
|
|
9
|
-
const
|
|
10
|
-
const config = await fetchFileFromRepository(
|
|
11
|
-
HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH,
|
|
12
|
-
'config.json',
|
|
13
|
-
projectComponentsVersion
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
return config[PROJECT_COMPONENT_TYPES.COMPONENTS];
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const projectAddPrompt = async (
|
|
20
|
-
projectComponentsVersion,
|
|
21
|
-
promptOptions = {}
|
|
22
|
-
) => {
|
|
23
|
-
const components = await createTypeOptions(projectComponentsVersion);
|
|
6
|
+
const projectAddPrompt = async (components, promptOptions = {}) => {
|
|
24
7
|
return promptUser([
|
|
25
8
|
{
|
|
26
|
-
name: '
|
|
9
|
+
name: 'component',
|
|
27
10
|
message: () => {
|
|
28
11
|
return promptOptions.type &&
|
|
29
|
-
!components.find(t => t.path === promptOptions.type
|
|
12
|
+
!components.find(t => t.path === promptOptions.type)
|
|
30
13
|
? i18n(`${i18nKey}.errors.invalidType`, {
|
|
31
14
|
type: promptOptions.type,
|
|
32
15
|
})
|
|
@@ -34,7 +17,7 @@ const projectAddPrompt = async (
|
|
|
34
17
|
},
|
|
35
18
|
when:
|
|
36
19
|
!promptOptions.type ||
|
|
37
|
-
!components.find(t => t.path === promptOptions.type
|
|
20
|
+
!components.find(t => t.path === promptOptions.type),
|
|
38
21
|
type: 'list',
|
|
39
22
|
choices: components.map(type => {
|
|
40
23
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cli",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0",
|
|
4
4
|
"description": "CLI for working with HubSpot",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"@hubspot/local-dev-lib": "1.10.0",
|
|
12
12
|
"@hubspot/serverless-dev-runtime": "5.3.0",
|
|
13
13
|
"@hubspot/theme-preview-dev-server": "0.0.7",
|
|
14
|
-
"@hubspot/ui-extensions-dev-server": "0.8.
|
|
14
|
+
"@hubspot/ui-extensions-dev-server": "0.8.30",
|
|
15
15
|
"archiver": "^5.3.0",
|
|
16
16
|
"chalk": "^4.1.2",
|
|
17
17
|
"chokidar": "^3.0.1",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "eb76ce9051e5f44c45e8c763930439c168a489ec"
|
|
50
50
|
}
|