@hubspot/cli 7.0.0-experimental.1 → 7.0.1-experimental.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 +110 -16
- package/bin/hs +2 -0
- package/bin/hscms +2 -0
- package/bin/silenceErrors.d.ts +2 -0
- package/bin/silenceErrors.js +12 -0
- package/commands/{accounts → account}/clean.js +10 -11
- package/commands/{accounts → account}/info.js +10 -16
- package/commands/{accounts → account}/list.js +16 -16
- package/commands/{accounts → account}/remove.js +12 -15
- package/commands/{accounts → account}/rename.js +4 -7
- package/commands/{accounts → account}/use.js +8 -14
- package/commands/account.js +26 -0
- package/commands/auth.js +30 -24
- package/commands/cms/getReactModule.js +70 -0
- package/commands/cms/lighthouseScore.js +19 -21
- package/commands/cms.js +4 -3
- package/commands/completion.js +22 -0
- package/commands/config/set.js +22 -24
- package/commands/config.js +2 -2
- package/commands/create.js +6 -3
- package/commands/customObject/create.js +19 -15
- package/commands/customObject/schema/create.js +15 -16
- package/commands/customObject/schema/delete.js +29 -11
- package/commands/customObject/schema/fetch-all.js +14 -11
- package/commands/customObject/schema/fetch.js +22 -14
- package/commands/customObject/schema/list.js +3 -6
- package/commands/customObject/schema/update.js +28 -18
- package/commands/customObject/schema.js +1 -1
- package/commands/customObject.js +3 -4
- package/commands/doctor.js +4 -2
- package/commands/feedback.js +2 -0
- package/commands/fetch.js +13 -13
- package/commands/filemanager/fetch.js +6 -7
- package/commands/filemanager/upload.js +10 -12
- package/commands/filemanager.js +1 -8
- package/commands/{functions → function}/deploy.js +13 -13
- package/commands/{functions → function}/list.js +7 -9
- package/commands/{functions → function}/server.js +5 -8
- package/commands/function.js +16 -0
- package/commands/hubdb/clear.js +14 -10
- package/commands/hubdb/create.js +37 -13
- package/commands/hubdb/delete.js +31 -10
- package/commands/hubdb/fetch.js +14 -9
- package/commands/hubdb.js +2 -3
- package/commands/init.js +37 -14
- package/commands/lint.js +6 -7
- package/commands/list.js +5 -7
- package/commands/logs.js +24 -15
- package/commands/module/marketplace-validate.js +6 -9
- package/commands/module.js +2 -1
- package/commands/mv.js +11 -13
- package/commands/open.js +11 -10
- package/commands/project/add.js +2 -5
- package/commands/project/cloneApp.js +28 -32
- package/commands/project/create.js +8 -10
- package/commands/project/deploy.js +19 -16
- package/commands/project/dev.js +17 -18
- package/commands/project/download.js +18 -15
- package/commands/project/listBuilds.js +36 -32
- package/commands/project/logs.js +6 -8
- package/commands/project/migrateApp.js +27 -27
- package/commands/project/open.js +9 -11
- package/commands/project/upload.js +35 -32
- package/commands/project/watch.js +17 -24
- package/commands/project.js +3 -4
- package/commands/remove.js +14 -13
- package/commands/sandbox/create.js +12 -15
- package/commands/sandbox/delete.js +19 -20
- package/commands/sandbox.js +4 -8
- package/commands/{secrets → secret}/addSecret.js +25 -12
- package/commands/secret/deleteSecret.js +71 -0
- package/commands/{secrets → secret}/listSecrets.js +7 -9
- package/commands/{secrets → secret}/updateSecret.js +21 -13
- package/commands/secret.js +22 -0
- package/commands/theme/generate-selectors.js +8 -8
- package/commands/theme/marketplace-validate.js +10 -13
- package/commands/theme/preview.js +7 -10
- package/commands/theme.js +3 -1
- package/commands/upload.js +32 -26
- package/commands/watch.js +19 -20
- package/lang/en.lyaml +200 -126
- package/lib/DevServerManager.js +1 -1
- package/lib/LocalDevManager.js +3 -3
- package/lib/buildAccount.js +5 -11
- package/lib/commonOpts.d.ts +15 -6
- package/lib/commonOpts.js +53 -38
- package/lib/configOptions.d.ts +13 -1
- package/lib/configOptions.js +54 -57
- package/lib/constants.d.ts +1 -4
- package/lib/developerTestAccounts.d.ts +5 -1
- package/lib/developerTestAccounts.js +45 -39
- package/lib/doctor/DiagnosticInfoBuilder.js +8 -4
- package/lib/doctor/Doctor.js +4 -3
- package/lib/generateSelectors.d.ts +19 -0
- package/lib/generateSelectors.js +23 -23
- package/lib/localDev.js +2 -1
- package/lib/marketplaceValidate.d.ts +6 -1
- package/lib/marketplaceValidate.js +76 -77
- package/lib/oauth.d.ts +2 -1
- package/lib/oauth.js +49 -37
- package/lib/polling.d.ts +8 -0
- package/lib/polling.js +9 -12
- package/lib/projects/ProjectLogsManager.d.ts +20 -0
- package/lib/projects/ProjectLogsManager.js +105 -0
- package/lib/projects/buildAndDeploy.d.ts +16 -0
- package/lib/projects/buildAndDeploy.js +342 -0
- package/lib/projects/index.d.ts +24 -0
- package/lib/projects/index.js +256 -0
- package/lib/projects/structure.d.ts +78 -0
- package/lib/projects/structure.js +151 -0
- package/lib/projects/upload.d.ts +8 -0
- package/lib/projects/upload.js +128 -0
- package/lib/projects/urls.d.ts +4 -0
- package/lib/projects/urls.js +27 -0
- package/lib/{projectsWatch.js → projects/watch.js} +3 -3
- package/lib/prompts/accountNamePrompt.d.ts +11 -0
- package/lib/prompts/accountNamePrompt.js +45 -46
- package/lib/prompts/accountsPrompt.d.ts +1 -1
- package/lib/prompts/accountsPrompt.js +21 -19
- package/lib/prompts/cmsFieldPrompt.d.ts +1 -1
- package/lib/prompts/cmsFieldPrompt.js +23 -24
- package/lib/prompts/createApiSamplePrompt.d.ts +17 -0
- package/lib/prompts/createApiSamplePrompt.js +47 -44
- package/lib/prompts/createFunctionPrompt.d.ts +7 -0
- package/lib/prompts/createFunctionPrompt.js +17 -20
- package/lib/prompts/createModulePrompt.d.ts +8 -0
- package/lib/prompts/createModulePrompt.js +29 -17
- package/lib/prompts/createProjectPrompt.d.ts +13 -0
- package/lib/prompts/createProjectPrompt.js +48 -49
- package/lib/prompts/createTemplatePrompt.d.ts +8 -0
- package/lib/prompts/createTemplatePrompt.js +15 -17
- package/lib/prompts/downloadProjectPrompt.d.ts +8 -0
- package/lib/prompts/downloadProjectPrompt.js +25 -23
- package/lib/prompts/installPublicAppPrompt.d.ts +1 -1
- package/lib/prompts/installPublicAppPrompt.js +21 -19
- package/lib/prompts/personalAccessKeyPrompt.d.ts +28 -0
- package/lib/prompts/personalAccessKeyPrompt.js +46 -52
- package/lib/prompts/previewPrompt.d.ts +14 -0
- package/lib/prompts/previewPrompt.js +24 -24
- package/lib/prompts/projectAddPrompt.d.ts +9 -0
- package/lib/prompts/projectAddPrompt.js +11 -14
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +6 -1
- package/lib/prompts/projectDevTargetAccountPrompt.js +87 -69
- package/lib/prompts/projectsLogsPrompt.d.ts +11 -0
- package/lib/prompts/projectsLogsPrompt.js +8 -11
- package/lib/prompts/promptUtils.d.ts +7 -6
- package/lib/prompts/promptUtils.js +21 -8
- package/lib/prompts/sandboxesPrompt.d.ts +8 -0
- package/lib/prompts/sandboxesPrompt.js +43 -45
- package/lib/prompts/secretPrompt.d.ts +12 -0
- package/lib/prompts/secretPrompt.js +32 -19
- package/lib/prompts/selectHubDBTablePrompt.d.ts +12 -0
- package/lib/prompts/selectHubDBTablePrompt.js +69 -0
- package/lib/prompts/selectPublicAppPrompt.d.ts +8 -0
- package/lib/prompts/selectPublicAppPrompt.js +28 -27
- package/lib/prompts/setAsDefaultAccountPrompt.d.ts +1 -1
- package/lib/prompts/setAsDefaultAccountPrompt.js +12 -14
- package/lib/prompts/uploadPrompt.d.ts +8 -0
- package/lib/prompts/uploadPrompt.js +18 -18
- package/lib/sandboxSync.js +5 -2
- package/lib/sandboxes.js +12 -7
- package/lib/ui/index.d.ts +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/usageTracking.d.ts +21 -2
- package/lib/usageTracking.js +53 -81
- package/lib/validation.d.ts +11 -1
- package/lib/validation.js +98 -91
- package/package.json +14 -7
- package/types/Projects.d.ts +43 -0
- package/types/Projects.js +2 -0
- package/types/Prompts.d.ts +25 -0
- package/types/Prompts.js +2 -0
- package/commands/accounts.js +0 -30
- package/commands/cms/reactModules.js +0 -60
- package/commands/functions.js +0 -24
- package/commands/secrets/deleteSecret.js +0 -46
- package/commands/secrets.js +0 -23
- package/lib/ProjectLogsManager.js +0 -91
- package/lib/projectStructure.js +0 -116
- package/lib/projects.d.ts +0 -4
- package/lib/projects.js +0 -681
- package/lib/projectsWatch.d.ts +0 -1
- package/lib/prompts/cleanUploadPrompt.d.ts +0 -1
- package/lib/prompts/cleanUploadPrompt.js +0 -20
- /package/commands/{accounts → account}/clean.d.ts +0 -0
- /package/commands/{accounts → account}/info.d.ts +0 -0
- /package/commands/{accounts → account}/list.d.ts +0 -0
- /package/commands/{accounts → account}/remove.d.ts +0 -0
- /package/commands/{accounts → account}/rename.d.ts +0 -0
- /package/commands/{accounts → account}/use.d.ts +0 -0
- /package/commands/{accounts.d.ts → account.d.ts} +0 -0
- /package/commands/cms/{reactModules.d.ts → getReactModule.d.ts} +0 -0
- /package/commands/{functions.d.ts → completion.d.ts} +0 -0
- /package/commands/{functions/list.d.ts → function/deploy.d.ts} +0 -0
- /package/commands/{functions/server.d.ts → function/list.d.ts} +0 -0
- /package/commands/{secrets.d.ts → function/server.d.ts} +0 -0
- /package/commands/{functions/deploy.d.ts → function.d.ts} +0 -0
- /package/commands/{secrets/deleteSecret.d.ts → secret/addSecret.d.ts} +0 -0
- /package/commands/{secrets/listSecrets.d.ts → secret/deleteSecret.d.ts} +0 -0
- /package/commands/{secrets/updateSecret.d.ts → secret/listSecrets.d.ts} +0 -0
- /package/{lib/ProjectLogsManager.d.ts → commands/secret/updateSecret.d.ts} +0 -0
- /package/commands/{secrets/addSecret.d.ts → secret.d.ts} +0 -0
- /package/lib/{projectStructure.d.ts → projects/watch.d.ts} +0 -0
|
@@ -1,37 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
3
|
+
exports.downloadProjectPrompt = downloadProjectPrompt;
|
|
4
|
+
const promptUtils_1 = require("./promptUtils");
|
|
5
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
6
|
+
const projects_1 = require("@hubspot/local-dev-lib/api/projects");
|
|
7
|
+
const index_1 = require("../errorHandlers/index");
|
|
8
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
9
|
+
const exitCodes_1 = require("../enums/exitCodes");
|
|
10
|
+
const lang_1 = require("../lang");
|
|
10
11
|
const i18nKey = 'lib.prompts.downloadProjectPrompt';
|
|
11
|
-
|
|
12
|
+
async function createProjectsList(accountId) {
|
|
12
13
|
try {
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
if (accountId) {
|
|
15
|
+
const { data: projects } = await (0, projects_1.fetchProjects)(accountId);
|
|
16
|
+
return projects.results;
|
|
17
|
+
}
|
|
18
|
+
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.errors.accountIdRequired`));
|
|
19
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
15
20
|
}
|
|
16
21
|
catch (e) {
|
|
17
|
-
logError(e, new ApiErrorContext({ accountId }));
|
|
18
|
-
process.exit(EXIT_CODES.ERROR);
|
|
22
|
+
(0, index_1.logError)(e, accountId ? new index_1.ApiErrorContext({ accountId }) : undefined);
|
|
23
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
19
24
|
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const accountId = getAccountId(promptOptions.account);
|
|
25
|
+
}
|
|
26
|
+
async function downloadProjectPrompt(promptOptions) {
|
|
27
|
+
const accountId = (0, config_1.getAccountId)(promptOptions.account);
|
|
23
28
|
const projectsList = await createProjectsList(accountId);
|
|
24
|
-
return promptUser([
|
|
29
|
+
return (0, promptUtils_1.promptUser)([
|
|
25
30
|
{
|
|
26
31
|
name: 'project',
|
|
27
32
|
message: () => {
|
|
28
33
|
return promptOptions.project &&
|
|
29
34
|
!projectsList.find(p => p.name === promptOptions.name)
|
|
30
|
-
? i18n(`${i18nKey}.errors.projectNotFound`, {
|
|
35
|
+
? (0, lang_1.i18n)(`${i18nKey}.errors.projectNotFound`, {
|
|
31
36
|
projectName: promptOptions.project,
|
|
32
|
-
accountId,
|
|
37
|
+
accountId: accountId || '',
|
|
33
38
|
})
|
|
34
|
-
: i18n(`${i18nKey}.selectProject`);
|
|
39
|
+
: (0, lang_1.i18n)(`${i18nKey}.selectProject`);
|
|
35
40
|
},
|
|
36
41
|
when: !promptOptions.project ||
|
|
37
42
|
!projectsList.find(p => p.name === promptOptions.project),
|
|
@@ -44,7 +49,4 @@ const downloadProjectPrompt = async (promptOptions = {}) => {
|
|
|
44
49
|
}),
|
|
45
50
|
},
|
|
46
51
|
]);
|
|
47
|
-
}
|
|
48
|
-
module.exports = {
|
|
49
|
-
downloadProjectPrompt,
|
|
50
|
-
};
|
|
52
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare function installPublicAppPrompt(env: string, targetAccountId: number, clientId: number, scopes: string[], redirectUrls: string[], isReinstall?: boolean): Promise<void>;
|
|
@@ -1,38 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
6
|
+
exports.installPublicAppPrompt = installPublicAppPrompt;
|
|
7
|
+
const open_1 = __importDefault(require("open"));
|
|
8
|
+
const urls_1 = require("@hubspot/local-dev-lib/urls");
|
|
9
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
10
|
+
const promptUtils_1 = require("./promptUtils");
|
|
11
|
+
const lang_1 = require("../lang");
|
|
12
|
+
const exitCodes_1 = require("../enums/exitCodes");
|
|
10
13
|
const i18nKey = 'lib.prompts.installPublicAppPrompt';
|
|
11
|
-
|
|
12
|
-
logger.log('');
|
|
14
|
+
async function installPublicAppPrompt(env, targetAccountId, clientId, scopes, redirectUrls, isReinstall = false) {
|
|
15
|
+
logger_1.logger.log('');
|
|
13
16
|
if (isReinstall) {
|
|
14
|
-
logger.log(i18n(`${i18nKey}.reinstallExplanation`));
|
|
17
|
+
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.reinstallExplanation`));
|
|
15
18
|
}
|
|
16
19
|
else {
|
|
17
|
-
logger.log(i18n(`${i18nKey}.explanation`));
|
|
20
|
+
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.explanation`));
|
|
18
21
|
}
|
|
19
|
-
const { shouldOpenBrowser } = await promptUser({
|
|
22
|
+
const { shouldOpenBrowser } = await (0, promptUtils_1.promptUser)({
|
|
20
23
|
name: 'shouldOpenBrowser',
|
|
21
24
|
type: 'confirm',
|
|
22
|
-
message: i18n(isReinstall ? `${i18nKey}.reinstallPrompt` : `${i18nKey}.prompt`),
|
|
25
|
+
message: (0, lang_1.i18n)(isReinstall ? `${i18nKey}.reinstallPrompt` : `${i18nKey}.prompt`),
|
|
23
26
|
});
|
|
24
27
|
if (!isReinstall && !shouldOpenBrowser) {
|
|
25
|
-
logger.log(i18n(`${i18nKey}.decline`));
|
|
26
|
-
process.exit(EXIT_CODES.SUCCESS);
|
|
28
|
+
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.decline`));
|
|
29
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
27
30
|
}
|
|
28
31
|
else if (!shouldOpenBrowser) {
|
|
29
32
|
return;
|
|
30
33
|
}
|
|
31
|
-
const websiteOrigin = getHubSpotWebsiteOrigin(env);
|
|
34
|
+
const websiteOrigin = (0, urls_1.getHubSpotWebsiteOrigin)(env);
|
|
32
35
|
const url = `${websiteOrigin}/oauth/${targetAccountId}/authorize` +
|
|
33
36
|
`?client_id=${encodeURIComponent(clientId)}` +
|
|
34
37
|
`&scope=${encodeURIComponent(scopes.join(' '))}` +
|
|
35
38
|
`&redirect_uri=${encodeURIComponent(redirectUrls[0])}`;
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
module.exports = { installPublicAppPrompt };
|
|
39
|
+
(0, open_1.default)(url);
|
|
40
|
+
}
|
|
@@ -1 +1,29 @@
|
|
|
1
|
+
import { PromptConfig } from '../../types/Prompts';
|
|
2
|
+
type PersonalAccessKeyPromptResponse = {
|
|
3
|
+
personalAccessKey: string;
|
|
4
|
+
env: string;
|
|
5
|
+
};
|
|
6
|
+
type AccountIdPromptResponse = {
|
|
7
|
+
accountId: number;
|
|
8
|
+
};
|
|
9
|
+
type ClientIdPromptResponse = {
|
|
10
|
+
clientId: string;
|
|
11
|
+
};
|
|
12
|
+
type ClientSecretPromptResponse = {
|
|
13
|
+
clientSecret: string;
|
|
14
|
+
};
|
|
15
|
+
type ScopesPromptResponse = {
|
|
16
|
+
scopes: string[];
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Displays notification to user that we are about to open the browser,
|
|
20
|
+
* then opens their browser to the personal-access-key shortlink
|
|
21
|
+
*/
|
|
22
|
+
export declare function personalAccessKeyPrompt({ env, account, }: {
|
|
23
|
+
env: string;
|
|
24
|
+
account?: string;
|
|
25
|
+
}): Promise<PersonalAccessKeyPromptResponse>;
|
|
26
|
+
export declare const OAUTH_FLOW: (PromptConfig<{
|
|
27
|
+
name: string;
|
|
28
|
+
}> | PromptConfig<AccountIdPromptResponse> | PromptConfig<ClientIdPromptResponse> | PromptConfig<ClientSecretPromptResponse> | PromptConfig<ScopesPromptResponse>)[];
|
|
1
29
|
export {};
|
|
@@ -1,85 +1,89 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
6
|
+
exports.OAUTH_FLOW = void 0;
|
|
7
|
+
exports.personalAccessKeyPrompt = personalAccessKeyPrompt;
|
|
8
|
+
const open_1 = __importDefault(require("open"));
|
|
9
|
+
const auth_1 = require("@hubspot/local-dev-lib/constants/auth");
|
|
10
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
11
|
+
const urls_1 = require("@hubspot/local-dev-lib/urls");
|
|
12
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
13
|
+
const promptUtils_1 = require("./promptUtils");
|
|
14
|
+
const accountNamePrompt_1 = require("./accountNamePrompt");
|
|
15
|
+
const lang_1 = require("../lang");
|
|
16
|
+
const ui_1 = require("../ui");
|
|
17
|
+
const exitCodes_1 = require("../enums/exitCodes");
|
|
14
18
|
const i18nKey = 'lib.prompts.personalAccessKeyPrompt';
|
|
15
19
|
/**
|
|
16
20
|
* Displays notification to user that we are about to open the browser,
|
|
17
21
|
* then opens their browser to the personal-access-key shortlink
|
|
18
22
|
*/
|
|
19
|
-
|
|
20
|
-
const websiteOrigin = getHubSpotWebsiteOrigin(env);
|
|
23
|
+
async function personalAccessKeyPrompt({ env, account, }) {
|
|
24
|
+
const websiteOrigin = (0, urls_1.getHubSpotWebsiteOrigin)(env);
|
|
21
25
|
let url = `${websiteOrigin}/l/personal-access-key`;
|
|
22
26
|
if (process.env.BROWSER !== 'none') {
|
|
23
|
-
uiInfoSection(i18n(`${i18nKey}.personalAccessKeySetupTitle`), () => {
|
|
24
|
-
logger.log(i18n(`${i18nKey}.personalAccessKeyBrowserOpenPrep`));
|
|
27
|
+
(0, ui_1.uiInfoSection)((0, lang_1.i18n)(`${i18nKey}.personalAccessKeySetupTitle`), () => {
|
|
28
|
+
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.personalAccessKeyBrowserOpenPrep`));
|
|
25
29
|
});
|
|
26
30
|
if (account) {
|
|
27
31
|
url = `${websiteOrigin}/personal-access-key/${account}`;
|
|
28
32
|
}
|
|
29
|
-
const { personalAcessKeyBrowserOpenPrep: shouldOpen } = await promptUser([
|
|
33
|
+
const { personalAcessKeyBrowserOpenPrep: shouldOpen } = await (0, promptUtils_1.promptUser)([
|
|
30
34
|
PERSONAL_ACCESS_KEY_BROWSER_OPEN_PREP,
|
|
31
35
|
]);
|
|
32
36
|
if (shouldOpen) {
|
|
33
|
-
|
|
37
|
+
(0, open_1.default)(url, { url: true });
|
|
34
38
|
}
|
|
35
39
|
else {
|
|
36
|
-
deleteEmptyConfigFile();
|
|
37
|
-
process.exit(EXIT_CODES.SUCCESS);
|
|
40
|
+
(0, config_1.deleteEmptyConfigFile)();
|
|
41
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
38
42
|
}
|
|
39
43
|
}
|
|
40
|
-
logger.log(i18n(`${i18nKey}.logs.openingWebBrowser`, { url }));
|
|
41
|
-
const { personalAccessKey } = await promptUser(PERSONAL_ACCESS_KEY);
|
|
44
|
+
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.logs.openingWebBrowser`, { url }));
|
|
45
|
+
const { personalAccessKey } = await (0, promptUtils_1.promptUser)(PERSONAL_ACCESS_KEY);
|
|
42
46
|
return {
|
|
43
47
|
personalAccessKey,
|
|
44
48
|
env,
|
|
45
49
|
};
|
|
46
|
-
}
|
|
50
|
+
}
|
|
47
51
|
const ACCOUNT_ID = {
|
|
48
52
|
name: 'accountId',
|
|
49
|
-
message: i18n(`${i18nKey}.enterAccountId`),
|
|
53
|
+
message: (0, lang_1.i18n)(`${i18nKey}.enterAccountId`),
|
|
50
54
|
type: 'number',
|
|
51
55
|
validate(val) {
|
|
52
|
-
if (!Number.isNaN(val) && val > 0) {
|
|
56
|
+
if (!Number.isNaN(val) && val !== undefined && val > 0) {
|
|
53
57
|
return true;
|
|
54
58
|
}
|
|
55
|
-
return i18n(`${i18nKey}.errors.invalidAccountId`);
|
|
59
|
+
return (0, lang_1.i18n)(`${i18nKey}.errors.invalidAccountId`);
|
|
56
60
|
},
|
|
57
61
|
};
|
|
58
62
|
const CLIENT_ID = {
|
|
59
63
|
name: 'clientId',
|
|
60
|
-
message: i18n(`${i18nKey}.enterClientId`),
|
|
64
|
+
message: (0, lang_1.i18n)(`${i18nKey}.enterClientId`),
|
|
61
65
|
validate(val) {
|
|
62
66
|
if (typeof val !== 'string') {
|
|
63
|
-
return i18n(`${i18nKey}.errors.invalidOauthClientId`);
|
|
67
|
+
return (0, lang_1.i18n)(`${i18nKey}.errors.invalidOauthClientId`);
|
|
64
68
|
}
|
|
65
69
|
else if (val.length !== 36) {
|
|
66
|
-
return i18n(`${i18nKey}.errors.invalidOauthClientIdLength`);
|
|
70
|
+
return (0, lang_1.i18n)(`${i18nKey}.errors.invalidOauthClientIdLength`);
|
|
67
71
|
}
|
|
68
72
|
return true;
|
|
69
73
|
},
|
|
70
74
|
};
|
|
71
75
|
const CLIENT_SECRET = {
|
|
72
76
|
name: 'clientSecret',
|
|
73
|
-
message: i18n(`${i18nKey}.enterClientSecret`),
|
|
77
|
+
message: (0, lang_1.i18n)(`${i18nKey}.enterClientSecret`),
|
|
74
78
|
validate(val) {
|
|
75
79
|
if (typeof val !== 'string') {
|
|
76
|
-
return i18n(`${i18nKey}.errors.invalidOauthClientSecret`);
|
|
80
|
+
return (0, lang_1.i18n)(`${i18nKey}.errors.invalidOauthClientSecret`);
|
|
77
81
|
}
|
|
78
82
|
else if (val.length !== 36) {
|
|
79
|
-
return i18n(`${i18nKey}.errors.invalidOauthClientSecretLength`);
|
|
83
|
+
return (0, lang_1.i18n)(`${i18nKey}.errors.invalidOauthClientSecretLength`);
|
|
80
84
|
}
|
|
81
85
|
else if (val[0] === '*') {
|
|
82
|
-
return i18n(`${i18nKey}.errors.invalidOauthClientSecretCopy`);
|
|
86
|
+
return (0, lang_1.i18n)(`${i18nKey}.errors.invalidOauthClientSecretCopy`);
|
|
83
87
|
}
|
|
84
88
|
return true;
|
|
85
89
|
},
|
|
@@ -87,12 +91,12 @@ const CLIENT_SECRET = {
|
|
|
87
91
|
const PERSONAL_ACCESS_KEY_BROWSER_OPEN_PREP = {
|
|
88
92
|
name: 'personalAcessKeyBrowserOpenPrep',
|
|
89
93
|
type: 'confirm',
|
|
90
|
-
message: i18n(`${i18nKey}.personalAccessKeyBrowserOpenPrompt`),
|
|
94
|
+
message: (0, lang_1.i18n)(`${i18nKey}.personalAccessKeyBrowserOpenPrompt`),
|
|
91
95
|
};
|
|
92
96
|
const PERSONAL_ACCESS_KEY = {
|
|
93
97
|
name: 'personalAccessKey',
|
|
94
|
-
message: i18n(`${i18nKey}.enterPersonalAccessKey`),
|
|
95
|
-
transformer: val => {
|
|
98
|
+
message: (0, lang_1.i18n)(`${i18nKey}.enterPersonalAccessKey`),
|
|
99
|
+
transformer: (val) => {
|
|
96
100
|
if (!val)
|
|
97
101
|
return val;
|
|
98
102
|
let res = '';
|
|
@@ -103,10 +107,10 @@ const PERSONAL_ACCESS_KEY = {
|
|
|
103
107
|
},
|
|
104
108
|
validate(val) {
|
|
105
109
|
if (!val || typeof val !== 'string') {
|
|
106
|
-
return i18n(`${i18nKey}.errors.invalidPersonalAccessKey`);
|
|
110
|
+
return (0, lang_1.i18n)(`${i18nKey}.errors.invalidPersonalAccessKey`);
|
|
107
111
|
}
|
|
108
112
|
else if (val[0] === '•') {
|
|
109
|
-
return i18n(`${i18nKey}.errors.invalidPersonalAccessKeyCopy`);
|
|
113
|
+
return (0, lang_1.i18n)(`${i18nKey}.errors.invalidPersonalAccessKeyCopy`);
|
|
110
114
|
}
|
|
111
115
|
return true;
|
|
112
116
|
},
|
|
@@ -114,24 +118,14 @@ const PERSONAL_ACCESS_KEY = {
|
|
|
114
118
|
const SCOPES = {
|
|
115
119
|
type: 'checkbox',
|
|
116
120
|
name: 'scopes',
|
|
117
|
-
message: i18n(`${i18nKey}.selectScopes`),
|
|
118
|
-
default: DEFAULT_OAUTH_SCOPES,
|
|
119
|
-
choices: OAUTH_SCOPES,
|
|
121
|
+
message: (0, lang_1.i18n)(`${i18nKey}.selectScopes`),
|
|
122
|
+
default: [...auth_1.DEFAULT_OAUTH_SCOPES],
|
|
123
|
+
choices: [...auth_1.OAUTH_SCOPES],
|
|
120
124
|
};
|
|
121
|
-
|
|
122
|
-
getCliAccountNamePromptConfig(),
|
|
125
|
+
exports.OAUTH_FLOW = [
|
|
126
|
+
(0, accountNamePrompt_1.getCliAccountNamePromptConfig)(),
|
|
123
127
|
ACCOUNT_ID,
|
|
124
128
|
CLIENT_ID,
|
|
125
129
|
CLIENT_SECRET,
|
|
126
130
|
SCOPES,
|
|
127
131
|
];
|
|
128
|
-
module.exports = {
|
|
129
|
-
personalAccessKeyPrompt,
|
|
130
|
-
CLIENT_ID,
|
|
131
|
-
CLIENT_SECRET,
|
|
132
|
-
ACCOUNT_ID,
|
|
133
|
-
SCOPES,
|
|
134
|
-
PERSONAL_ACCESS_KEY,
|
|
135
|
-
// Flows
|
|
136
|
-
OAUTH_FLOW,
|
|
137
|
-
};
|
|
@@ -1 +1,15 @@
|
|
|
1
|
+
type PreviewPromptResponse = {
|
|
2
|
+
src: string;
|
|
3
|
+
dest: string;
|
|
4
|
+
};
|
|
5
|
+
type PreviewProjectPromptResponse = {
|
|
6
|
+
themeComponentPath: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function previewPrompt(promptOptions?: {
|
|
9
|
+
src?: string;
|
|
10
|
+
dest?: string;
|
|
11
|
+
}): Promise<PreviewPromptResponse>;
|
|
12
|
+
export declare function previewProjectPrompt(themeComponents: {
|
|
13
|
+
path: string;
|
|
14
|
+
}[]): Promise<PreviewProjectPromptResponse>;
|
|
1
15
|
export {};
|
|
@@ -1,47 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
exports.previewPrompt = previewPrompt;
|
|
7
|
+
exports.previewProjectPrompt = previewProjectPrompt;
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const path_2 = require("@hubspot/local-dev-lib/path");
|
|
10
|
+
const promptUtils_1 = require("./promptUtils");
|
|
11
|
+
const lang_1 = require("../lang");
|
|
8
12
|
const i18nKey = 'lib.prompts.previewPrompt';
|
|
9
|
-
|
|
10
|
-
return promptUser([
|
|
13
|
+
async function previewPrompt(promptOptions = {}) {
|
|
14
|
+
return (0, promptUtils_1.promptUser)([
|
|
11
15
|
{
|
|
12
16
|
name: 'src',
|
|
13
|
-
message: i18n(`${i18nKey}.enterSrc`),
|
|
17
|
+
message: (0, lang_1.i18n)(`${i18nKey}.enterSrc`),
|
|
14
18
|
when: !promptOptions.src,
|
|
15
19
|
default: '.',
|
|
16
|
-
validate: input => {
|
|
20
|
+
validate: (input) => {
|
|
17
21
|
if (!input) {
|
|
18
|
-
return i18n(`${i18nKey}.errors.srcRequired`);
|
|
22
|
+
return (0, lang_1.i18n)(`${i18nKey}.errors.srcRequired`);
|
|
19
23
|
}
|
|
20
24
|
return true;
|
|
21
25
|
},
|
|
22
26
|
},
|
|
23
27
|
{
|
|
24
28
|
name: 'dest',
|
|
25
|
-
message: i18n(`${i18nKey}.enterDest`),
|
|
29
|
+
message: (0, lang_1.i18n)(`${i18nKey}.enterDest`),
|
|
26
30
|
when: !promptOptions.dest,
|
|
27
|
-
default:
|
|
28
|
-
validate: input => {
|
|
31
|
+
default: path_1.default.basename((0, path_2.getCwd)()),
|
|
32
|
+
validate: (input) => {
|
|
29
33
|
if (!input) {
|
|
30
|
-
return i18n(`${i18nKey}.errors.destRequired`);
|
|
34
|
+
return (0, lang_1.i18n)(`${i18nKey}.errors.destRequired`);
|
|
31
35
|
}
|
|
32
36
|
return true;
|
|
33
37
|
},
|
|
34
38
|
},
|
|
35
39
|
]);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return promptUser([
|
|
40
|
+
}
|
|
41
|
+
async function previewProjectPrompt(themeComponents) {
|
|
42
|
+
return (0, promptUtils_1.promptUser)([
|
|
39
43
|
{
|
|
40
44
|
name: 'themeComponentPath',
|
|
41
|
-
message: i18n(`${i18nKey}.themeProjectSelect`),
|
|
45
|
+
message: (0, lang_1.i18n)(`${i18nKey}.themeProjectSelect`),
|
|
42
46
|
type: 'list',
|
|
43
47
|
choices: themeComponents.map(t => {
|
|
44
|
-
const themeName =
|
|
48
|
+
const themeName = path_1.default.basename(t.path);
|
|
45
49
|
return {
|
|
46
50
|
name: themeName,
|
|
47
51
|
value: t.path,
|
|
@@ -49,8 +53,4 @@ const previewProjectPrompt = async (themeComponents) => {
|
|
|
49
53
|
}),
|
|
50
54
|
},
|
|
51
55
|
]);
|
|
52
|
-
}
|
|
53
|
-
module.exports = {
|
|
54
|
-
previewPrompt,
|
|
55
|
-
previewProjectPrompt,
|
|
56
|
-
};
|
|
56
|
+
}
|
|
@@ -1 +1,10 @@
|
|
|
1
|
+
import { ProjectAddComponentData } from '../../types/Projects';
|
|
2
|
+
type ProjectAddPromptResponse = {
|
|
3
|
+
component: ProjectAddComponentData;
|
|
4
|
+
name: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function projectAddPrompt(components: ProjectAddComponentData[], promptOptions?: {
|
|
7
|
+
name?: string;
|
|
8
|
+
type?: string;
|
|
9
|
+
}): Promise<ProjectAddPromptResponse>;
|
|
1
10
|
export {};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
3
|
+
exports.projectAddPrompt = projectAddPrompt;
|
|
4
|
+
const promptUtils_1 = require("./promptUtils");
|
|
5
|
+
const lang_1 = require("../lang");
|
|
6
6
|
const i18nKey = 'lib.prompts.projectAddPrompt';
|
|
7
|
-
|
|
8
|
-
return promptUser([
|
|
7
|
+
async function projectAddPrompt(components, promptOptions = {}) {
|
|
8
|
+
return (0, promptUtils_1.promptUser)([
|
|
9
9
|
{
|
|
10
10
|
name: 'component',
|
|
11
11
|
message: () => {
|
|
12
12
|
return promptOptions.type &&
|
|
13
13
|
!components.find(t => t.path === promptOptions.type)
|
|
14
|
-
? i18n(`${i18nKey}.errors.invalidType`, {
|
|
14
|
+
? (0, lang_1.i18n)(`${i18nKey}.errors.invalidType`, {
|
|
15
15
|
type: promptOptions.type,
|
|
16
16
|
})
|
|
17
|
-
: i18n(`${i18nKey}.selectType`);
|
|
17
|
+
: (0, lang_1.i18n)(`${i18nKey}.selectType`);
|
|
18
18
|
},
|
|
19
19
|
when: !promptOptions.type ||
|
|
20
20
|
!components.find(t => t.path === promptOptions.type),
|
|
@@ -28,17 +28,14 @@ const projectAddPrompt = async (components, promptOptions = {}) => {
|
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
name: 'name',
|
|
31
|
-
message: i18n(`${i18nKey}.enterName`),
|
|
31
|
+
message: (0, lang_1.i18n)(`${i18nKey}.enterName`),
|
|
32
32
|
when: !promptOptions.name,
|
|
33
|
-
validate: input => {
|
|
33
|
+
validate: (input) => {
|
|
34
34
|
if (!input) {
|
|
35
|
-
return i18n(`${i18nKey}.errors.nameRequired`);
|
|
35
|
+
return (0, lang_1.i18n)(`${i18nKey}.errors.nameRequired`);
|
|
36
36
|
}
|
|
37
37
|
return true;
|
|
38
38
|
},
|
|
39
39
|
},
|
|
40
40
|
]);
|
|
41
|
-
}
|
|
42
|
-
module.exports = {
|
|
43
|
-
projectAddPrompt,
|
|
44
|
-
};
|
|
41
|
+
}
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { CLIAccount, AccountType } from '@hubspot/local-dev-lib/types/Accounts';
|
|
2
|
+
import { DeveloperTestAccount } from '@hubspot/local-dev-lib/types/developerTestAccounts';
|
|
3
|
+
export declare function selectSandboxTargetAccountPrompt(accounts: CLIAccount[], defaultAccountConfig: CLIAccount): Promise<DeveloperTestAccount | CLIAccount>;
|
|
4
|
+
export declare function selectDeveloperTestTargetAccountPrompt(accounts: CLIAccount[], defaultAccountConfig: CLIAccount): Promise<DeveloperTestAccount | CLIAccount>;
|
|
5
|
+
export declare function confirmDefaultAccountPrompt(accountName: string, accountType: AccountType): Promise<boolean>;
|
|
6
|
+
export declare function confirmUseExistingDeveloperTestAccountPrompt(account: DeveloperTestAccount): Promise<boolean>;
|