@hubspot/cli 5.2.1-beta.2 → 5.2.1-beta.3
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 +1 -1
- package/commands/accounts/clean.js +3 -3
- package/commands/accounts/info.js +1 -1
- package/commands/accounts/list.js +1 -1
- package/commands/accounts/remove.js +1 -1
- package/commands/accounts/rename.js +1 -1
- package/commands/accounts/use.js +1 -1
- package/commands/accounts.js +1 -1
- package/commands/auth.js +3 -3
- package/commands/cms/convertFields.js +1 -1
- package/commands/cms/lighthouseScore.js +1 -1
- package/commands/cms/reactModules.js +1 -1
- package/commands/cms.js +1 -1
- package/commands/config/set/allowUsageTracking.js +1 -2
- package/commands/config/set/defaultMode.js +1 -1
- package/commands/config/set/httpTimeout.js +1 -1
- package/commands/config/set.js +1 -1
- package/commands/config.js +1 -1
- package/commands/create/api-sample.js +1 -1
- package/commands/create/module.js +1 -1
- package/commands/create/template.js +1 -1
- package/commands/create.js +1 -1
- package/commands/customObject/create.js +1 -1
- package/commands/customObject/schema/create.js +1 -2
- package/commands/customObject/schema/delete.js +1 -2
- package/commands/customObject/schema/fetch-all.js +1 -2
- package/commands/customObject/schema/fetch.js +1 -2
- package/commands/customObject/schema/list.js +1 -1
- package/commands/customObject/schema/update.js +1 -2
- package/commands/customObject/schema.js +1 -1
- package/commands/customObject.js +1 -1
- package/commands/feedback.js +1 -1
- package/commands/fetch.js +1 -1
- package/commands/filemanager/fetch.js +1 -1
- package/commands/filemanager/upload.js +1 -1
- package/commands/filemanager.js +1 -1
- package/commands/functions/deploy.js +1 -1
- package/commands/functions/list.js +1 -1
- package/commands/functions/server.js +1 -1
- package/commands/functions.js +1 -1
- package/commands/hubdb/clear.js +1 -1
- package/commands/hubdb/create.js +1 -1
- package/commands/hubdb/delete.js +1 -1
- package/commands/hubdb/fetch.js +1 -1
- package/commands/hubdb.js +1 -1
- package/commands/init.js +1 -1
- package/commands/lint.js +1 -1
- package/commands/list.js +1 -1
- package/commands/logs.js +1 -1
- package/commands/module/marketplace-validate.js +1 -1
- package/commands/module.js +1 -1
- package/commands/mv.js +1 -1
- package/commands/open.js +1 -1
- package/commands/project/add.js +1 -1
- package/commands/project/create.js +1 -1
- package/commands/project/deploy.js +1 -1
- package/commands/project/dev.js +35 -19
- package/commands/project/download.js +9 -5
- package/commands/project/listBuilds.js +1 -1
- package/commands/project/logs.js +1 -1
- package/commands/project/open.js +8 -4
- package/commands/project/upload.js +1 -1
- package/commands/project/watch.js +1 -1
- package/commands/project.js +1 -1
- package/commands/remove.js +1 -1
- package/commands/sandbox/create.js +4 -4
- package/commands/sandbox/delete.js +1 -1
- package/commands/sandbox/sync.js +2 -2
- package/commands/sandbox.js +1 -1
- package/commands/secrets/addSecret.js +1 -1
- package/commands/secrets/deleteSecret.js +1 -1
- package/commands/secrets/listSecrets.js +1 -1
- package/commands/secrets/updateSecret.js +1 -1
- package/commands/secrets.js +1 -1
- package/commands/theme/generate-selectors.js +1 -1
- package/commands/theme/marketplace-validate.js +1 -1
- package/commands/theme/preview.js +2 -2
- package/commands/theme.js +1 -1
- package/commands/upload.js +1 -1
- package/commands/watch.js +1 -1
- package/lang/en.lyaml +1373 -1374
- package/lib/DevServerManager.js +3 -2
- package/lib/LocalDevManager.js +19 -5
- package/lib/commonOpts.js +1 -1
- package/lib/developerTestAccountCreate.js +4 -5
- package/lib/developerTestAccounts.js +1 -1
- package/lib/errorHandlers/apiErrors.js +1 -1
- package/lib/errorHandlers/overrideErrors.js +1 -1
- package/lib/errorHandlers/standardErrors.js +1 -1
- package/lib/generate-selectors.js +1 -1
- package/lib/localDev.js +8 -12
- package/lib/process.js +1 -1
- package/lib/projects.js +6 -6
- package/lib/projectsWatch.js +1 -1
- package/lib/prompts/accountsPrompt.js +1 -1
- package/lib/prompts/buildIdPrompt.js +1 -1
- package/lib/prompts/cleanUploadPrompt.js +1 -1
- package/lib/prompts/cmsFieldPrompt.js +1 -1
- package/lib/prompts/createApiSamplePrompt.js +1 -1
- package/lib/prompts/createFunctionPrompt.js +1 -1
- package/lib/prompts/createModulePrompt.js +1 -1
- package/lib/prompts/createProjectPrompt.js +1 -1
- package/lib/prompts/createTemplatePrompt.js +1 -1
- package/lib/prompts/developerTestAccountNamePrompt.js +1 -1
- package/lib/prompts/downloadProjectPrompt.js +1 -1
- package/lib/prompts/enterAccountNamePrompt.js +1 -1
- package/lib/prompts/feedbackPrompt.js +1 -1
- package/lib/prompts/folderOverwritePrompt.js +1 -1
- package/lib/prompts/personalAccessKeyPrompt.js +1 -1
- package/lib/prompts/previewPrompt.js +1 -1
- package/lib/prompts/projectAddPrompt.js +1 -1
- package/lib/prompts/projectDevTargetAccountPrompt.js +1 -1
- package/lib/prompts/projectNamePrompt.js +2 -2
- package/lib/prompts/projectsLogsPrompt.js +1 -1
- package/lib/prompts/sandboxesPrompt.js +1 -1
- package/lib/prompts/secretPrompt.js +1 -1
- package/lib/prompts/setAsDefaultAccountPrompt.js +1 -1
- package/lib/prompts/uploadPrompt.js +1 -1
- package/lib/sandboxCreate.js +4 -5
- package/lib/sandboxSync.js +1 -1
- package/lib/sandboxes.js +7 -9
- package/lib/ui/git.js +1 -1
- package/lib/ui/index.js +2 -2
- package/lib/ui/serverlessFunctionLogs.js +1 -1
- package/package.json +4 -4
package/lib/DevServerManager.js
CHANGED
|
@@ -15,7 +15,7 @@ const {
|
|
|
15
15
|
} = require('@hubspot/local-dev-lib/urls');
|
|
16
16
|
const { getAccountConfig } = require('@hubspot/local-dev-lib/config');
|
|
17
17
|
|
|
18
|
-
const i18nKey = '
|
|
18
|
+
const i18nKey = 'lib.DevServerManager';
|
|
19
19
|
|
|
20
20
|
const SERVER_KEYS = {
|
|
21
21
|
privateApp: 'privateApp',
|
|
@@ -71,7 +71,7 @@ class DevServerManager {
|
|
|
71
71
|
}, {});
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
async setup({ components, onUploadRequired, accountId }) {
|
|
74
|
+
async setup({ components, onUploadRequired, accountId, setActiveApp }) {
|
|
75
75
|
this.componentsByType = this.arrangeComponentsByType(components);
|
|
76
76
|
const { env } = getAccountConfig(accountId);
|
|
77
77
|
await startPortManagerServer();
|
|
@@ -87,6 +87,7 @@ class DevServerManager {
|
|
|
87
87
|
api: getHubSpotApiOrigin(env),
|
|
88
88
|
web: getHubSpotWebsiteOrigin(env),
|
|
89
89
|
},
|
|
90
|
+
setActiveApp,
|
|
90
91
|
});
|
|
91
92
|
}
|
|
92
93
|
}
|
package/lib/LocalDevManager.js
CHANGED
|
@@ -34,11 +34,14 @@ const WATCH_EVENTS = {
|
|
|
34
34
|
unlinkDir: 'unlinkDir',
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
const i18nKey = '
|
|
37
|
+
const i18nKey = 'lib.LocalDevManager';
|
|
38
38
|
|
|
39
39
|
class LocalDevManager {
|
|
40
40
|
constructor(options) {
|
|
41
41
|
this.targetAccountId = options.targetAccountId;
|
|
42
|
+
// The account that the project exists in. This is not always the targetAccountId
|
|
43
|
+
this.targetProjectAccountId = options.parentAccountId || options.accountId;
|
|
44
|
+
|
|
42
45
|
this.projectConfig = options.projectConfig;
|
|
43
46
|
this.projectDir = options.projectDir;
|
|
44
47
|
this.debug = options.debug || false;
|
|
@@ -47,6 +50,7 @@ class LocalDevManager {
|
|
|
47
50
|
this.watcher = null;
|
|
48
51
|
this.uploadWarnings = {};
|
|
49
52
|
this.runnableComponents = this.getRunnableComponents(options.components);
|
|
53
|
+
this.activeApp = null;
|
|
50
54
|
|
|
51
55
|
this.projectSourceDir = path.join(
|
|
52
56
|
this.projectDir,
|
|
@@ -80,6 +84,12 @@ class LocalDevManager {
|
|
|
80
84
|
return components.filter(component => component.runnable);
|
|
81
85
|
}
|
|
82
86
|
|
|
87
|
+
async setActiveApp(app) {
|
|
88
|
+
this.activeApp = app;
|
|
89
|
+
|
|
90
|
+
// TODO: Show the install warnings the first time this gets set
|
|
91
|
+
}
|
|
92
|
+
|
|
83
93
|
async start() {
|
|
84
94
|
SpinniesManager.stopAll();
|
|
85
95
|
SpinniesManager.init();
|
|
@@ -88,7 +98,7 @@ class LocalDevManager {
|
|
|
88
98
|
if (!this.deployedBuild) {
|
|
89
99
|
logger.error(
|
|
90
100
|
i18n(`${i18nKey}.noDeployedBuild`, {
|
|
91
|
-
accountIdentifier: uiAccountDescription(this.
|
|
101
|
+
accountIdentifier: uiAccountDescription(this.targetProjectAccountId),
|
|
92
102
|
uploadCommand: this.getUploadCommand(),
|
|
93
103
|
})
|
|
94
104
|
);
|
|
@@ -117,7 +127,10 @@ class LocalDevManager {
|
|
|
117
127
|
logger.log(
|
|
118
128
|
uiLink(
|
|
119
129
|
i18n(`${i18nKey}.viewInHubSpotLink`),
|
|
120
|
-
getProjectDetailUrl(
|
|
130
|
+
getProjectDetailUrl(
|
|
131
|
+
this.projectConfig.name,
|
|
132
|
+
this.targetProjectAccountId
|
|
133
|
+
)
|
|
121
134
|
)
|
|
122
135
|
);
|
|
123
136
|
logger.log();
|
|
@@ -177,9 +190,9 @@ class LocalDevManager {
|
|
|
177
190
|
getUploadCommand() {
|
|
178
191
|
const currentDefaultAccount = getConfigDefaultAccount();
|
|
179
192
|
|
|
180
|
-
return this.
|
|
193
|
+
return this.targetProjectAccountId !== getAccountId(currentDefaultAccount)
|
|
181
194
|
? uiCommandReference(
|
|
182
|
-
`hs project upload --account=${this.
|
|
195
|
+
`hs project upload --account=${this.targetProjectAccountId}`
|
|
183
196
|
)
|
|
184
197
|
: uiCommandReference('hs project upload');
|
|
185
198
|
}
|
|
@@ -325,6 +338,7 @@ class LocalDevManager {
|
|
|
325
338
|
components: this.runnableComponents,
|
|
326
339
|
onUploadRequired: this.logUploadWarning.bind(this),
|
|
327
340
|
accountId: this.targetAccountId,
|
|
341
|
+
setActiveApp: this.setActiveApp.bind(this),
|
|
328
342
|
});
|
|
329
343
|
return true;
|
|
330
344
|
} catch (e) {
|
package/lib/commonOpts.js
CHANGED
|
@@ -29,7 +29,7 @@ const {
|
|
|
29
29
|
} = require('./prompts/personalAccessKeyPrompt');
|
|
30
30
|
const { enterAccountNamePrompt } = require('./prompts/enterAccountNamePrompt');
|
|
31
31
|
|
|
32
|
-
const i18nKey = '
|
|
32
|
+
const i18nKey = 'lib.developerTestAccount';
|
|
33
33
|
|
|
34
34
|
const saveDevTestAccountToConfig = async (env, result, force = false) => {
|
|
35
35
|
let personalAccessKey = result.personalAccessKey;
|
|
@@ -60,10 +60,9 @@ const saveDevTestAccountToConfig = async (env, result, force = false) => {
|
|
|
60
60
|
if (!force) {
|
|
61
61
|
logger.log('');
|
|
62
62
|
logger.warn(
|
|
63
|
-
i18n(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
)
|
|
63
|
+
i18n(`lib.prompts.enterAccountNamePrompt.errors.accountNameExists`, {
|
|
64
|
+
name: nameForConfig,
|
|
65
|
+
})
|
|
67
66
|
);
|
|
68
67
|
const { name: promptName } = await enterAccountNamePrompt(
|
|
69
68
|
nameForConfig + `_${result.id}`
|
|
@@ -22,7 +22,7 @@ const getHasDevTestAccounts = appDeveloperAccountConfig => {
|
|
|
22
22
|
return false;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
const i18nKey = '
|
|
25
|
+
const i18nKey = 'lib.developerTestAccount';
|
|
26
26
|
|
|
27
27
|
const validateDevTestAccountUsageLimits = async accountConfig => {
|
|
28
28
|
const accountId = getAccountId(accountConfig.portalId);
|
|
@@ -19,7 +19,7 @@ const {
|
|
|
19
19
|
const { overrideErrors } = require('./overrideErrors');
|
|
20
20
|
const { i18n } = require('../lang');
|
|
21
21
|
|
|
22
|
-
const i18nKey = '
|
|
22
|
+
const i18nKey = 'lib.errorHandlers.apiErrors';
|
|
23
23
|
|
|
24
24
|
class ApiErrorContext extends ErrorContext {
|
|
25
25
|
constructor(props = {}) {
|
|
@@ -5,7 +5,7 @@ const { PLATFORM_VERSION_ERROR_TYPES } = require('../constants');
|
|
|
5
5
|
const { i18n } = require('../lang');
|
|
6
6
|
const { uiLine, uiLink } = require('../ui');
|
|
7
7
|
|
|
8
|
-
const i18nKey = '
|
|
8
|
+
const i18nKey = 'lib.errorHandlers.overrideErrors';
|
|
9
9
|
|
|
10
10
|
function createPlatformVersionError(subCategory, errData) {
|
|
11
11
|
const docsLink = uiLink(
|
|
@@ -5,7 +5,7 @@ const {
|
|
|
5
5
|
} = require('@hubspot/local-dev-lib/errors/standardErrors');
|
|
6
6
|
const { i18n } = require('../lang');
|
|
7
7
|
|
|
8
|
-
const i18nKey = '
|
|
8
|
+
const i18nKey = 'lib.errorHandlers.standardErrors';
|
|
9
9
|
|
|
10
10
|
// TODO: Make these TS interfaces
|
|
11
11
|
class ErrorContext {
|
|
@@ -8,7 +8,7 @@ const CSS_PSEUDO_CLASS_REGEX = new RegExp(
|
|
|
8
8
|
/:active|:checked|:disabled|:empty|:enabled|:first-of-type|:focus|:hover|:in-range|:invalid|:link|:optional|:out-of-range|:read-only|:read-write|:required|:target|:valid|:visited/,
|
|
9
9
|
'g'
|
|
10
10
|
);
|
|
11
|
-
const i18nKey = '
|
|
11
|
+
const i18nKey = 'commands.theme.subcommands.generateSelectors';
|
|
12
12
|
|
|
13
13
|
let maxFieldsDepth = 0;
|
|
14
14
|
|
package/lib/localDev.js
CHANGED
|
@@ -10,7 +10,6 @@ const {
|
|
|
10
10
|
const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
|
|
11
11
|
const { getAccountConfig } = require('@hubspot/local-dev-lib/config');
|
|
12
12
|
const { createProject } = require('@hubspot/local-dev-lib/api/projects');
|
|
13
|
-
|
|
14
13
|
const {
|
|
15
14
|
confirmDefaultAccountPrompt,
|
|
16
15
|
selectSandboxTargetAccountPrompt,
|
|
@@ -63,7 +62,7 @@ const {
|
|
|
63
62
|
PERSONAL_ACCESS_KEY_AUTH_METHOD,
|
|
64
63
|
} = require('@hubspot/local-dev-lib/constants/auth');
|
|
65
64
|
|
|
66
|
-
const i18nKey = '
|
|
65
|
+
const i18nKey = 'lib.localDev';
|
|
67
66
|
|
|
68
67
|
// If the user passed in the --account flag, confirm they want to use that account as
|
|
69
68
|
// their target account, otherwise exit
|
|
@@ -152,14 +151,14 @@ const createSandboxForLocalDev = async (accountId, accountConfig, env) => {
|
|
|
152
151
|
} catch (err) {
|
|
153
152
|
if (isMissingScopeError(err)) {
|
|
154
153
|
logger.error(
|
|
155
|
-
i18n('
|
|
154
|
+
i18n('lib.sandbox.create.failure.scopes.message', {
|
|
156
155
|
accountName: accountConfig.name || accountId,
|
|
157
156
|
})
|
|
158
157
|
);
|
|
159
158
|
const websiteOrigin = getHubSpotWebsiteOrigin(env);
|
|
160
159
|
const url = `${websiteOrigin}/personal-access-key/${accountId}`;
|
|
161
160
|
logger.info(
|
|
162
|
-
i18n('
|
|
161
|
+
i18n('lib.sandbox.create.failure.scopes.instructions', {
|
|
163
162
|
accountName: accountConfig.name || accountId,
|
|
164
163
|
url,
|
|
165
164
|
})
|
|
@@ -230,20 +229,17 @@ const createDeveloperTestAccountForLocalDev = async (
|
|
|
230
229
|
} catch (err) {
|
|
231
230
|
if (isMissingScopeError(err)) {
|
|
232
231
|
logger.error(
|
|
233
|
-
i18n('
|
|
232
|
+
i18n('lib.developerTestAccount.create.failure.scopes.message', {
|
|
234
233
|
accountName: accountConfig.name || accountId,
|
|
235
234
|
})
|
|
236
235
|
);
|
|
237
236
|
const websiteOrigin = getHubSpotWebsiteOrigin(env);
|
|
238
237
|
const url = `${websiteOrigin}/personal-access-key/${accountId}`;
|
|
239
238
|
logger.info(
|
|
240
|
-
i18n(
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
url,
|
|
245
|
-
}
|
|
246
|
-
)
|
|
239
|
+
i18n('lib.developerTestAccount.create.failure.scopes.instructions', {
|
|
240
|
+
accountName: accountConfig.name || accountId,
|
|
241
|
+
url,
|
|
242
|
+
})
|
|
247
243
|
);
|
|
248
244
|
} else {
|
|
249
245
|
logErrorInstance(err);
|
package/lib/process.js
CHANGED
package/lib/projects.js
CHANGED
|
@@ -47,7 +47,7 @@ const {
|
|
|
47
47
|
} = require('./errorHandlers/apiErrors');
|
|
48
48
|
const { HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH } = require('./constants');
|
|
49
49
|
|
|
50
|
-
const i18nKey = '
|
|
50
|
+
const i18nKey = 'lib.projects';
|
|
51
51
|
|
|
52
52
|
const SPINNER_STATUS = {
|
|
53
53
|
SPINNING: 'spinning',
|
|
@@ -252,7 +252,7 @@ const ensureProjectExists = async (
|
|
|
252
252
|
const project = withPolling
|
|
253
253
|
? await pollFetchProject(accountId, projectName)
|
|
254
254
|
: await fetchProject(accountId, projectName);
|
|
255
|
-
return !!project;
|
|
255
|
+
return { projectExists: !!project, project };
|
|
256
256
|
} catch (err) {
|
|
257
257
|
if (isSpecifiedError(err, { statusCode: 404 })) {
|
|
258
258
|
let shouldCreateProject = forceCreate;
|
|
@@ -273,14 +273,14 @@ const ensureProjectExists = async (
|
|
|
273
273
|
|
|
274
274
|
if (shouldCreateProject) {
|
|
275
275
|
try {
|
|
276
|
-
await createProject(accountId, projectName);
|
|
276
|
+
const project = await createProject(accountId, projectName);
|
|
277
277
|
logger.success(
|
|
278
278
|
i18n(`${i18nKey}.ensureProjectExists.createSuccess`, {
|
|
279
279
|
projectName,
|
|
280
280
|
accountIdentifier,
|
|
281
281
|
})
|
|
282
282
|
);
|
|
283
|
-
return true;
|
|
283
|
+
return { projectExists: true, project };
|
|
284
284
|
} catch (err) {
|
|
285
285
|
return logApiErrorInstance(
|
|
286
286
|
err,
|
|
@@ -296,7 +296,7 @@ const ensureProjectExists = async (
|
|
|
296
296
|
})
|
|
297
297
|
);
|
|
298
298
|
}
|
|
299
|
-
return false;
|
|
299
|
+
return { projectExists: false };
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
302
|
if (
|
|
@@ -859,7 +859,7 @@ const createProjectComponent = async (
|
|
|
859
859
|
name,
|
|
860
860
|
projectComponentsVersion
|
|
861
861
|
) => {
|
|
862
|
-
const i18nKey = '
|
|
862
|
+
const i18nKey = 'commands.project.subcommands.add';
|
|
863
863
|
let componentName = name;
|
|
864
864
|
|
|
865
865
|
const configInfo = await getProjectConfig();
|
package/lib/projectsWatch.js
CHANGED
|
@@ -20,7 +20,7 @@ const {
|
|
|
20
20
|
const { isSpecifiedError } = require('@hubspot/local-dev-lib/errors/apiErrors');
|
|
21
21
|
const { PROJECT_ERROR_TYPES } = require('./constants');
|
|
22
22
|
|
|
23
|
-
const i18nKey = '
|
|
23
|
+
const i18nKey = 'commands.project.subcommands.watch';
|
|
24
24
|
|
|
25
25
|
const queue = new PQueue({
|
|
26
26
|
concurrency: 10,
|
|
@@ -9,7 +9,7 @@ const mapAccountChoices = portals =>
|
|
|
9
9
|
value: p.name || p.portalId,
|
|
10
10
|
}));
|
|
11
11
|
|
|
12
|
-
const i18nKey = '
|
|
12
|
+
const i18nKey = 'commands.accounts.subcommands.use';
|
|
13
13
|
|
|
14
14
|
const selectAccountFromConfig = async (config, prompt) => {
|
|
15
15
|
const { default: selectedDefault } = await promptUser([
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { promptUser } = require('./promptUtils');
|
|
2
2
|
const { i18n } = require('../lang');
|
|
3
3
|
|
|
4
|
-
const i18nKey = '
|
|
4
|
+
const i18nKey = 'lib.prompts.buildIdPrompt';
|
|
5
5
|
|
|
6
6
|
const buildIdPrompt = (latestBuildId, deployedBuildId, projectName) => {
|
|
7
7
|
return promptUser({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { promptUser } = require('./promptUtils');
|
|
2
2
|
const { i18n } = require('../lang');
|
|
3
3
|
|
|
4
|
-
const i18nKey = '
|
|
4
|
+
const i18nKey = 'lib.prompts.cleanUploadPrompt';
|
|
5
5
|
|
|
6
6
|
const cleanUploadPrompt = async (accountId, filePath) => {
|
|
7
7
|
const promptAnswer = await promptUser([
|
|
@@ -3,7 +3,7 @@ const fs = require('fs');
|
|
|
3
3
|
const { promptUser } = require('./promptUtils');
|
|
4
4
|
const { i18n } = require('../lang');
|
|
5
5
|
const escapeRegExp = require('@hubspot/local-dev-lib/escapeRegExp');
|
|
6
|
-
const i18nKey = '
|
|
6
|
+
const i18nKey = 'lib.prompts.uploadPrompt';
|
|
7
7
|
const FIELDS_FILES = ['fields.json', 'fields.js', 'fields.cjs', 'fields.mjs'];
|
|
8
8
|
|
|
9
9
|
const fieldsJsPrompt = async (filePath, projectDir, skipFiles = []) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { promptUser } = require('./promptUtils');
|
|
2
2
|
const { i18n } = require('../lang');
|
|
3
3
|
|
|
4
|
-
const i18nKey = '
|
|
4
|
+
const i18nKey = 'lib.prompts.createApiSamplePrompt';
|
|
5
5
|
|
|
6
6
|
const getSampleTypesPrompt = choices => ({
|
|
7
7
|
type: 'rawlist',
|
|
@@ -3,7 +3,7 @@ const { i18n } = require('../lang');
|
|
|
3
3
|
|
|
4
4
|
const { STRING_WITH_NO_SPACES_REGEX } = require('../regex');
|
|
5
5
|
|
|
6
|
-
const i18nKey = '
|
|
6
|
+
const i18nKey = 'lib.prompts.createFunctionPrompt';
|
|
7
7
|
|
|
8
8
|
const FUNCTIONS_FOLDER_PROMPT = {
|
|
9
9
|
name: 'functionsFolder',
|
|
@@ -11,7 +11,7 @@ const {
|
|
|
11
11
|
DEFAULT_PROJECT_TEMPLATE_BRANCH,
|
|
12
12
|
} = require('../constants');
|
|
13
13
|
|
|
14
|
-
const i18nKey = '
|
|
14
|
+
const i18nKey = 'lib.prompts.createProjectPrompt';
|
|
15
15
|
|
|
16
16
|
const PROJECT_PROPERTIES = ['name', 'label', 'path', 'insertPath'];
|
|
17
17
|
|
|
@@ -2,7 +2,7 @@ const { promptUser } = require('./promptUtils');
|
|
|
2
2
|
const { i18n } = require('../lang');
|
|
3
3
|
const { accountNameExistsInConfig } = require('@hubspot/local-dev-lib/config');
|
|
4
4
|
|
|
5
|
-
const i18nKey = '
|
|
5
|
+
const i18nKey = 'lib.prompts.developerTestAccountPrompt';
|
|
6
6
|
|
|
7
7
|
const developerTestAccountNamePrompt = currentPortalCount => {
|
|
8
8
|
return promptUser([
|
|
@@ -8,7 +8,7 @@ const {
|
|
|
8
8
|
const { EXIT_CODES } = require('../enums/exitCodes');
|
|
9
9
|
const { i18n } = require('../lang');
|
|
10
10
|
|
|
11
|
-
const i18nKey = '
|
|
11
|
+
const i18nKey = 'lib.prompts.downloadProjectPrompt';
|
|
12
12
|
|
|
13
13
|
const createProjectsList = async () => {
|
|
14
14
|
const accountId = getAccountId();
|
|
@@ -3,7 +3,7 @@ const { STRING_WITH_NO_SPACES_REGEX } = require('../regex');
|
|
|
3
3
|
const { promptUser } = require('./promptUtils');
|
|
4
4
|
const { i18n } = require('../lang');
|
|
5
5
|
|
|
6
|
-
const i18nKey = '
|
|
6
|
+
const i18nKey = 'lib.prompts.enterAccountNamePrompt';
|
|
7
7
|
|
|
8
8
|
const accountNamePrompt = defaultName => ({
|
|
9
9
|
name: 'name',
|
|
@@ -2,7 +2,7 @@ const { promptUser } = require('./promptUtils');
|
|
|
2
2
|
const { i18n } = require('../lang');
|
|
3
3
|
const { FEEDBACK_OPTIONS } = require('../constants');
|
|
4
4
|
|
|
5
|
-
const i18nKey = '
|
|
5
|
+
const i18nKey = 'lib.prompts.feedbackPrompt';
|
|
6
6
|
|
|
7
7
|
const feedbackTypePrompt = bypassPrompt => {
|
|
8
8
|
return promptUser([
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { promptUser } = require('./promptUtils');
|
|
2
2
|
const { i18n } = require('../lang');
|
|
3
3
|
|
|
4
|
-
const i18nKey = '
|
|
4
|
+
const i18nKey = 'lib.prompts.folderOverwritePrompt';
|
|
5
5
|
|
|
6
6
|
const folderOverwritePrompt = folderName => {
|
|
7
7
|
return promptUser({
|
|
@@ -12,7 +12,7 @@ const { i18n } = require('../lang');
|
|
|
12
12
|
const { uiInfoSection } = require('../ui');
|
|
13
13
|
const { EXIT_CODES } = require('../enums/exitCodes');
|
|
14
14
|
|
|
15
|
-
const i18nKey = '
|
|
15
|
+
const i18nKey = 'lib.prompts.personalAccessKeyPrompt';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Displays notification to user that we are about to open the browser,
|
|
@@ -3,7 +3,7 @@ const { getCwd } = require('@hubspot/local-dev-lib/path');
|
|
|
3
3
|
const { promptUser } = require('./promptUtils');
|
|
4
4
|
const { i18n } = require('../lang');
|
|
5
5
|
|
|
6
|
-
const i18nKey = '
|
|
6
|
+
const i18nKey = 'lib.prompts.previewPrompt';
|
|
7
7
|
|
|
8
8
|
const previewPrompt = (promptOptions = {}) => {
|
|
9
9
|
return promptUser([
|
|
@@ -4,7 +4,7 @@ const { i18n } = require('../lang');
|
|
|
4
4
|
const { HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH } = require('../constants');
|
|
5
5
|
const { PROJECT_COMPONENT_TYPES } = require('../constants');
|
|
6
6
|
|
|
7
|
-
const i18nKey = '
|
|
7
|
+
const i18nKey = 'lib.prompts.projectAddPrompt';
|
|
8
8
|
|
|
9
9
|
const createTypeOptions = async projectComponentsVersion => {
|
|
10
10
|
const config = await fetchFileFromRepository(
|
|
@@ -13,7 +13,7 @@ const {
|
|
|
13
13
|
fetchDeveloperTestAccounts,
|
|
14
14
|
} = require('@hubspot/local-dev-lib/developerTestAccounts');
|
|
15
15
|
|
|
16
|
-
const i18nKey = '
|
|
16
|
+
const i18nKey = 'lib.prompts.projectDevTargetAccountPrompt';
|
|
17
17
|
|
|
18
18
|
const mapNestedAccount = accountConfig => ({
|
|
19
19
|
name: uiAccountDescription(accountConfig.portalId, false),
|
|
@@ -3,7 +3,7 @@ const { i18n } = require('../lang');
|
|
|
3
3
|
const { ensureProjectExists } = require('../projects');
|
|
4
4
|
const { uiAccountDescription } = require('../ui');
|
|
5
5
|
|
|
6
|
-
const i18nKey = '
|
|
6
|
+
const i18nKey = 'lib.prompts.projectNamePrompt';
|
|
7
7
|
|
|
8
8
|
const projectNamePrompt = (accountId, options = {}) => {
|
|
9
9
|
return promptUser({
|
|
@@ -14,7 +14,7 @@ const projectNamePrompt = (accountId, options = {}) => {
|
|
|
14
14
|
if (typeof val !== 'string' || !val) {
|
|
15
15
|
return i18n(`${i18nKey}.errors.invalidName`);
|
|
16
16
|
}
|
|
17
|
-
const projectExists = await ensureProjectExists(accountId, val, {
|
|
17
|
+
const { projectExists } = await ensureProjectExists(accountId, val, {
|
|
18
18
|
allowCreate: false,
|
|
19
19
|
noLogs: true,
|
|
20
20
|
});
|
|
@@ -10,7 +10,7 @@ const {
|
|
|
10
10
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
11
11
|
const { EXIT_CODES } = require('../enums/exitCodes');
|
|
12
12
|
|
|
13
|
-
const i18nKey = '
|
|
13
|
+
const i18nKey = 'lib.prompts.projectLogsPrompt';
|
|
14
14
|
|
|
15
15
|
const SERVERLESS_FUNCTION_TYPES = {
|
|
16
16
|
APP_FUNCTION: 'app-function',
|
|
@@ -7,7 +7,7 @@ const {
|
|
|
7
7
|
} = require('@hubspot/local-dev-lib/constants/config');
|
|
8
8
|
const { isSandbox } = require('../accountTypes');
|
|
9
9
|
|
|
10
|
-
const i18nKey = '
|
|
10
|
+
const i18nKey = 'lib.prompts.sandboxesPrompt';
|
|
11
11
|
|
|
12
12
|
const mapSandboxAccountChoices = portals =>
|
|
13
13
|
portals
|
|
@@ -5,7 +5,7 @@ const {
|
|
|
5
5
|
const { promptUser } = require('./promptUtils');
|
|
6
6
|
const { i18n } = require('../lang');
|
|
7
7
|
|
|
8
|
-
const i18nKey = '
|
|
8
|
+
const i18nKey = 'lib.prompts.setAsDefaultAccountPrompt';
|
|
9
9
|
|
|
10
10
|
const setAsDefaultAccountPrompt = async accountName => {
|
|
11
11
|
const config = getConfig();
|
|
@@ -3,7 +3,7 @@ const { getCwd } = require('@hubspot/local-dev-lib/path');
|
|
|
3
3
|
const { promptUser } = require('./promptUtils');
|
|
4
4
|
const { i18n } = require('../lang');
|
|
5
5
|
|
|
6
|
-
const i18nKey = '
|
|
6
|
+
const i18nKey = 'lib.prompts.uploadPrompt';
|
|
7
7
|
|
|
8
8
|
const uploadPrompt = (promptOptions = {}) => {
|
|
9
9
|
return promptUser([
|
package/lib/sandboxCreate.js
CHANGED
|
@@ -36,7 +36,7 @@ const {
|
|
|
36
36
|
HUBSPOT_ACCOUNT_TYPES,
|
|
37
37
|
} = require('@hubspot/local-dev-lib/constants/config');
|
|
38
38
|
|
|
39
|
-
const i18nKey = '
|
|
39
|
+
const i18nKey = 'lib.sandbox.create';
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* @param {String} env - Environment (QA/Prod)
|
|
@@ -83,10 +83,9 @@ const saveSandboxToConfig = async (env, result, force = false) => {
|
|
|
83
83
|
if (!force) {
|
|
84
84
|
logger.log('');
|
|
85
85
|
logger.warn(
|
|
86
|
-
i18n(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
)
|
|
86
|
+
i18n(`lib.prompts.enterAccountNamePrompt.errors.accountNameExists`, {
|
|
87
|
+
name: nameForConfig,
|
|
88
|
+
})
|
|
90
89
|
);
|
|
91
90
|
const { name: promptName } = await enterAccountNamePrompt(
|
|
92
91
|
nameForConfig + `_${result.sandbox.sandboxHubId}`
|
package/lib/sandboxSync.js
CHANGED
|
@@ -21,7 +21,7 @@ const { getSandboxTypeAsString } = require('./sandboxes');
|
|
|
21
21
|
const { getAccountId } = require('@hubspot/local-dev-lib/config');
|
|
22
22
|
const { uiAccountDescription } = require('./ui');
|
|
23
23
|
|
|
24
|
-
const i18nKey = '
|
|
24
|
+
const i18nKey = 'lib.sandbox.sync';
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* @param {Object} accountConfig - Account config of sandbox portal
|