@hubspot/cli 7.5.11-experimental.0 → 7.6.0-beta.1
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 +102 -95
- package/commands/account/auth.d.ts +5 -7
- package/commands/account/auth.js +74 -87
- package/commands/account/clean.d.ts +3 -7
- package/commands/account/clean.js +16 -9
- package/commands/account/createOverride.d.ts +3 -7
- package/commands/account/createOverride.js +23 -6
- package/commands/account/info.d.ts +3 -7
- package/commands/account/info.js +13 -5
- package/commands/account/list.d.ts +3 -7
- package/commands/account/list.js +15 -8
- package/commands/account/remove.d.ts +3 -7
- package/commands/account/remove.js +21 -9
- package/commands/account/removeOverride.d.ts +3 -7
- package/commands/account/removeOverride.js +23 -6
- package/commands/account/rename.d.ts +3 -7
- package/commands/account/rename.js +16 -9
- package/commands/account/use.d.ts +5 -9
- package/commands/account/use.js +14 -6
- package/commands/account.d.ts +3 -4
- package/commands/account.js +33 -58
- package/commands/app/migrate.d.ts +1 -2
- package/commands/app/migrate.js +7 -8
- package/commands/app/secret/add.d.ts +7 -0
- package/commands/app/secret/add.js +64 -0
- package/commands/app/secret/delete.d.ts +8 -0
- package/commands/app/secret/delete.js +87 -0
- package/commands/app/secret/list.d.ts +6 -0
- package/commands/app/secret/list.js +64 -0
- package/commands/app/secret/update.d.ts +7 -0
- package/commands/app/secret/update.js +77 -0
- package/commands/app/secret.d.ts +3 -0
- package/commands/app/secret.js +30 -0
- package/commands/app.d.ts +2 -5
- package/commands/app.js +10 -8
- package/commands/auth.d.ts +5 -7
- package/commands/auth.js +29 -28
- package/commands/cms/convertFields.d.ts +7 -1
- package/commands/cms/convertFields.js +57 -41
- package/commands/cms/getReactModule.d.ts +7 -1
- package/commands/cms/getReactModule.js +52 -34
- package/commands/cms/lighthouseScore.d.ts +8 -1
- package/commands/cms/lighthouseScore.js +129 -100
- package/commands/cms.d.ts +3 -1
- package/commands/cms.js +22 -15
- package/commands/completion.d.ts +3 -1
- package/commands/completion.js +23 -12
- package/commands/config/migrate.d.ts +3 -7
- package/commands/config/migrate.js +37 -46
- package/commands/config/set.d.ts +5 -6
- package/commands/config/set.js +38 -14
- package/commands/config.d.ts +3 -4
- package/commands/config.js +18 -44
- package/commands/create/api-sample.d.ts +3 -1
- package/commands/create/api-sample.js +34 -38
- package/commands/create/app.d.ts +3 -1
- package/commands/create/app.js +9 -7
- package/commands/create/function.d.ts +3 -1
- package/commands/create/function.js +11 -10
- package/commands/create/index.d.ts +5 -1
- package/commands/create/index.js +23 -11
- package/commands/create/module.d.ts +3 -1
- package/commands/create/module.js +14 -13
- package/commands/create/react-app.d.ts +3 -1
- package/commands/create/react-app.js +10 -7
- package/commands/create/template.d.ts +3 -1
- package/commands/create/template.js +14 -14
- package/commands/create/vue-app.d.ts +3 -1
- package/commands/create/vue-app.js +10 -7
- package/commands/create/webpack-serverless.d.ts +3 -1
- package/commands/create/webpack-serverless.js +10 -7
- package/commands/create/website-theme.d.ts +3 -1
- package/commands/create/website-theme.js +10 -9
- package/commands/create.d.ts +4 -24
- package/commands/create.js +62 -74
- package/commands/customObject/create.d.ts +4 -9
- package/commands/customObject/create.js +17 -10
- package/commands/customObject/schema/create.d.ts +4 -9
- package/commands/customObject/schema/create.js +18 -11
- package/commands/customObject/schema/delete.d.ts +4 -9
- package/commands/customObject/schema/delete.js +17 -10
- package/commands/customObject/schema/fetch-all.d.ts +4 -9
- package/commands/customObject/schema/fetch-all.js +17 -10
- package/commands/customObject/schema/fetch.d.ts +4 -9
- package/commands/customObject/schema/fetch.js +17 -10
- package/commands/customObject/schema/list.d.ts +4 -8
- package/commands/customObject/schema/list.js +17 -10
- package/commands/customObject/schema/update.d.ts +4 -9
- package/commands/customObject/schema/update.js +18 -11
- package/commands/customObject/schema.d.ts +3 -5
- package/commands/customObject/schema.js +27 -54
- package/commands/customObject.d.ts +3 -4
- package/commands/customObject.js +18 -45
- package/commands/doctor.d.ts +6 -8
- package/commands/doctor.js +30 -21
- package/commands/feedback.d.ts +4 -1
- package/commands/feedback.js +38 -47
- package/commands/fetch.d.ts +12 -1
- package/commands/fetch.js +49 -33
- package/commands/filemanager/fetch.d.ts +4 -9
- package/commands/filemanager/fetch.js +18 -11
- package/commands/filemanager/upload.d.ts +4 -9
- package/commands/filemanager/upload.js +17 -11
- package/commands/filemanager.d.ts +3 -4
- package/commands/filemanager.js +18 -41
- package/commands/function/deploy.d.ts +6 -1
- package/commands/function/deploy.js +70 -50
- package/commands/function/list.d.ts +6 -1
- package/commands/function/list.js +44 -32
- package/commands/function/server.d.ts +10 -1
- package/commands/function/server.js +49 -38
- package/commands/function.d.ts +5 -1
- package/commands/function.js +22 -10
- package/commands/getStarted.d.ts +9 -0
- package/commands/getStarted.js +227 -0
- package/commands/hubdb/clear.d.ts +4 -9
- package/commands/hubdb/clear.js +17 -10
- package/commands/hubdb/create.d.ts +4 -9
- package/commands/hubdb/create.js +17 -10
- package/commands/hubdb/delete.d.ts +4 -9
- package/commands/hubdb/delete.js +17 -10
- package/commands/hubdb/fetch.d.ts +4 -9
- package/commands/hubdb/fetch.js +17 -10
- package/commands/hubdb/list.d.ts +4 -0
- package/commands/hubdb/list.js +83 -0
- package/commands/hubdb.d.ts +3 -2
- package/commands/hubdb.js +23 -45
- package/commands/init.d.ts +3 -7
- package/commands/init.js +17 -8
- package/commands/lint.d.ts +6 -4
- package/commands/lint.js +42 -43
- package/commands/list.d.ts +3 -7
- package/commands/list.js +17 -11
- package/commands/logs.d.ts +10 -1
- package/commands/logs.js +53 -44
- package/commands/mcp/setup.d.ts +7 -0
- package/commands/mcp/setup.js +52 -0
- package/commands/mcp/start.d.ts +3 -0
- package/commands/mcp/start.js +77 -0
- package/commands/mcp.d.ts +3 -0
- package/commands/mcp.js +26 -0
- package/commands/module/marketplace-validate.d.ts +6 -1
- package/commands/module/marketplace-validate.js +39 -29
- package/commands/module.d.ts +3 -1
- package/commands/module.js +23 -10
- package/commands/mv.d.ts +3 -7
- package/commands/mv.js +17 -11
- package/commands/open.d.ts +3 -7
- package/commands/open.js +17 -11
- package/commands/project/add.d.ts +5 -2
- package/commands/project/add.js +43 -80
- package/commands/project/cloneApp.d.ts +1 -1
- package/commands/project/cloneApp.js +2 -2
- package/commands/project/create.d.ts +2 -8
- package/commands/project/create.js +84 -55
- package/commands/project/deploy.d.ts +2 -0
- package/commands/project/deploy.js +67 -13
- package/commands/project/dev/deprecatedFlow.d.ts +8 -2
- package/commands/project/dev/deprecatedFlow.js +9 -1
- package/commands/project/dev/index.d.ts +1 -4
- package/commands/project/dev/index.js +88 -31
- package/commands/project/dev/unifiedFlow.d.ts +11 -2
- package/commands/project/dev/unifiedFlow.js +81 -41
- package/commands/project/listBuilds.js +2 -5
- package/commands/project/migrate.d.ts +1 -0
- package/commands/project/profile/add.d.ts +7 -0
- package/commands/project/profile/add.js +209 -0
- package/commands/project/profile/delete.d.ts +6 -0
- package/commands/project/profile/delete.js +123 -0
- package/commands/project/profile.d.ts +3 -0
- package/commands/project/profile.js +25 -0
- package/commands/project/upload.d.ts +1 -0
- package/commands/project/upload.js +22 -8
- package/commands/project/validate.d.ts +6 -0
- package/commands/project/validate.js +82 -0
- package/commands/project.js +4 -2
- package/commands/remove.d.ts +3 -7
- package/commands/remove.js +22 -22
- package/commands/sandbox/create.d.ts +4 -9
- package/commands/sandbox/create.js +18 -11
- package/commands/sandbox/delete.d.ts +4 -9
- package/commands/sandbox/delete.js +18 -11
- package/commands/sandbox.d.ts +3 -4
- package/commands/sandbox.js +18 -43
- package/commands/secret/addSecret.d.ts +4 -9
- package/commands/secret/addSecret.js +17 -10
- package/commands/secret/deleteSecret.d.ts +4 -9
- package/commands/secret/deleteSecret.js +17 -10
- package/commands/secret/listSecret.d.ts +4 -9
- package/commands/secret/listSecret.js +17 -10
- package/commands/secret/updateSecret.d.ts +4 -9
- package/commands/secret/updateSecret.js +17 -10
- package/commands/secret.d.ts +3 -4
- package/commands/secret.js +23 -48
- package/commands/testAccount/create.d.ts +6 -0
- package/commands/testAccount/create.js +100 -0
- package/commands/testAccount/createConfig.d.ts +10 -0
- package/commands/testAccount/createConfig.js +98 -0
- package/commands/testAccount/delete.d.ts +6 -0
- package/commands/testAccount/delete.js +48 -0
- package/commands/testAccount.d.ts +3 -0
- package/commands/testAccount.js +28 -0
- package/commands/theme/generate-selectors.d.ts +3 -7
- package/commands/theme/generate-selectors.js +20 -15
- package/commands/theme/marketplace-validate.d.ts +4 -9
- package/commands/theme/marketplace-validate.js +22 -17
- package/commands/theme/preview.d.ts +4 -9
- package/commands/theme/preview.js +32 -26
- package/commands/theme.d.ts +3 -4
- package/commands/theme.js +22 -47
- package/commands/upload.d.ts +12 -1
- package/commands/upload.js +116 -134
- package/commands/watch.d.ts +14 -1
- package/commands/watch.js +74 -75
- package/lang/en.d.ts +1135 -660
- package/lang/en.js +935 -471
- package/lang/en.lyaml +30 -213
- package/lib/accountTypes.js +1 -2
- package/lib/app/migrate.d.ts +23 -0
- package/lib/app/migrate.js +29 -6
- package/lib/app/migrate_legacy.js +7 -7
- package/lib/app/urls.d.ts +16 -0
- package/lib/app/urls.js +16 -0
- package/lib/commonOpts.d.ts +1 -3
- package/lib/commonOpts.js +1 -1
- package/lib/configMigrate.d.ts +2 -2
- package/lib/configMigrate.js +34 -55
- package/lib/configOptions.d.ts +4 -0
- package/lib/configOptions.js +41 -46
- package/lib/constants.d.ts +29 -0
- package/lib/constants.js +30 -1
- package/lib/dependencyManagement.d.ts +0 -5
- package/lib/dependencyManagement.js +13 -39
- package/lib/doctor/Doctor.js +3 -2
- package/lib/errorHandlers/index.js +7 -0
- package/lib/filesystem.d.ts +1 -1
- package/lib/generateSelectors.js +3 -5
- package/lib/interpolation.d.ts +2 -3
- package/lib/lang.d.ts +2 -3
- package/lib/marketplaceValidate.d.ts +12 -2
- package/lib/marketplaceValidate.js +22 -29
- package/lib/mcp/setup.d.ts +21 -0
- package/lib/mcp/setup.js +218 -0
- package/lib/middleware/autoUpdateMiddleware.d.ts +1 -0
- package/lib/middleware/autoUpdateMiddleware.js +89 -0
- package/lib/middleware/configMiddleware.js +23 -0
- package/lib/middleware/fireAlarmMiddleware.d.ts +2 -2
- package/lib/middleware/fireAlarmMiddleware.js +5 -3
- package/lib/npm.d.ts +9 -0
- package/lib/npm.js +36 -0
- package/lib/projectProfiles.d.ts +7 -0
- package/lib/projectProfiles.js +83 -0
- package/lib/projects/add/legacyAddComponent.d.ts +5 -0
- package/lib/projects/add/legacyAddComponent.js +48 -0
- package/lib/projects/add/v3AddComponent.d.ts +8 -0
- package/lib/projects/add/v3AddComponent.js +85 -0
- package/lib/projects/buildAndDeploy.js +18 -3
- package/lib/projects/components.d.ts +2 -0
- package/lib/projects/components.js +82 -0
- package/lib/projects/create/index.d.ts +23 -0
- package/lib/projects/create/index.js +33 -0
- package/lib/projects/create/legacy.d.ts +6 -0
- package/lib/projects/{create.js → create/legacy.js} +20 -11
- package/lib/projects/create/v3.d.ts +27 -0
- package/lib/projects/create/v3.js +158 -0
- package/lib/projects/localDev/AppDevModeInterface.d.ts +30 -0
- package/lib/projects/localDev/AppDevModeInterface.js +215 -0
- package/lib/projects/localDev/DevServerManagerV2.d.ts +11 -22
- package/lib/projects/localDev/DevServerManagerV2.js +19 -15
- package/lib/projects/localDev/LocalDevLogger.d.ts +30 -0
- package/lib/projects/localDev/LocalDevLogger.js +159 -0
- package/lib/projects/localDev/LocalDevManager.js +12 -5
- package/lib/projects/localDev/LocalDevProcess.d.ts +34 -0
- package/lib/projects/localDev/LocalDevProcess.js +201 -0
- package/lib/projects/localDev/LocalDevState.d.ts +50 -0
- package/lib/projects/localDev/LocalDevState.js +119 -0
- package/lib/projects/localDev/LocalDevWatcher.d.ts +10 -0
- package/lib/projects/localDev/LocalDevWatcher.js +53 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +20 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.js +131 -0
- package/lib/projects/localDev/helpers.d.ts +3 -2
- package/lib/projects/localDev/helpers.js +32 -2
- package/lib/projects/upload.d.ts +5 -1
- package/lib/projects/upload.js +60 -20
- package/lib/projects/urls.d.ts +3 -0
- package/lib/projects/urls.js +17 -1
- package/lib/prompts/createApiSamplePrompt.d.ts +2 -10
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.d.ts +17 -0
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +96 -0
- package/lib/prompts/createProjectPrompt.d.ts +14 -5
- package/lib/prompts/createProjectPrompt.js +38 -13
- package/lib/prompts/createTemplatePrompt.d.ts +22 -4
- package/lib/prompts/installAppPrompt.d.ts +2 -0
- package/lib/prompts/installAppPrompt.js +45 -0
- package/lib/prompts/personalAccessKeyPrompt.js +35 -24
- package/lib/prompts/projectAddPrompt.d.ts +5 -1
- package/lib/prompts/projectAddPrompt.js +35 -7
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +6 -1
- package/lib/prompts/projectDevTargetAccountPrompt.js +6 -6
- package/lib/prompts/promptUtils.d.ts +4 -1
- package/lib/prompts/promptUtils.js +5 -1
- package/lib/prompts/selectAppPrompt.d.ts +2 -0
- package/lib/prompts/selectAppPrompt.js +40 -0
- package/lib/prompts/{selectPublicAppPrompt.d.ts → selectPublicAppForMigrationPrompt.d.ts} +1 -1
- package/lib/prompts/{selectPublicAppPrompt.js → selectPublicAppForMigrationPrompt.js} +8 -8
- package/lib/prompts/setAsDefaultAccountPrompt.js +10 -0
- package/lib/testUtils.d.ts +3 -3
- package/lib/testUtils.js +8 -9
- package/lib/ui/index.js +4 -1
- package/lib/upload.d.ts +1 -1
- package/lib/validation.js +4 -5
- package/lib/yargsUtils.d.ts +4 -0
- package/lib/yargsUtils.js +6 -0
- package/mcp-server/server.d.ts +1 -0
- package/mcp-server/server.js +18 -0
- package/mcp-server/tools/index.d.ts +2 -0
- package/mcp-server/tools/index.js +19 -0
- package/mcp-server/tools/project/AddFeatureToProject.d.ts +29 -0
- package/mcp-server/tools/project/AddFeatureToProject.js +85 -0
- package/mcp-server/tools/project/CreateProjectTool.d.ts +35 -0
- package/mcp-server/tools/project/CreateProjectTool.js +104 -0
- package/mcp-server/tools/project/DeployProject.d.ts +20 -0
- package/mcp-server/tools/project/DeployProject.js +50 -0
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +17 -0
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +58 -0
- package/mcp-server/tools/project/UploadProjectTools.d.ts +17 -0
- package/mcp-server/tools/project/UploadProjectTools.js +35 -0
- package/mcp-server/tools/project/ValidateProjectTool.d.ts +17 -0
- package/mcp-server/tools/project/ValidateProjectTool.js +35 -0
- package/mcp-server/tools/project/constants.d.ts +3 -0
- package/mcp-server/tools/project/constants.js +13 -0
- package/mcp-server/types.d.ts +14 -0
- package/mcp-server/types.js +17 -0
- package/mcp-server/utils/command.d.ts +3 -0
- package/mcp-server/utils/command.js +16 -0
- package/mcp-server/utils/content.d.ts +3 -0
- package/mcp-server/utils/content.js +21 -0
- package/mcp-server/utils/project.d.ts +5 -0
- package/mcp-server/utils/project.js +17 -0
- package/package.json +24 -16
- package/types/Cms.d.ts +30 -0
- package/types/Cms.js +2 -0
- package/types/LocalDev.d.ts +35 -0
- package/types/LocalDev.js +2 -0
- package/types/Projects.d.ts +19 -2
- package/types/Prompts.d.ts +0 -7
- package/types/Yargs.d.ts +10 -1
- package/lib/projects/create.d.ts +0 -5
- package/lib/projects/localDev/LocalDevManagerV2.d.ts +0 -64
- package/lib/projects/localDev/LocalDevManagerV2.js +0 -345
- package/lib/prompts/installPublicAppPrompt.d.ts +0 -1
- package/lib/prompts/installPublicAppPrompt.js +0 -41
package/lib/projects/upload.js
CHANGED
|
@@ -4,21 +4,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.handleProjectUpload = handleProjectUpload;
|
|
7
|
+
exports.validateSourceDirectory = validateSourceDirectory;
|
|
8
|
+
exports.validateNoHSMetaMismatch = validateNoHSMetaMismatch;
|
|
9
|
+
exports.handleTranslate = handleTranslate;
|
|
7
10
|
const archiver_1 = __importDefault(require("archiver"));
|
|
8
11
|
const tmp_1 = __importDefault(require("tmp"));
|
|
9
12
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
10
13
|
const path_1 = __importDefault(require("path"));
|
|
11
14
|
const projects_1 = require("@hubspot/local-dev-lib/api/projects");
|
|
12
15
|
const ignoreRules_1 = require("@hubspot/local-dev-lib/ignoreRules");
|
|
16
|
+
const project_parsing_lib_1 = require("@hubspot/project-parsing-lib");
|
|
13
17
|
const SpinniesManager_1 = __importDefault(require("../ui/SpinniesManager"));
|
|
14
18
|
const ui_1 = require("../ui");
|
|
15
|
-
const exitCodes_1 = require("../enums/exitCodes");
|
|
16
|
-
const project_parsing_lib_1 = require("@hubspot/project-parsing-lib");
|
|
17
19
|
const errorHandlers_1 = require("../errorHandlers");
|
|
18
20
|
const node_util_1 = __importDefault(require("node:util"));
|
|
19
21
|
const en_1 = require("../../lang/en");
|
|
20
22
|
const ensureProjectExists_1 = require("./ensureProjectExists");
|
|
21
23
|
const logger_1 = require("../ui/logger");
|
|
24
|
+
const buildAndDeploy_1 = require("./buildAndDeploy");
|
|
25
|
+
const exitCodes_1 = require("../enums/exitCodes");
|
|
22
26
|
async function uploadProjectFiles(accountId, projectName, filePath, uploadMessage, platformVersion, intermediateRepresentation) {
|
|
23
27
|
SpinniesManager_1.default.init({});
|
|
24
28
|
const accountIdentifier = (0, ui_1.uiAccountDescription)(accountId);
|
|
@@ -46,12 +50,21 @@ async function uploadProjectFiles(accountId, projectName, filePath, uploadMessag
|
|
|
46
50
|
}
|
|
47
51
|
return { buildId, error };
|
|
48
52
|
}
|
|
49
|
-
async function handleProjectUpload({ accountId, projectConfig, projectDir, callbackFunc, uploadMessage = '', forceCreate = false, isUploadCommand = false, sendIR = false, skipValidation = false, }) {
|
|
53
|
+
async function handleProjectUpload({ accountId, projectConfig, projectDir, callbackFunc, profile, uploadMessage = '', forceCreate = false, isUploadCommand = false, sendIR = false, skipValidation = false, }) {
|
|
50
54
|
const srcDir = path_1.default.resolve(projectDir, projectConfig.srcDir);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
try {
|
|
56
|
+
validateSourceDirectory(srcDir, projectConfig);
|
|
57
|
+
}
|
|
58
|
+
catch (e) {
|
|
59
|
+
(0, errorHandlers_1.logError)(e);
|
|
60
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
await validateNoHSMetaMismatch(srcDir, projectConfig);
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
(0, errorHandlers_1.logError)(e);
|
|
67
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
55
68
|
}
|
|
56
69
|
const tempFile = tmp_1.default.fileSync({ postfix: '.zip' });
|
|
57
70
|
logger_1.uiLogger.debug(en_1.lib.projectUpload.handleProjectUpload.compressing(tempFile.name));
|
|
@@ -62,21 +75,11 @@ async function handleProjectUpload({ accountId, projectConfig, projectDir, callb
|
|
|
62
75
|
let intermediateRepresentation;
|
|
63
76
|
if (sendIR) {
|
|
64
77
|
try {
|
|
65
|
-
intermediateRepresentation = await (
|
|
66
|
-
projectSourceDir: path_1.default.join(projectDir, projectConfig.srcDir),
|
|
67
|
-
platformVersion: projectConfig.platformVersion,
|
|
68
|
-
accountId,
|
|
69
|
-
}, { skipValidation });
|
|
70
|
-
logger_1.uiLogger.debug(node_util_1.default.inspect(intermediateRepresentation, false, null, true));
|
|
78
|
+
intermediateRepresentation = await handleTranslate(projectDir, projectConfig, accountId, skipValidation, profile);
|
|
71
79
|
}
|
|
72
80
|
catch (e) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
(0, errorHandlers_1.logError)(e);
|
|
78
|
-
}
|
|
79
|
-
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
81
|
+
(0, errorHandlers_1.logError)(e);
|
|
82
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
80
83
|
}
|
|
81
84
|
}
|
|
82
85
|
await (0, ensureProjectExists_1.ensureProjectExists)(accountId, projectConfig.name, {
|
|
@@ -110,3 +113,40 @@ async function handleProjectUpload({ accountId, projectConfig, projectDir, callb
|
|
|
110
113
|
archive.finalize();
|
|
111
114
|
return result;
|
|
112
115
|
}
|
|
116
|
+
function validateSourceDirectory(srcDir, projectConfig) {
|
|
117
|
+
const filenames = fs_extra_1.default.readdirSync(srcDir);
|
|
118
|
+
if (!filenames || filenames.length === 0) {
|
|
119
|
+
const validationError = new Error(en_1.lib.projectUpload.handleProjectUpload.emptySource(projectConfig.srcDir));
|
|
120
|
+
validationError.name = 'ProjectValidationError';
|
|
121
|
+
throw validationError;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
async function validateNoHSMetaMismatch(srcDir, projectConfig) {
|
|
125
|
+
const hasHsMetaFiles = await (0, project_parsing_lib_1.projectContainsHsMetaFiles)(srcDir);
|
|
126
|
+
if (!(0, buildAndDeploy_1.useV3Api)(projectConfig.platformVersion) && hasHsMetaFiles) {
|
|
127
|
+
const validationError = new Error(en_1.lib.projectUpload.wrongPlatformVersionMetaFiles);
|
|
128
|
+
validationError.name = 'ProjectValidationError';
|
|
129
|
+
throw validationError;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async function handleTranslate(projectDir, projectConfig, accountId, skipValidation, profile) {
|
|
133
|
+
try {
|
|
134
|
+
const intermediateRepresentation = await (0, project_parsing_lib_1.translate)({
|
|
135
|
+
projectSourceDir: path_1.default.join(projectDir, projectConfig.srcDir),
|
|
136
|
+
platformVersion: projectConfig.platformVersion,
|
|
137
|
+
accountId,
|
|
138
|
+
}, { skipValidation, profile });
|
|
139
|
+
logger_1.uiLogger.debug(node_util_1.default.inspect(intermediateRepresentation, false, null, true));
|
|
140
|
+
return intermediateRepresentation;
|
|
141
|
+
}
|
|
142
|
+
catch (e) {
|
|
143
|
+
if ((0, project_parsing_lib_1.isTranslationError)(e)) {
|
|
144
|
+
const validationError = new Error(e.toString());
|
|
145
|
+
validationError.name = 'ProjectValidationError';
|
|
146
|
+
throw validationError;
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
(0, errorHandlers_1.logError)(e);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
package/lib/projects/urls.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
export declare function getProjectComponentDistributionUrl(projectName: string, componentName: string, accountId: number): string;
|
|
2
|
+
export declare function getDeveloperOverviewUrl(accountId: number): string;
|
|
1
3
|
export declare function getProjectDetailUrl(projectName: string, accountId: number): string | undefined;
|
|
2
4
|
export declare function getProjectSettingsUrl(projectName: string, accountId: number): string | undefined;
|
|
3
5
|
export declare function getProjectActivityUrl(projectName: string, accountId: number): string;
|
|
4
6
|
export declare function getProjectBuildDetailUrl(projectName: string, buildId: number, accountId: number): string;
|
|
5
7
|
export declare function getProjectDeployDetailUrl(projectName: string, deployId: number, accountId: number): string;
|
|
8
|
+
export declare function getLocalDevUiUrl(accountId: number): string;
|
package/lib/projects/urls.js
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getProjectComponentDistributionUrl = getProjectComponentDistributionUrl;
|
|
4
|
+
exports.getDeveloperOverviewUrl = getDeveloperOverviewUrl;
|
|
3
5
|
exports.getProjectDetailUrl = getProjectDetailUrl;
|
|
4
6
|
exports.getProjectSettingsUrl = getProjectSettingsUrl;
|
|
5
7
|
exports.getProjectActivityUrl = getProjectActivityUrl;
|
|
6
8
|
exports.getProjectBuildDetailUrl = getProjectBuildDetailUrl;
|
|
7
9
|
exports.getProjectDeployDetailUrl = getProjectDeployDetailUrl;
|
|
10
|
+
exports.getLocalDevUiUrl = getLocalDevUiUrl;
|
|
8
11
|
const urls_1 = require("@hubspot/local-dev-lib/urls");
|
|
9
12
|
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
10
13
|
const environments_1 = require("@hubspot/local-dev-lib/constants/environments");
|
|
14
|
+
function getBaseUrl(accountId) {
|
|
15
|
+
return (0, urls_1.getHubSpotWebsiteOrigin)((0, config_1.getEnv)(accountId) === 'qa' ? environments_1.ENVIRONMENTS.QA : environments_1.ENVIRONMENTS.PROD);
|
|
16
|
+
}
|
|
11
17
|
function getProjectHomeUrl(accountId) {
|
|
18
|
+
return `${getBaseUrl(accountId)}/developer-projects/${accountId}`;
|
|
19
|
+
}
|
|
20
|
+
function getProjectComponentDistributionUrl(projectName, componentName, accountId) {
|
|
12
21
|
const baseUrl = (0, urls_1.getHubSpotWebsiteOrigin)((0, config_1.getEnv)(accountId) === 'qa' ? environments_1.ENVIRONMENTS.QA : environments_1.ENVIRONMENTS.PROD);
|
|
13
|
-
return `${baseUrl}/developer-projects/${accountId}`;
|
|
22
|
+
return `${baseUrl}/developer-projects/${accountId}/project/${projectName}/component/${componentName}/distribution`;
|
|
23
|
+
}
|
|
24
|
+
function getDeveloperOverviewUrl(accountId) {
|
|
25
|
+
const baseUrl = (0, urls_1.getHubSpotWebsiteOrigin)((0, config_1.getEnv)(accountId) === 'qa' ? environments_1.ENVIRONMENTS.QA : environments_1.ENVIRONMENTS.PROD);
|
|
26
|
+
return `${baseUrl}/developer-overview/${accountId}`;
|
|
14
27
|
}
|
|
15
28
|
function getProjectDetailUrl(projectName, accountId) {
|
|
16
29
|
if (!projectName)
|
|
@@ -31,3 +44,6 @@ function getProjectBuildDetailUrl(projectName, buildId, accountId) {
|
|
|
31
44
|
function getProjectDeployDetailUrl(projectName, deployId, accountId) {
|
|
32
45
|
return `${getProjectActivityUrl(projectName, accountId)}/deploy/${deployId}`;
|
|
33
46
|
}
|
|
47
|
+
function getLocalDevUiUrl(accountId) {
|
|
48
|
+
return `${getBaseUrl(accountId)}/developer-projects-local-dev/${accountId}`;
|
|
49
|
+
}
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
name: string;
|
|
3
|
-
description: string;
|
|
4
|
-
id: string;
|
|
5
|
-
languages: string[];
|
|
6
|
-
};
|
|
7
|
-
type SampleConfig = {
|
|
8
|
-
samples: SampleChoice[];
|
|
9
|
-
};
|
|
1
|
+
import { ApiSampleConfig } from '../../types/Cms';
|
|
10
2
|
type SampleTypePromptResponse = {
|
|
11
3
|
sampleType?: string;
|
|
12
4
|
};
|
|
@@ -14,5 +6,5 @@ type LanguagePromptResponse = {
|
|
|
14
6
|
sampleLanguage?: string;
|
|
15
7
|
};
|
|
16
8
|
type CreateApiSamplePromptResponse = SampleTypePromptResponse & LanguagePromptResponse;
|
|
17
|
-
export declare function createApiSamplePrompt(samplesConfig:
|
|
9
|
+
export declare function createApiSamplePrompt(samplesConfig: ApiSampleConfig): Promise<CreateApiSamplePromptResponse>;
|
|
18
10
|
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DeveloperTestAccountConfig } from '@hubspot/local-dev-lib/types/developerTestAccounts';
|
|
2
|
+
declare const hubs: {
|
|
3
|
+
readonly MARKETING: "marketingLevel";
|
|
4
|
+
readonly OPS: "opsLevel";
|
|
5
|
+
readonly SERVICE: "serviceLevel";
|
|
6
|
+
readonly SALES: "salesLevel";
|
|
7
|
+
readonly CONTENT: "contentLevel";
|
|
8
|
+
};
|
|
9
|
+
type HubName = keyof typeof hubs;
|
|
10
|
+
type HubTier = 'STARTER' | 'PROFESSIONAL' | 'ENTERPRISE';
|
|
11
|
+
export type HubConfig = `${HubName}:${HubTier}`;
|
|
12
|
+
export declare function createDeveloperTestAccountConfigPrompt(args?: {
|
|
13
|
+
name?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
tiers?: HubConfig[];
|
|
16
|
+
}): Promise<DeveloperTestAccountConfig>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createDeveloperTestAccountConfigPrompt = createDeveloperTestAccountConfigPrompt;
|
|
4
|
+
const en_1 = require("../../lang/en");
|
|
5
|
+
const promptUtils_1 = require("./promptUtils");
|
|
6
|
+
const hubs = {
|
|
7
|
+
MARKETING: 'marketingLevel',
|
|
8
|
+
OPS: 'opsLevel',
|
|
9
|
+
SERVICE: 'serviceLevel',
|
|
10
|
+
SALES: 'salesLevel',
|
|
11
|
+
CONTENT: 'contentLevel',
|
|
12
|
+
};
|
|
13
|
+
const TEST_ACCOUNT_TIERS = [
|
|
14
|
+
{ name: 'Marketing STARTER', value: 'MARKETING:STARTER' },
|
|
15
|
+
{
|
|
16
|
+
name: 'Marketing PROFESSIONAL',
|
|
17
|
+
value: 'MARKETING:PROFESSIONAL',
|
|
18
|
+
},
|
|
19
|
+
{ name: 'Marketing ENTERPRISE', value: 'MARKETING:ENTERPRISE' },
|
|
20
|
+
promptUtils_1.Separator,
|
|
21
|
+
{ name: 'Ops STARTER', value: 'OPS:STARTER' },
|
|
22
|
+
{ name: 'Ops PROFESSIONAL', value: 'OPS:PROFESSIONAL' },
|
|
23
|
+
{ name: 'Ops ENTERPRISE', value: 'OPS:ENTERPRISE' },
|
|
24
|
+
promptUtils_1.Separator,
|
|
25
|
+
{ name: 'Service STARTER', value: 'SERVICE:STARTER' },
|
|
26
|
+
{ name: 'Service PROFESSIONAL', value: 'SERVICE:PROFESSIONAL' },
|
|
27
|
+
{ name: 'Service ENTERPRISE', value: 'SERVICE:ENTERPRISE' },
|
|
28
|
+
promptUtils_1.Separator,
|
|
29
|
+
{ name: 'Sales STARTER', value: 'SALES:STARTER' },
|
|
30
|
+
{ name: 'Sales PROFESSIONAL', value: 'SALES:PROFESSIONAL' },
|
|
31
|
+
{ name: 'Sales ENTERPRISE', value: 'SALES:ENTERPRISE' },
|
|
32
|
+
promptUtils_1.Separator,
|
|
33
|
+
{ name: 'Content STARTER', value: 'CONTENT:STARTER' },
|
|
34
|
+
{ name: 'Content PROFESSIONAL', value: 'CONTENT:PROFESSIONAL' },
|
|
35
|
+
{ name: 'Content ENTERPRISE', value: 'CONTENT:ENTERPRISE' },
|
|
36
|
+
promptUtils_1.Separator,
|
|
37
|
+
];
|
|
38
|
+
async function createDeveloperTestAccountConfigPrompt(args = {}) {
|
|
39
|
+
const { name, description, tiers } = args;
|
|
40
|
+
let accountName = name;
|
|
41
|
+
let accountDescription = description;
|
|
42
|
+
let accountLevelsArray = tiers;
|
|
43
|
+
if (!accountName) {
|
|
44
|
+
const namePromptResult = await (0, promptUtils_1.promptUser)({
|
|
45
|
+
name: 'accountName',
|
|
46
|
+
message: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.namePrompt,
|
|
47
|
+
type: 'input',
|
|
48
|
+
});
|
|
49
|
+
accountName = namePromptResult.accountName;
|
|
50
|
+
}
|
|
51
|
+
if (!accountDescription) {
|
|
52
|
+
const descriptionPromptResult = await (0, promptUtils_1.promptUser)({
|
|
53
|
+
name: 'description',
|
|
54
|
+
message: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.descriptionPrompt,
|
|
55
|
+
type: 'input',
|
|
56
|
+
});
|
|
57
|
+
accountDescription = descriptionPromptResult.description;
|
|
58
|
+
}
|
|
59
|
+
if (!accountLevelsArray) {
|
|
60
|
+
const accountLevelsPromptResult = await (0, promptUtils_1.promptUser)({
|
|
61
|
+
name: 'testAccountLevels',
|
|
62
|
+
message: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.tiersPrompt,
|
|
63
|
+
type: 'checkbox',
|
|
64
|
+
choices: TEST_ACCOUNT_TIERS,
|
|
65
|
+
validate: choices => {
|
|
66
|
+
if (choices?.length > 1) {
|
|
67
|
+
const hubMap = {};
|
|
68
|
+
for (const choice of choices) {
|
|
69
|
+
const hub = choice.split(':')[0];
|
|
70
|
+
if (hubMap[hub]) {
|
|
71
|
+
return en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.errors
|
|
72
|
+
.tiersError;
|
|
73
|
+
}
|
|
74
|
+
hubMap[hub] = true;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return true;
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
accountLevelsArray = accountLevelsPromptResult.testAccountLevels;
|
|
81
|
+
}
|
|
82
|
+
if (!accountLevelsArray) {
|
|
83
|
+
accountLevelsArray = [];
|
|
84
|
+
}
|
|
85
|
+
const accountLevels = accountLevelsArray.reduce((acc, level) => {
|
|
86
|
+
const [hubName, hubTier] = level.split(':');
|
|
87
|
+
const hubLevel = hubs[hubName];
|
|
88
|
+
acc[hubLevel] = hubTier;
|
|
89
|
+
return acc;
|
|
90
|
+
}, {});
|
|
91
|
+
return {
|
|
92
|
+
accountName: accountName,
|
|
93
|
+
description: accountDescription,
|
|
94
|
+
...accountLevels,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
@@ -1,19 +1,28 @@
|
|
|
1
|
-
import { ProjectTemplate } from '../../types/Projects';
|
|
2
|
-
type
|
|
1
|
+
import { ComponentTemplate, ComponentTemplateChoice, ProjectTemplate } from '../../types/Projects';
|
|
2
|
+
export type CreateProjectPromptResponse = {
|
|
3
|
+
name: string;
|
|
4
|
+
dest: string;
|
|
5
|
+
projectTemplate?: ProjectTemplate;
|
|
6
|
+
componentTemplates?: ComponentTemplate[];
|
|
7
|
+
};
|
|
8
|
+
type CreateProjectPromptResponseProjectTemplate = {
|
|
3
9
|
name: string;
|
|
4
10
|
dest: string;
|
|
5
11
|
projectTemplate: ProjectTemplate;
|
|
12
|
+
componentTemplates: undefined;
|
|
6
13
|
};
|
|
7
|
-
type
|
|
14
|
+
type CreateProjectPromptResponseComponentTemplates = {
|
|
8
15
|
name: string;
|
|
9
16
|
dest: string;
|
|
10
17
|
projectTemplate?: undefined;
|
|
18
|
+
componentTemplates?: ComponentTemplate[];
|
|
11
19
|
};
|
|
12
20
|
type PromptOptionsArg = {
|
|
13
21
|
name?: string;
|
|
14
22
|
dest?: string;
|
|
15
23
|
template?: string;
|
|
24
|
+
features?: string[];
|
|
16
25
|
};
|
|
17
|
-
export declare function createProjectPrompt(promptOptions: PromptOptionsArg, projectTemplates
|
|
18
|
-
export declare function createProjectPrompt(promptOptions: PromptOptionsArg, projectTemplates?: undefined): Promise<
|
|
26
|
+
export declare function createProjectPrompt(promptOptions: PromptOptionsArg, projectTemplates?: ProjectTemplate[], componentTemplates?: undefined): Promise<CreateProjectPromptResponseProjectTemplate>;
|
|
27
|
+
export declare function createProjectPrompt(promptOptions: PromptOptionsArg, projectTemplates?: undefined, componentTemplates?: ComponentTemplateChoice[]): Promise<CreateProjectPromptResponseComponentTemplates>;
|
|
19
28
|
export {};
|
|
@@ -8,43 +8,58 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const path_2 = require("@hubspot/local-dev-lib/path");
|
|
10
10
|
const promptUtils_1 = require("./promptUtils");
|
|
11
|
-
const lang_1 = require("../lang");
|
|
12
11
|
const constants_1 = require("../constants");
|
|
12
|
+
const en_1 = require("../../lang/en");
|
|
13
13
|
function validateProjectDirectory(input) {
|
|
14
14
|
if (!input) {
|
|
15
|
-
return
|
|
15
|
+
return en_1.lib.prompts.createProjectPrompt.errors.destRequired;
|
|
16
16
|
}
|
|
17
17
|
if (fs_1.default.existsSync(path_1.default.resolve((0, path_2.getCwd)(), path_1.default.join(input, constants_1.PROJECT_CONFIG_FILE)))) {
|
|
18
|
-
return
|
|
18
|
+
return en_1.lib.prompts.createProjectPrompt.errors.invalidDest;
|
|
19
19
|
}
|
|
20
20
|
if (!(0, path_2.isValidPath)(input)) {
|
|
21
|
-
return
|
|
21
|
+
return en_1.lib.prompts.createProjectPrompt.errors.invalidCharacters;
|
|
22
22
|
}
|
|
23
23
|
return true;
|
|
24
24
|
}
|
|
25
25
|
function findTemplateByNameOrLabel(projectTemplates, templateNameOrLabel) {
|
|
26
26
|
return projectTemplates.find(t => t.name === templateNameOrLabel || t.label === templateNameOrLabel);
|
|
27
27
|
}
|
|
28
|
-
async function createProjectPrompt(promptOptions, projectTemplates) {
|
|
28
|
+
async function createProjectPrompt(promptOptions, projectTemplates, componentTemplates) {
|
|
29
29
|
const createProjectFromTemplate = !!projectTemplates && projectTemplates.length > 0;
|
|
30
|
+
const createProjectFromComponents = Array.isArray(componentTemplates) && componentTemplates?.length > 0;
|
|
31
|
+
const selectedComponents = [];
|
|
32
|
+
if (createProjectFromComponents && promptOptions.features) {
|
|
33
|
+
componentTemplates.forEach(template => {
|
|
34
|
+
if (!template.value) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (promptOptions.features?.includes(template.value.type)) {
|
|
38
|
+
if (template.disabled) {
|
|
39
|
+
throw new Error(`Cannot create project with template '${template.value.type}'. Reasons: ${template.disabled}`);
|
|
40
|
+
}
|
|
41
|
+
selectedComponents.push(template.value);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
30
45
|
const providedTemplateIsValid = createProjectFromTemplate &&
|
|
31
46
|
!!promptOptions.template &&
|
|
32
47
|
!!findTemplateByNameOrLabel(projectTemplates, promptOptions.template);
|
|
33
48
|
const result = await (0, promptUtils_1.promptUser)([
|
|
34
49
|
{
|
|
35
50
|
name: 'name',
|
|
36
|
-
message:
|
|
51
|
+
message: en_1.lib.prompts.createProjectPrompt.enterName,
|
|
37
52
|
when: !promptOptions.name,
|
|
38
53
|
validate: (input) => {
|
|
39
54
|
if (!input) {
|
|
40
|
-
return
|
|
55
|
+
return en_1.lib.prompts.createProjectPrompt.errors.nameRequired;
|
|
41
56
|
}
|
|
42
57
|
return true;
|
|
43
58
|
},
|
|
44
59
|
},
|
|
45
60
|
{
|
|
46
61
|
name: 'dest',
|
|
47
|
-
message:
|
|
62
|
+
message: en_1.lib.prompts.createProjectPrompt.enterDest,
|
|
48
63
|
when: !promptOptions.dest,
|
|
49
64
|
default: answers => {
|
|
50
65
|
const projectName = (0, path_2.sanitizeFileName)(promptOptions.name || answers.name);
|
|
@@ -59,10 +74,8 @@ async function createProjectPrompt(promptOptions, projectTemplates) {
|
|
|
59
74
|
name: 'projectTemplate',
|
|
60
75
|
message: () => {
|
|
61
76
|
return promptOptions.template && !providedTemplateIsValid
|
|
62
|
-
?
|
|
63
|
-
|
|
64
|
-
})
|
|
65
|
-
: (0, lang_1.i18n)(`lib.prompts.createProjectPrompt.selectTemplate`);
|
|
77
|
+
? en_1.lib.prompts.createProjectPrompt.errors.invalidTemplate(promptOptions.template)
|
|
78
|
+
: en_1.lib.prompts.createProjectPrompt.selectTemplate;
|
|
66
79
|
},
|
|
67
80
|
when: createProjectFromTemplate && !providedTemplateIsValid,
|
|
68
81
|
type: 'list',
|
|
@@ -75,6 +88,15 @@ async function createProjectPrompt(promptOptions, projectTemplates) {
|
|
|
75
88
|
})
|
|
76
89
|
: undefined,
|
|
77
90
|
},
|
|
91
|
+
{
|
|
92
|
+
name: 'componentTemplates',
|
|
93
|
+
message: en_1.lib.prompts.createProjectPrompt.features,
|
|
94
|
+
when: !promptOptions.features &&
|
|
95
|
+
createProjectFromComponents &&
|
|
96
|
+
selectedComponents.length === 0,
|
|
97
|
+
type: 'checkbox',
|
|
98
|
+
choices: componentTemplates,
|
|
99
|
+
},
|
|
78
100
|
]);
|
|
79
101
|
if (!result.name) {
|
|
80
102
|
result.name = promptOptions.name;
|
|
@@ -82,12 +104,15 @@ async function createProjectPrompt(promptOptions, projectTemplates) {
|
|
|
82
104
|
if (!result.dest) {
|
|
83
105
|
result.dest = promptOptions.dest;
|
|
84
106
|
}
|
|
107
|
+
if (!result.componentTemplates) {
|
|
108
|
+
result.componentTemplates = selectedComponents;
|
|
109
|
+
}
|
|
85
110
|
if (providedTemplateIsValid) {
|
|
86
111
|
result.projectTemplate = findTemplateByNameOrLabel(projectTemplates, promptOptions.template);
|
|
87
112
|
}
|
|
88
113
|
if (projectTemplates && projectTemplates.length > 0) {
|
|
89
114
|
if (!result.projectTemplate) {
|
|
90
|
-
throw new Error(
|
|
115
|
+
throw new Error(en_1.lib.prompts.createProjectPrompt.errors.projectTemplateRequired);
|
|
91
116
|
}
|
|
92
117
|
return result;
|
|
93
118
|
}
|
|
@@ -1,7 +1,25 @@
|
|
|
1
|
-
declare const templateTypeChoices: {
|
|
2
|
-
name:
|
|
3
|
-
value:
|
|
4
|
-
}
|
|
1
|
+
declare const templateTypeChoices: [{
|
|
2
|
+
readonly name: "page";
|
|
3
|
+
readonly value: "page-template";
|
|
4
|
+
}, {
|
|
5
|
+
readonly name: "email";
|
|
6
|
+
readonly value: "email-template";
|
|
7
|
+
}, {
|
|
8
|
+
readonly name: "partial";
|
|
9
|
+
readonly value: "partial";
|
|
10
|
+
}, {
|
|
11
|
+
readonly name: "global partial";
|
|
12
|
+
readonly value: "global-partial";
|
|
13
|
+
}, {
|
|
14
|
+
readonly name: "blog listing";
|
|
15
|
+
readonly value: "blog-listing-template";
|
|
16
|
+
}, {
|
|
17
|
+
readonly name: "blog post";
|
|
18
|
+
readonly value: "blog-post-template";
|
|
19
|
+
}, {
|
|
20
|
+
readonly name: "search results";
|
|
21
|
+
readonly value: "search-template";
|
|
22
|
+
}];
|
|
5
23
|
interface CreateTemplatePromptResponse {
|
|
6
24
|
templateType: (typeof templateTypeChoices)[number]['value'];
|
|
7
25
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.installAppBrowserPrompt = installAppBrowserPrompt;
|
|
7
|
+
exports.installAppAutoPrompt = installAppAutoPrompt;
|
|
8
|
+
const open_1 = __importDefault(require("open"));
|
|
9
|
+
const promptUtils_1 = require("./promptUtils");
|
|
10
|
+
const exitCodes_1 = require("../enums/exitCodes");
|
|
11
|
+
const en_1 = require("../../lang/en");
|
|
12
|
+
const logger_1 = require("../ui/logger");
|
|
13
|
+
async function installAppBrowserPrompt(installUrl, isReinstall = false) {
|
|
14
|
+
logger_1.uiLogger.log('');
|
|
15
|
+
if (isReinstall) {
|
|
16
|
+
logger_1.uiLogger.log(en_1.lib.prompts.installAppPrompt.reinstallExplanation);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
logger_1.uiLogger.log(en_1.lib.prompts.installAppPrompt.explanation);
|
|
20
|
+
}
|
|
21
|
+
const { shouldOpenBrowser } = await (0, promptUtils_1.promptUser)({
|
|
22
|
+
name: 'shouldOpenBrowser',
|
|
23
|
+
type: 'confirm',
|
|
24
|
+
message: isReinstall
|
|
25
|
+
? en_1.lib.prompts.installAppPrompt.reinstallPrompt
|
|
26
|
+
: en_1.lib.prompts.installAppPrompt.prompt,
|
|
27
|
+
});
|
|
28
|
+
if (!isReinstall && !shouldOpenBrowser) {
|
|
29
|
+
logger_1.uiLogger.log(en_1.lib.prompts.installAppPrompt.decline);
|
|
30
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
31
|
+
}
|
|
32
|
+
else if (!shouldOpenBrowser) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
(0, open_1.default)(installUrl);
|
|
36
|
+
}
|
|
37
|
+
async function installAppAutoPrompt() {
|
|
38
|
+
logger_1.uiLogger.log('');
|
|
39
|
+
const { shouldInstall } = await (0, promptUtils_1.promptUser)({
|
|
40
|
+
name: 'shouldInstall',
|
|
41
|
+
type: 'confirm',
|
|
42
|
+
message: en_1.lib.prompts.installAppPrompt.autoPrompt,
|
|
43
|
+
});
|
|
44
|
+
return shouldInstall;
|
|
45
|
+
}
|