@hubspot/cli 7.4.7-experimental.0 → 7.4.7
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/api/migrate.d.ts +14 -4
- package/api/migrate.js +16 -2
- package/bin/cli.js +8 -183
- package/commands/account/auth.d.ts +10 -0
- package/commands/account/auth.js +188 -0
- package/commands/account/clean.js +38 -5
- package/commands/account/createOverride.d.ts +10 -0
- package/commands/account/createOverride.js +104 -0
- package/commands/account/info.js +38 -4
- package/commands/account/list.js +23 -5
- package/commands/account/remove.js +36 -2
- package/commands/account/removeOverride.d.ts +10 -0
- package/commands/account/removeOverride.js +76 -0
- package/commands/account/use.js +25 -3
- package/commands/account.js +7 -2
- package/commands/app/migrate.d.ts +6 -6
- package/commands/app/migrate.js +62 -45
- package/commands/app.js +0 -2
- package/commands/auth.js +14 -11
- package/commands/cms/lighthouseScore.js +7 -3
- package/commands/cms.js +1 -2
- package/commands/completion.js +2 -3
- package/commands/config/migrate.d.ts +10 -0
- package/commands/config/migrate.js +84 -0
- package/commands/config/set.d.ts +10 -0
- package/commands/config/set.js +34 -29
- package/commands/config.d.ts +4 -1
- package/commands/config.js +45 -11
- package/commands/create/api-sample.js +3 -1
- package/commands/create/website-theme.js +1 -1
- package/commands/create.js +7 -8
- package/commands/customObject/schema/delete.js +4 -1
- package/commands/customObject/schema/fetch-all.js +2 -1
- package/commands/customObject/schema/fetch.js +2 -1
- package/commands/customObject.js +3 -4
- package/commands/doctor.js +5 -6
- package/commands/feedback.js +7 -8
- package/commands/fetch.js +6 -7
- package/commands/filemanager.js +1 -2
- package/commands/function.js +1 -2
- package/commands/hubdb/clear.js +5 -6
- package/commands/hubdb/create.js +7 -8
- package/commands/hubdb/delete.js +8 -7
- package/commands/hubdb/fetch.js +4 -5
- package/commands/hubdb.js +1 -2
- package/commands/init.js +18 -20
- package/commands/lint.js +3 -4
- package/commands/list.js +5 -6
- package/commands/logs.js +12 -13
- package/commands/module/marketplace-validate.js +5 -6
- package/commands/module.js +1 -3
- package/commands/mv.js +4 -5
- package/commands/open.js +4 -5
- package/commands/project/add.d.ts +3 -7
- package/commands/project/add.js +28 -23
- package/commands/project/cloneApp.d.ts +6 -8
- package/commands/project/cloneApp.js +49 -45
- package/commands/project/create.d.ts +10 -1
- package/commands/project/create.js +85 -63
- package/commands/project/deploy.d.ts +3 -6
- package/commands/project/deploy.js +27 -25
- package/commands/project/dev/deprecatedFlow.js +32 -25
- package/commands/project/dev/index.d.ts +4 -2
- package/commands/project/dev/index.js +31 -18
- package/commands/project/dev/unifiedFlow.js +10 -11
- package/commands/project/download.d.ts +3 -7
- package/commands/project/download.js +18 -19
- package/commands/project/installDeps.d.ts +6 -1
- package/commands/project/installDeps.js +48 -32
- package/commands/project/listBuilds.d.ts +3 -7
- package/commands/project/listBuilds.js +32 -27
- package/commands/project/logs.d.ts +10 -1
- package/commands/project/logs.js +73 -65
- package/commands/project/migrate.d.ts +6 -0
- package/commands/project/migrate.js +71 -0
- package/commands/project/migrateApp.d.ts +3 -8
- package/commands/project/migrateApp.js +23 -20
- package/commands/project/open.d.ts +3 -7
- package/commands/project/open.js +29 -21
- package/commands/project/upload.d.ts +9 -1
- package/commands/project/upload.js +78 -54
- package/commands/project/watch.d.ts +6 -1
- package/commands/project/watch.js +95 -61
- package/commands/project.d.ts +3 -1
- package/commands/project.js +47 -35
- package/commands/remove.js +7 -5
- package/commands/sandbox/create.js +10 -11
- package/commands/sandbox/delete.js +18 -19
- package/commands/sandbox.js +1 -2
- package/commands/secret/addSecret.js +5 -6
- package/commands/secret/deleteSecret.js +12 -9
- package/commands/secret/listSecret.js +3 -4
- package/commands/secret/updateSecret.js +9 -8
- package/commands/secret.js +1 -2
- package/commands/theme/generate-selectors.js +5 -6
- package/commands/theme/marketplace-validate.js +5 -6
- package/commands/theme/preview.js +16 -16
- package/commands/theme.js +1 -2
- package/commands/upload.js +23 -24
- package/commands/watch.js +18 -19
- package/lang/en.d.ts +2806 -0
- package/lang/en.js +2659 -3300
- package/lang/en.lyaml +98 -41
- package/lib/accountTypes.d.ts +1 -0
- package/lib/accountTypes.js +12 -0
- package/lib/app/migrate.d.ts +10 -4
- package/lib/app/migrate.js +208 -94
- package/lib/app/migrate_legacy.d.ts +2 -2
- package/lib/app/migrate_legacy.js +10 -7
- package/lib/buildAccount.d.ts +1 -2
- package/lib/buildAccount.js +11 -10
- package/lib/commonOpts.d.ts +3 -4
- package/lib/commonOpts.js +46 -18
- package/lib/configMigrate.d.ts +2 -0
- package/lib/configMigrate.js +104 -0
- package/lib/configOptions.js +11 -10
- package/lib/constants.d.ts +4 -0
- package/lib/constants.js +5 -1
- package/lib/dependencyManagement.js +2 -2
- package/lib/doctor/Diagnosis.d.ts +1 -2
- package/lib/doctor/Diagnosis.js +19 -16
- package/lib/doctor/DiagnosticInfoBuilder.d.ts +2 -1
- package/lib/doctor/DiagnosticInfoBuilder.js +10 -9
- package/lib/doctor/Doctor.d.ts +1 -0
- package/lib/doctor/Doctor.js +57 -44
- package/lib/errorHandlers/index.js +6 -7
- package/lib/errorHandlers/suppressError.js +6 -7
- package/lib/generateSelectors.js +1 -2
- package/lib/hasFeature.d.ts +3 -1
- package/lib/middleware/__test__/configMiddleware.test.d.ts +1 -0
- package/lib/middleware/__test__/configMiddleware.test.js +194 -0
- package/lib/middleware/__test__/gitMiddleware.test.d.ts +1 -0
- package/lib/middleware/__test__/gitMiddleware.test.js +76 -0
- package/lib/middleware/__test__/notificationsMiddleware.test.d.ts +1 -0
- package/lib/middleware/__test__/notificationsMiddleware.test.js +10 -0
- package/lib/middleware/__test__/requestMiddleware.test.d.ts +1 -0
- package/lib/middleware/__test__/requestMiddleware.test.js +20 -0
- package/lib/middleware/__test__/utils.test.d.ts +1 -0
- package/lib/middleware/__test__/utils.test.js +53 -0
- package/lib/middleware/__test__/yargsChecksMiddleware.test.d.ts +1 -0
- package/lib/middleware/__test__/yargsChecksMiddleware.test.js +81 -0
- package/lib/middleware/configMiddleware.d.ts +13 -0
- package/lib/middleware/configMiddleware.js +116 -0
- package/lib/middleware/fireAlarmMiddleware.d.ts +4 -0
- package/lib/middleware/fireAlarmMiddleware.js +123 -0
- package/lib/middleware/gitMiddleware.d.ts +2 -0
- package/lib/middleware/gitMiddleware.js +14 -0
- package/lib/middleware/notificationsMiddleware.d.ts +1 -0
- package/lib/middleware/notificationsMiddleware.js +38 -0
- package/lib/middleware/requestMiddleware.d.ts +1 -0
- package/lib/middleware/requestMiddleware.js +11 -0
- package/lib/middleware/utils.d.ts +8 -0
- package/lib/middleware/utils.js +17 -0
- package/lib/middleware/yargsChecksMiddleware.d.ts +4 -0
- package/lib/middleware/yargsChecksMiddleware.js +24 -0
- package/lib/oauth.js +1 -2
- package/lib/process.js +1 -2
- package/lib/projects/ProjectLogsManager.d.ts +1 -1
- package/lib/projects/ProjectLogsManager.js +16 -21
- package/lib/projects/buildAndDeploy.js +28 -39
- package/lib/projects/config.d.ts +9 -0
- package/lib/projects/config.js +79 -0
- package/lib/projects/create.js +5 -6
- package/lib/projects/ensureProjectExists.d.ts +11 -0
- package/lib/projects/ensureProjectExists.js +97 -0
- package/lib/{DevServerManager.d.ts → projects/localDev/DevServerManager.d.ts} +1 -1
- package/lib/{DevServerManager.js → projects/localDev/DevServerManager.js} +6 -6
- package/lib/{DevServerManagerV2.d.ts → projects/localDev/DevServerManagerV2.d.ts} +1 -1
- package/lib/{DevServerManagerV2.js → projects/localDev/DevServerManagerV2.js} +3 -4
- package/lib/{LocalDevManager.d.ts → projects/localDev/LocalDevManager.d.ts} +1 -1
- package/lib/{LocalDevManager.js → projects/localDev/LocalDevManager.js} +49 -82
- package/lib/{LocalDevManagerV2.d.ts → projects/localDev/LocalDevManagerV2.d.ts} +2 -2
- package/lib/{LocalDevManagerV2.js → projects/localDev/LocalDevManagerV2.js} +43 -75
- package/lib/{localDev.d.ts → projects/localDev/helpers.d.ts} +5 -4
- package/lib/{localDev.js → projects/localDev/helpers.js} +97 -114
- package/lib/projects/ui.d.ts +1 -0
- package/lib/projects/ui.js +15 -0
- package/lib/projects/upload.d.ts +13 -2
- package/lib/projects/upload.js +18 -34
- package/lib/projects/urls.d.ts +1 -0
- package/lib/projects/urls.js +6 -0
- package/lib/projects/watch.d.ts +1 -1
- package/lib/projects/watch.js +21 -18
- package/lib/prompts/accountNamePrompt.js +16 -13
- package/lib/prompts/accountsPrompt.js +1 -2
- package/lib/prompts/cmsFieldPrompt.js +1 -2
- package/lib/prompts/createApiSamplePrompt.js +4 -5
- package/lib/prompts/createFunctionPrompt.js +13 -14
- package/lib/prompts/createModulePrompt.js +8 -9
- package/lib/prompts/createProjectPrompt.d.ts +11 -4
- package/lib/prompts/createProjectPrompt.js +14 -9
- package/lib/prompts/createTemplatePrompt.js +1 -2
- package/lib/prompts/downloadProjectPrompt.js +3 -4
- package/lib/prompts/installPublicAppPrompt.js +6 -5
- package/lib/prompts/personalAccessKeyPrompt.js +17 -18
- package/lib/prompts/previewPrompt.js +5 -6
- package/lib/prompts/projectAddPrompt.js +4 -5
- package/lib/prompts/projectDevTargetAccountPrompt.js +11 -12
- package/lib/prompts/projectNamePrompt.js +5 -6
- package/lib/prompts/projectsLogsPrompt.js +3 -2
- package/lib/prompts/promptUtils.d.ts +1 -1
- package/lib/prompts/sandboxesPrompt.js +5 -6
- package/lib/prompts/secretPrompt.js +2 -3
- package/lib/prompts/selectHubDBTablePrompt.js +11 -8
- package/lib/prompts/selectPublicAppPrompt.js +6 -7
- package/lib/prompts/setAsDefaultAccountPrompt.js +1 -2
- package/lib/prompts/uploadPrompt.js +4 -5
- package/lib/sandboxSync.js +15 -14
- package/lib/sandboxes.js +12 -13
- package/lib/serverlessLogs.js +4 -6
- package/lib/ui/SpinniesManager.d.ts +1 -1
- package/lib/ui/boxen.d.ts +5 -0
- package/lib/ui/boxen.js +30 -0
- package/lib/ui/git.js +8 -9
- package/lib/ui/index.d.ts +4 -2
- package/lib/ui/index.js +16 -16
- package/lib/ui/logger.d.ts +10 -0
- package/lib/ui/logger.js +15 -0
- package/lib/ui/serverlessFunctionLogs.js +2 -3
- package/lib/ui/spinniesUtils.d.ts +5 -5
- package/lib/yargsUtils.d.ts +1 -1
- package/package.json +7 -6
- package/types/Yargs.d.ts +5 -11
- package/lib/projects/index.d.ts +0 -20
- package/lib/projects/index.js +0 -195
package/lib/oauth.js
CHANGED
|
@@ -19,13 +19,12 @@ const lang_1 = require("./lang");
|
|
|
19
19
|
const exitCodes_1 = require("./enums/exitCodes");
|
|
20
20
|
const PORT = 3000;
|
|
21
21
|
const redirectUri = `http://localhost:${PORT}/oauth-callback`;
|
|
22
|
-
const i18nKey = 'lib.oauth';
|
|
23
22
|
function buildAuthUrl(oauthManager) {
|
|
24
23
|
const { env: accountEnv, clientId, scopes: accountScopes, } = oauthManager.account;
|
|
25
24
|
const env = accountEnv || environments_1.ENVIRONMENTS.PROD;
|
|
26
25
|
const scopes = accountScopes || auth_1.DEFAULT_OAUTH_SCOPES;
|
|
27
26
|
if (!clientId) {
|
|
28
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
27
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.oauth.missingClientId`));
|
|
29
28
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
30
29
|
}
|
|
31
30
|
return (`${(0, urls_1.getHubSpotWebsiteOrigin)(env)}/oauth/${oauthManager.account.accountId}/authorize` +
|
package/lib/process.js
CHANGED
|
@@ -9,7 +9,6 @@ exports.handleKeypress = handleKeypress;
|
|
|
9
9
|
const readline_1 = __importDefault(require("readline"));
|
|
10
10
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
11
11
|
const lang_1 = require("./lang");
|
|
12
|
-
const i18nKey = 'lib.process';
|
|
13
12
|
exports.TERMINATION_SIGNALS = [
|
|
14
13
|
'beforeExit',
|
|
15
14
|
'SIGINT', // Terminal trying to interrupt (Ctrl + C)
|
|
@@ -32,7 +31,7 @@ function handleExit(callback) {
|
|
|
32
31
|
if (isSIGHUP) {
|
|
33
32
|
(0, logger_1.setLogLevel)(logger_1.LOG_LEVEL.NONE);
|
|
34
33
|
}
|
|
35
|
-
logger_1.logger.debug((0, lang_1.i18n)(
|
|
34
|
+
logger_1.logger.debug((0, lang_1.i18n)(`lib.process.exitDebug`, { signal }));
|
|
36
35
|
await callback({ isSIGHUP });
|
|
37
36
|
}
|
|
38
37
|
});
|
|
@@ -14,7 +14,7 @@ declare class _ProjectLogsManager {
|
|
|
14
14
|
init(accountId: number): Promise<void>;
|
|
15
15
|
fetchFunctionDetails(): Promise<void>;
|
|
16
16
|
getFunctionNames(): string[];
|
|
17
|
-
setFunction(functionName
|
|
17
|
+
setFunction(functionName?: string): void;
|
|
18
18
|
}
|
|
19
19
|
export declare const ProjectLogsManager: _ProjectLogsManager;
|
|
20
20
|
export {};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ProjectLogsManager = void 0;
|
|
4
|
-
const
|
|
4
|
+
const config_1 = require("./config");
|
|
5
|
+
const ensureProjectExists_1 = require("./ensureProjectExists");
|
|
5
6
|
const projects_1 = require("@hubspot/local-dev-lib/api/projects");
|
|
6
|
-
const logger_1 = require("
|
|
7
|
-
const
|
|
8
|
-
const ui_1 = require("../ui");
|
|
9
|
-
const i18nKey = 'commands.project.subcommands.logs';
|
|
7
|
+
const logger_1 = require("../ui/logger");
|
|
8
|
+
const en_1 = require("../../lang/en");
|
|
10
9
|
class _ProjectLogsManager {
|
|
11
10
|
projectName;
|
|
12
11
|
projectId;
|
|
@@ -32,32 +31,32 @@ class _ProjectLogsManager {
|
|
|
32
31
|
this.functions = [];
|
|
33
32
|
}
|
|
34
33
|
async init(accountId) {
|
|
35
|
-
const { projectConfig } = await (0,
|
|
34
|
+
const { projectConfig } = await (0, config_1.getProjectConfig)();
|
|
36
35
|
if (!projectConfig || !projectConfig.name) {
|
|
37
|
-
throw new Error(
|
|
36
|
+
throw new Error(en_1.commands.project.logs.errors.noProjectConfig);
|
|
38
37
|
}
|
|
39
38
|
const { name: projectName } = projectConfig;
|
|
40
39
|
this.projectName = projectName;
|
|
41
40
|
this.accountId = accountId;
|
|
42
41
|
this.functions = [];
|
|
43
|
-
const { project } = await (0,
|
|
42
|
+
const { project } = await (0, ensureProjectExists_1.ensureProjectExists)(this.accountId, this.projectName, {
|
|
44
43
|
allowCreate: false,
|
|
45
44
|
});
|
|
46
45
|
if (!project ||
|
|
47
46
|
!project.deployedBuild ||
|
|
48
47
|
!project.deployedBuild.subbuildStatuses) {
|
|
49
|
-
throw new Error(
|
|
48
|
+
throw new Error(en_1.commands.project.logs.errors.failedToFetchProjectDetails);
|
|
50
49
|
}
|
|
51
50
|
this.projectId = project.id;
|
|
52
51
|
await this.fetchFunctionDetails();
|
|
53
52
|
}
|
|
54
53
|
async fetchFunctionDetails() {
|
|
55
54
|
if (!this.projectId) {
|
|
56
|
-
throw new Error(
|
|
55
|
+
throw new Error(en_1.commands.project.logs.errors.noProjectConfig);
|
|
57
56
|
}
|
|
58
57
|
if (!this.accountId) {
|
|
59
|
-
logger_1.
|
|
60
|
-
throw new Error(
|
|
58
|
+
logger_1.uiLogger.debug(en_1.commands.project.logs.errors.projectLogsManagerNotInitialized);
|
|
59
|
+
throw new Error(en_1.commands.project.logs.errors.generic);
|
|
61
60
|
}
|
|
62
61
|
const { data: { topLevelComponentMetadata }, } = await (0, projects_1.fetchProjectComponentsMetadata)(this.accountId, this.projectId);
|
|
63
62
|
const apps = topLevelComponentMetadata.filter(componentMetadata => {
|
|
@@ -70,27 +69,23 @@ class _ProjectLogsManager {
|
|
|
70
69
|
...app.featureComponents.filter(component => component.type.name === 'APP_FUNCTION'));
|
|
71
70
|
});
|
|
72
71
|
if (this.functions.length === 0) {
|
|
73
|
-
throw new Error(
|
|
74
|
-
link: (0, ui_1.uiLink)((0, lang_1.i18n)(`${i18nKey}.errors.noFunctionsLinkText`), 'https://developers.hubspot.com/docs/platform/serverless-functions'),
|
|
75
|
-
}));
|
|
72
|
+
throw new Error(en_1.commands.project.logs.errors.noFunctionsInProject);
|
|
76
73
|
}
|
|
77
74
|
}
|
|
78
75
|
getFunctionNames() {
|
|
79
76
|
return this.functions.map(serverlessFunction => serverlessFunction.componentName);
|
|
80
77
|
}
|
|
81
78
|
setFunction(functionName) {
|
|
82
|
-
if (!
|
|
83
|
-
throw new Error(
|
|
84
|
-
link: (0, ui_1.uiLink)((0, lang_1.i18n)(`${i18nKey}.errors.noFunctionsLinkText`), 'https://developers.hubspot.com/docs/platform/serverless-functions'),
|
|
85
|
-
}));
|
|
79
|
+
if (!functionName || this.functions.length === 0) {
|
|
80
|
+
throw new Error(en_1.commands.project.logs.errors.noFunctionsInProject);
|
|
86
81
|
}
|
|
87
82
|
this.selectedFunction = this.functions.find(serverlessFunction => serverlessFunction.componentName === functionName);
|
|
88
83
|
if (!this.selectedFunction) {
|
|
89
|
-
throw new Error(
|
|
84
|
+
throw new Error(en_1.commands.project.logs.errors.noFunctionWithName(functionName));
|
|
90
85
|
}
|
|
91
86
|
this.functionName = functionName;
|
|
92
87
|
if (!this.selectedFunction.deployOutput) {
|
|
93
|
-
throw new Error(
|
|
88
|
+
throw new Error(en_1.commands.project.logs.errors.functionNotDeployed(functionName));
|
|
94
89
|
}
|
|
95
90
|
this.appId = this.selectedFunction.deployOutput.appId;
|
|
96
91
|
if (this.selectedFunction.deployOutput.endpoint) {
|
|
@@ -8,16 +8,15 @@ exports.useV3Api = useV3Api;
|
|
|
8
8
|
exports.displayWarnLogs = displayWarnLogs;
|
|
9
9
|
exports.pollProjectBuildAndDeploy = pollProjectBuildAndDeploy;
|
|
10
10
|
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
-
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
12
11
|
const projects_1 = require("@hubspot/local-dev-lib/api/projects");
|
|
13
12
|
const constants_1 = require("../constants");
|
|
14
13
|
const SpinniesManager_1 = __importDefault(require("../ui/SpinniesManager"));
|
|
15
|
-
const lang_1 = require("../lang");
|
|
16
14
|
const errorHandlers_1 = require("../errorHandlers");
|
|
17
15
|
const ui_1 = require("../ui");
|
|
18
16
|
const urls_1 = require("./urls");
|
|
19
17
|
const exitCodes_1 = require("../enums/exitCodes");
|
|
20
|
-
const
|
|
18
|
+
const en_1 = require("../../lang/en");
|
|
19
|
+
const logger_1 = require("../ui/logger");
|
|
21
20
|
const SPINNER_STATUS = {
|
|
22
21
|
SPINNING: 'spinning',
|
|
23
22
|
};
|
|
@@ -50,19 +49,14 @@ function getSubtaskType(task) {
|
|
|
50
49
|
return task.deployType;
|
|
51
50
|
}
|
|
52
51
|
function handleTaskStatusError(statusText) {
|
|
53
|
-
logger_1.
|
|
54
|
-
taskType: statusText.TYPE_KEY === constants_1.PROJECT_BUILD_TEXT.TYPE_KEY
|
|
55
|
-
? 'build'
|
|
56
|
-
: 'deploy',
|
|
57
|
-
openCommand: (0, ui_1.uiCommandReference)('hs project open'),
|
|
58
|
-
}));
|
|
52
|
+
logger_1.uiLogger.error(en_1.lib.projectBuildAndDeploy.makePollTaskStatusFunc.errorFetchingTaskStatus(statusText.TYPE_KEY === constants_1.PROJECT_BUILD_TEXT.TYPE_KEY ? 'build' : 'deploy'));
|
|
59
53
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
60
54
|
}
|
|
61
55
|
function makePollTaskStatusFunc({ statusFn, structureFn, statusText, statusStrings, linkToHubSpot, }) {
|
|
62
56
|
return async function (accountId, taskName, taskId, deployedBuildId, silenceLogs = false) {
|
|
63
57
|
const displayId = deployedBuildId || taskId;
|
|
64
58
|
if (linkToHubSpot && !silenceLogs) {
|
|
65
|
-
logger_1.
|
|
59
|
+
logger_1.uiLogger.log(`\n${linkToHubSpot(accountId, taskName, taskId, deployedBuildId)}\n`);
|
|
66
60
|
}
|
|
67
61
|
SpinniesManager_1.default.init();
|
|
68
62
|
const overallTaskSpinniesKey = `overallTaskStatus-${statusText.STATUS_TEXT}`;
|
|
@@ -95,9 +89,10 @@ function makePollTaskStatusFunc({ statusFn, structureFn, statusText, statusStrin
|
|
|
95
89
|
const numComponents = structuredTasks.length;
|
|
96
90
|
const componentCountText = silenceLogs
|
|
97
91
|
? ''
|
|
98
|
-
:
|
|
99
|
-
?
|
|
100
|
-
|
|
92
|
+
: numComponents === 1
|
|
93
|
+
? en_1.lib.projectBuildAndDeploy.makePollTaskStatusFunc
|
|
94
|
+
.componentCountSingular
|
|
95
|
+
: en_1.lib.projectBuildAndDeploy.makePollTaskStatusFunc.componentCount(numComponents);
|
|
101
96
|
SpinniesManager_1.default.update(overallTaskSpinniesKey, {
|
|
102
97
|
text: `${statusStrings.INITIALIZE(taskName, displayId)}\n${componentCountText}`,
|
|
103
98
|
});
|
|
@@ -129,7 +124,7 @@ function makePollTaskStatusFunc({ statusFn, structureFn, statusText, statusStrin
|
|
|
129
124
|
taskStatus = data;
|
|
130
125
|
}
|
|
131
126
|
catch (e) {
|
|
132
|
-
logger_1.
|
|
127
|
+
logger_1.uiLogger.debug(e);
|
|
133
128
|
(0, errorHandlers_1.logError)(e, new errorHandlers_1.ApiErrorContext({
|
|
134
129
|
accountId,
|
|
135
130
|
projectName: taskName,
|
|
@@ -152,8 +147,10 @@ function makePollTaskStatusFunc({ statusFn, structureFn, statusText, statusStrin
|
|
|
152
147
|
if (status === statusText.STATES.SUCCESS ||
|
|
153
148
|
status === statusText.STATES.FAILURE) {
|
|
154
149
|
const taskStatusText = subtask.status === statusText.STATES.SUCCESS
|
|
155
|
-
?
|
|
156
|
-
|
|
150
|
+
? en_1.lib.projectBuildAndDeploy.makePollTaskStatusFunc
|
|
151
|
+
.successStatusText
|
|
152
|
+
: en_1.lib.projectBuildAndDeploy.makePollTaskStatusFunc
|
|
153
|
+
.failedStatusText;
|
|
157
154
|
const hasNewline = spinner?.text?.includes('\n') || Boolean(topLevelTask);
|
|
158
155
|
const updatedText = `${spinner?.text?.replace('\n', '')} ${taskStatusText}${hasNewline ? '\n' : ''}`;
|
|
159
156
|
if (status === statusText.STATES.SUCCESS) {
|
|
@@ -181,23 +178,23 @@ function makePollTaskStatusFunc({ statusFn, structureFn, statusText, statusStrin
|
|
|
181
178
|
if (!silenceLogs) {
|
|
182
179
|
const failedSubtasks = subtasks.filter(subtask => subtask.status === 'FAILURE');
|
|
183
180
|
(0, ui_1.uiLine)();
|
|
184
|
-
logger_1.
|
|
181
|
+
logger_1.uiLogger.log(`${statusStrings.SUBTASK_FAIL(failedSubtasks.length === 1
|
|
185
182
|
? getSubtaskName(failedSubtasks[0])
|
|
186
183
|
: failedSubtasks.length + ' components', displayId)}\n`);
|
|
187
|
-
logger_1.
|
|
184
|
+
logger_1.uiLogger.log(en_1.lib.projectBuildAndDeploy.makePollTaskStatusFunc.errorSummary);
|
|
188
185
|
(0, ui_1.uiLine)();
|
|
189
186
|
const displayErrors = failedSubtasks.filter(subtask => subtask?.standardError?.subCategory !==
|
|
190
187
|
constants_1.PROJECT_ERROR_TYPES.SUBBUILD_FAILED &&
|
|
191
188
|
subtask?.standardError?.subCategory !==
|
|
192
189
|
constants_1.PROJECT_ERROR_TYPES.SUBDEPLOY_FAILED);
|
|
193
190
|
displayErrors.forEach(subTask => {
|
|
194
|
-
logger_1.
|
|
195
|
-
logger_1.
|
|
191
|
+
logger_1.uiLogger.log(`\n--- ${chalk_1.default.bold(getSubtaskName(subTask))} failed with the following error ---`);
|
|
192
|
+
logger_1.uiLogger.error(subTask.errorMessage);
|
|
196
193
|
// Log nested errors
|
|
197
194
|
if (subTask.standardError && subTask.standardError.errors) {
|
|
198
|
-
logger_1.
|
|
195
|
+
logger_1.uiLogger.log('');
|
|
199
196
|
subTask.standardError.errors.forEach(error => {
|
|
200
|
-
logger_1.
|
|
197
|
+
logger_1.uiLogger.log(error.message);
|
|
201
198
|
});
|
|
202
199
|
}
|
|
203
200
|
});
|
|
@@ -224,11 +221,11 @@ function pollBuildAutodeployStatus(accountId, taskName, buildId) {
|
|
|
224
221
|
build = response.data;
|
|
225
222
|
}
|
|
226
223
|
catch (e) {
|
|
227
|
-
logger_1.
|
|
228
|
-
return reject(new Error(
|
|
224
|
+
logger_1.uiLogger.debug(e);
|
|
225
|
+
return reject(new Error(en_1.lib.projectBuildAndDeploy.pollBuildAutodeployStatusError(buildId)));
|
|
229
226
|
}
|
|
230
227
|
if (!build || !build.status) {
|
|
231
|
-
return reject(new Error(
|
|
228
|
+
return reject(new Error(en_1.lib.projectBuildAndDeploy.pollBuildAutodeployStatusError(buildId)));
|
|
232
229
|
}
|
|
233
230
|
if (build.deployStatusTaskLocator || maxIntervals <= 0) {
|
|
234
231
|
clearInterval(pollInterval);
|
|
@@ -287,9 +284,9 @@ async function displayWarnLogs(accountId, projectName, taskId, isDeploy = false)
|
|
|
287
284
|
if (result && result.logs) {
|
|
288
285
|
const logLength = result.logs.length;
|
|
289
286
|
result.logs.forEach((log, i) => {
|
|
290
|
-
logger_1.
|
|
287
|
+
logger_1.uiLogger.warn(log.message);
|
|
291
288
|
if (i < logLength - 1) {
|
|
292
|
-
logger_1.
|
|
289
|
+
logger_1.uiLogger.log('');
|
|
293
290
|
}
|
|
294
291
|
});
|
|
295
292
|
}
|
|
@@ -311,10 +308,7 @@ async function pollProjectBuildAndDeploy(accountId, projectConfig, tempFile, bui
|
|
|
311
308
|
}
|
|
312
309
|
else if (buildStatus.isAutoDeployEnabled) {
|
|
313
310
|
if (!silenceLogs) {
|
|
314
|
-
logger_1.
|
|
315
|
-
accountIdentifier: (0, ui_1.uiAccountDescription)(accountId),
|
|
316
|
-
buildId,
|
|
317
|
-
}));
|
|
311
|
+
logger_1.uiLogger.log(en_1.lib.projectBuildAndDeploy.pollProjectBuildAndDeploy.buildSucceededAutomaticallyDeploying(buildId, (0, ui_1.uiAccountDescription)(accountId)));
|
|
318
312
|
await displayWarnLogs(accountId, projectConfig.name, buildId);
|
|
319
313
|
}
|
|
320
314
|
// autoDeployId of 0 indicates a skipped deploy
|
|
@@ -331,22 +325,17 @@ async function pollProjectBuildAndDeploy(accountId, projectConfig, tempFile, bui
|
|
|
331
325
|
}
|
|
332
326
|
}
|
|
333
327
|
else if (!silenceLogs) {
|
|
334
|
-
logger_1.
|
|
335
|
-
buildId,
|
|
336
|
-
viewDeploysLink: (0, ui_1.uiLink)((0, lang_1.i18n)(`${i18nKey}.pollProjectBuildAndDeploy.viewDeploys`), (0, urls_1.getProjectActivityUrl)(projectConfig.name, accountId)),
|
|
337
|
-
}));
|
|
328
|
+
logger_1.uiLogger.log(en_1.lib.projectBuildAndDeploy.pollProjectBuildAndDeploy.unableToFindAutodeployStatus(buildId, (0, ui_1.uiLink)(en_1.lib.projectBuildAndDeploy.pollProjectBuildAndDeploy.viewDeploys, (0, urls_1.getProjectActivityUrl)(projectConfig.name, accountId))));
|
|
338
329
|
}
|
|
339
330
|
}
|
|
340
331
|
try {
|
|
341
332
|
if (tempFile) {
|
|
342
333
|
tempFile.removeCallback();
|
|
343
|
-
logger_1.
|
|
344
|
-
path: tempFile.name,
|
|
345
|
-
}));
|
|
334
|
+
logger_1.uiLogger.debug(en_1.lib.projectBuildAndDeploy.pollProjectBuildAndDeploy.cleanedUpTempFile(tempFile.name));
|
|
346
335
|
}
|
|
347
336
|
}
|
|
348
337
|
catch (e) {
|
|
349
|
-
|
|
338
|
+
(0, errorHandlers_1.logError)(e);
|
|
350
339
|
}
|
|
351
340
|
if (result && result.deployResult) {
|
|
352
341
|
await displayWarnLogs(accountId, projectConfig.name, result.deployResult.deployId, true);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ProjectConfig } from '../../types/Projects';
|
|
2
|
+
export declare function writeProjectConfig(configPath: string, config: ProjectConfig): boolean;
|
|
3
|
+
export declare function getIsInProject(dir?: string): boolean;
|
|
4
|
+
export interface LoadedProjectConfig {
|
|
5
|
+
projectDir: string | null;
|
|
6
|
+
projectConfig: ProjectConfig | null;
|
|
7
|
+
}
|
|
8
|
+
export declare function getProjectConfig(dir?: string): Promise<LoadedProjectConfig>;
|
|
9
|
+
export declare function validateProjectConfig(projectConfig: ProjectConfig | null, projectDir: string | null): asserts projectConfig is ProjectConfig;
|
|
@@ -0,0 +1,79 @@
|
|
|
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.writeProjectConfig = writeProjectConfig;
|
|
7
|
+
exports.getIsInProject = getIsInProject;
|
|
8
|
+
exports.getProjectConfig = getProjectConfig;
|
|
9
|
+
exports.validateProjectConfig = validateProjectConfig;
|
|
10
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
11
|
+
const path_1 = __importDefault(require("path"));
|
|
12
|
+
const findup_sync_1 = __importDefault(require("findup-sync"));
|
|
13
|
+
const path_2 = require("@hubspot/local-dev-lib/path");
|
|
14
|
+
const constants_1 = require("../constants");
|
|
15
|
+
const en_1 = require("../../lang/en");
|
|
16
|
+
const exitCodes_1 = require("../enums/exitCodes");
|
|
17
|
+
const logger_1 = require("../ui/logger");
|
|
18
|
+
function writeProjectConfig(configPath, config) {
|
|
19
|
+
try {
|
|
20
|
+
fs_extra_1.default.ensureFileSync(configPath);
|
|
21
|
+
fs_extra_1.default.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
22
|
+
logger_1.uiLogger.debug(`Wrote project config at ${configPath}`);
|
|
23
|
+
}
|
|
24
|
+
catch (e) {
|
|
25
|
+
logger_1.uiLogger.debug(e);
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
function getIsInProject(dir) {
|
|
31
|
+
const configPath = getProjectConfigPath(dir);
|
|
32
|
+
return !!configPath;
|
|
33
|
+
}
|
|
34
|
+
function getProjectConfigPath(dir) {
|
|
35
|
+
const projectDir = dir ? (0, path_2.getAbsoluteFilePath)(dir) : (0, path_2.getCwd)();
|
|
36
|
+
const configPath = (0, findup_sync_1.default)(constants_1.PROJECT_CONFIG_FILE, {
|
|
37
|
+
cwd: projectDir,
|
|
38
|
+
nocase: true,
|
|
39
|
+
});
|
|
40
|
+
return configPath;
|
|
41
|
+
}
|
|
42
|
+
async function getProjectConfig(dir) {
|
|
43
|
+
const configPath = getProjectConfigPath(dir);
|
|
44
|
+
if (!configPath) {
|
|
45
|
+
return { projectConfig: null, projectDir: null };
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
const config = fs_extra_1.default.readFileSync(configPath);
|
|
49
|
+
const projectConfig = JSON.parse(config.toString());
|
|
50
|
+
return {
|
|
51
|
+
projectDir: path_1.default.dirname(configPath),
|
|
52
|
+
projectConfig,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
catch (e) {
|
|
56
|
+
logger_1.uiLogger.error(en_1.lib.projects.getProjectConfig.error);
|
|
57
|
+
return { projectConfig: null, projectDir: null };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function validateProjectConfig(projectConfig, projectDir) {
|
|
61
|
+
if (!projectConfig || !projectDir) {
|
|
62
|
+
logger_1.uiLogger.error(en_1.lib.projects.validateProjectConfig.configNotFound);
|
|
63
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
64
|
+
}
|
|
65
|
+
if (!projectConfig.name || !projectConfig.srcDir) {
|
|
66
|
+
logger_1.uiLogger.error(en_1.lib.projects.validateProjectConfig.configMissingFields);
|
|
67
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
68
|
+
}
|
|
69
|
+
const resolvedPath = path_1.default.resolve(projectDir, projectConfig.srcDir);
|
|
70
|
+
if (!resolvedPath.startsWith(projectDir)) {
|
|
71
|
+
const projectConfigFile = path_1.default.relative('.', path_1.default.join(projectDir, constants_1.PROJECT_CONFIG_FILE));
|
|
72
|
+
logger_1.uiLogger.error(en_1.lib.projects.validateProjectConfig.srcOutsideProjectDir(projectConfigFile, projectConfig.srcDir));
|
|
73
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
74
|
+
}
|
|
75
|
+
if (!fs_extra_1.default.existsSync(resolvedPath)) {
|
|
76
|
+
logger_1.uiLogger.error(en_1.lib.projects.validateProjectConfig.srcDirNotFound(projectConfig.srcDir, projectDir));
|
|
77
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
78
|
+
}
|
|
79
|
+
}
|
package/lib/projects/create.js
CHANGED
|
@@ -3,13 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.EMPTY_PROJECT_TEMPLATE_NAME = void 0;
|
|
4
4
|
exports.getProjectComponentListFromRepo = getProjectComponentListFromRepo;
|
|
5
5
|
exports.getProjectTemplateListFromRepo = getProjectTemplateListFromRepo;
|
|
6
|
-
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
7
6
|
const github_1 = require("@hubspot/local-dev-lib/api/github");
|
|
8
7
|
const constants_1 = require("../constants");
|
|
9
8
|
const exitCodes_1 = require("../enums/exitCodes");
|
|
10
|
-
const lang_1 = require("../lang");
|
|
11
9
|
const index_1 = require("../errorHandlers/index");
|
|
12
|
-
const
|
|
10
|
+
const en_1 = require("../../lang/en");
|
|
11
|
+
const logger_1 = require("../ui/logger");
|
|
13
12
|
exports.EMPTY_PROJECT_TEMPLATE_NAME = 'no-template';
|
|
14
13
|
const PROJECT_TEMPLATE_PROPERTIES = ['name', 'label', 'path', 'insertPath'];
|
|
15
14
|
async function getProjectComponentListFromRepo(githubRef) {
|
|
@@ -34,17 +33,17 @@ async function getProjectTemplateListFromRepo(templateSource, githubRef) {
|
|
|
34
33
|
}
|
|
35
34
|
catch (e) {
|
|
36
35
|
(0, index_1.debugError)(e);
|
|
37
|
-
logger_1.
|
|
36
|
+
logger_1.uiLogger.error(en_1.lib.projects.create.errors.missingConfigFileTemplateSource);
|
|
38
37
|
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
39
38
|
}
|
|
40
39
|
if (!config || !config[constants_1.PROJECT_COMPONENT_TYPES.PROJECTS]) {
|
|
41
|
-
logger_1.
|
|
40
|
+
logger_1.uiLogger.error(en_1.lib.projects.create.errors.noProjectsInConfig);
|
|
42
41
|
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
43
42
|
}
|
|
44
43
|
const templates = config[constants_1.PROJECT_COMPONENT_TYPES.PROJECTS];
|
|
45
44
|
const templatesContainAllProperties = templates.every(config => PROJECT_TEMPLATE_PROPERTIES.every(p => Object.prototype.hasOwnProperty.call(config, p)));
|
|
46
45
|
if (!templatesContainAllProperties) {
|
|
47
|
-
logger_1.
|
|
46
|
+
logger_1.uiLogger.error(en_1.lib.projects.create.errors.missingPropertiesInConfig);
|
|
48
47
|
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
49
48
|
}
|
|
50
49
|
return templates;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Project } from '@hubspot/local-dev-lib/types/Project';
|
|
2
|
+
export declare function ensureProjectExists(accountId: number, projectName: string, { forceCreate, allowCreate, noLogs, withPolling, uploadCommand, }?: {
|
|
3
|
+
forceCreate?: boolean | undefined;
|
|
4
|
+
allowCreate?: boolean | undefined;
|
|
5
|
+
noLogs?: boolean | undefined;
|
|
6
|
+
withPolling?: boolean | undefined;
|
|
7
|
+
uploadCommand?: boolean | undefined;
|
|
8
|
+
}): Promise<{
|
|
9
|
+
projectExists: boolean;
|
|
10
|
+
project?: Project;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,97 @@
|
|
|
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.ensureProjectExists = ensureProjectExists;
|
|
7
|
+
const projects_1 = require("@hubspot/local-dev-lib/api/projects");
|
|
8
|
+
const index_1 = require("@hubspot/local-dev-lib/errors/index");
|
|
9
|
+
const constants_1 = require("../constants");
|
|
10
|
+
const promptUtils_1 = require("../prompts/promptUtils");
|
|
11
|
+
const exitCodes_1 = require("../enums/exitCodes");
|
|
12
|
+
const ui_1 = require("../ui");
|
|
13
|
+
const SpinniesManager_1 = __importDefault(require("../ui/SpinniesManager"));
|
|
14
|
+
const index_2 = require("../errorHandlers/index");
|
|
15
|
+
const en_1 = require("../../lang/en");
|
|
16
|
+
const logger_1 = require("../ui/logger");
|
|
17
|
+
async function pollFetchProject(accountId, projectName) {
|
|
18
|
+
// Temporary solution for gating slowness. Retry on 403 statusCode
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
20
|
+
let pollCount = 0;
|
|
21
|
+
SpinniesManager_1.default.init();
|
|
22
|
+
SpinniesManager_1.default.add('pollFetchProject', {
|
|
23
|
+
text: en_1.lib.projects.pollFetchProject.checkingProject((0, ui_1.uiAccountDescription)(accountId)),
|
|
24
|
+
});
|
|
25
|
+
const pollInterval = setInterval(async () => {
|
|
26
|
+
try {
|
|
27
|
+
const response = await (0, projects_1.fetchProject)(accountId, projectName);
|
|
28
|
+
if (response && response.data) {
|
|
29
|
+
SpinniesManager_1.default.remove('pollFetchProject');
|
|
30
|
+
clearInterval(pollInterval);
|
|
31
|
+
resolve(response);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
if ((0, index_1.isSpecifiedError)(err, {
|
|
36
|
+
statusCode: 403,
|
|
37
|
+
category: 'GATED',
|
|
38
|
+
subCategory: 'BuildPipelineErrorType.PORTAL_GATED',
|
|
39
|
+
}) &&
|
|
40
|
+
pollCount < 15) {
|
|
41
|
+
pollCount += 1;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
SpinniesManager_1.default.remove('pollFetchProject');
|
|
45
|
+
clearInterval(pollInterval);
|
|
46
|
+
reject(err);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}, constants_1.DEFAULT_POLLING_DELAY);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
async function ensureProjectExists(accountId, projectName, { forceCreate = false, allowCreate = true, noLogs = false, withPolling = false, uploadCommand = false, } = {}) {
|
|
53
|
+
const accountIdentifier = (0, ui_1.uiAccountDescription)(accountId);
|
|
54
|
+
try {
|
|
55
|
+
const { data: project } = withPolling
|
|
56
|
+
? await pollFetchProject(accountId, projectName)
|
|
57
|
+
: await (0, projects_1.fetchProject)(accountId, projectName);
|
|
58
|
+
return { projectExists: !!project, project };
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
if ((0, index_1.isSpecifiedError)(err, { statusCode: 404 })) {
|
|
62
|
+
let shouldCreateProject = forceCreate;
|
|
63
|
+
if (allowCreate && !shouldCreateProject) {
|
|
64
|
+
const promptLangFunction = uploadCommand
|
|
65
|
+
? en_1.lib.projects.ensureProjectExists.createPromptUpload
|
|
66
|
+
: en_1.lib.projects.ensureProjectExists.createPrompt;
|
|
67
|
+
const promptResult = await (0, promptUtils_1.promptUser)([
|
|
68
|
+
{
|
|
69
|
+
name: 'shouldCreateProject',
|
|
70
|
+
message: promptLangFunction(projectName, accountIdentifier),
|
|
71
|
+
type: 'confirm',
|
|
72
|
+
},
|
|
73
|
+
]);
|
|
74
|
+
shouldCreateProject = promptResult.shouldCreateProject;
|
|
75
|
+
}
|
|
76
|
+
if (shouldCreateProject) {
|
|
77
|
+
try {
|
|
78
|
+
const { data: project } = await (0, projects_1.createProject)(accountId, projectName);
|
|
79
|
+
logger_1.uiLogger.success(en_1.lib.projects.ensureProjectExists.createSuccess(projectName, accountIdentifier));
|
|
80
|
+
return { projectExists: true, project };
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
(0, index_2.logError)(err, new index_2.ApiErrorContext({ accountId }));
|
|
84
|
+
return { projectExists: false };
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
if (!noLogs) {
|
|
89
|
+
logger_1.uiLogger.log(en_1.lib.projects.ensureProjectExists.notFound(projectName, accountIdentifier));
|
|
90
|
+
}
|
|
91
|
+
return { projectExists: false };
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
(0, index_2.logError)(err, new index_2.ApiErrorContext({ accountId }));
|
|
95
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
4
|
-
const
|
|
5
|
-
const promptUtils_1 = require("./prompts/promptUtils");
|
|
4
|
+
const promptUtils_1 = require("../../prompts/promptUtils");
|
|
6
5
|
const ui_extensions_dev_server_1 = require("@hubspot/ui-extensions-dev-server");
|
|
7
6
|
const portManager_1 = require("@hubspot/local-dev-lib/portManager");
|
|
8
7
|
const urls_1 = require("@hubspot/local-dev-lib/urls");
|
|
9
8
|
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
10
|
-
const Projects_1 = require("
|
|
11
|
-
const
|
|
9
|
+
const Projects_1 = require("../../../types/Projects");
|
|
10
|
+
const en_1 = require("../../../lang/en");
|
|
11
|
+
const logger_2 = require("../../ui/logger");
|
|
12
12
|
const SERVER_KEYS = {
|
|
13
13
|
privateApp: 'privateApp',
|
|
14
14
|
publicApp: 'publicApp',
|
|
@@ -43,7 +43,7 @@ class DevServerManager {
|
|
|
43
43
|
await callback(devServer.serverInterface, compatibleComponents);
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
46
|
-
|
|
46
|
+
logger_2.uiLogger.debug(en_1.lib.DevServerManager.noCompatibleComponents(serverKey));
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -96,7 +96,7 @@ class DevServerManager {
|
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
else {
|
|
99
|
-
throw new Error(
|
|
99
|
+
throw new Error(en_1.lib.DevServerManager.notInitialized);
|
|
100
100
|
}
|
|
101
101
|
this.started = true;
|
|
102
102
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
4
|
-
const
|
|
5
|
-
const promptUtils_1 = require("./prompts/promptUtils");
|
|
4
|
+
const promptUtils_1 = require("../../prompts/promptUtils");
|
|
6
5
|
const ui_extensions_dev_server_1 = require("@hubspot/ui-extensions-dev-server");
|
|
7
6
|
const portManager_1 = require("@hubspot/local-dev-lib/portManager");
|
|
8
7
|
const urls_1 = require("@hubspot/local-dev-lib/urls");
|
|
9
8
|
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
10
|
-
const
|
|
9
|
+
const en_1 = require("../../../lang/en");
|
|
11
10
|
class DevServerManagerV2 {
|
|
12
11
|
initialized;
|
|
13
12
|
started;
|
|
@@ -56,7 +55,7 @@ class DevServerManagerV2 {
|
|
|
56
55
|
});
|
|
57
56
|
}
|
|
58
57
|
else {
|
|
59
|
-
throw new Error(
|
|
58
|
+
throw new Error(en_1.lib.DevServerManager.notInitialized);
|
|
60
59
|
}
|
|
61
60
|
this.started = true;
|
|
62
61
|
}
|
|
@@ -2,7 +2,7 @@ import { FSWatcher } from 'chokidar';
|
|
|
2
2
|
import { Build } from '@hubspot/local-dev-lib/types/Build';
|
|
3
3
|
import { PublicApp } from '@hubspot/local-dev-lib/types/Apps';
|
|
4
4
|
import { Environment } from '@hubspot/local-dev-lib/types/Config';
|
|
5
|
-
import { Component, ProjectConfig } from '
|
|
5
|
+
import { Component, ProjectConfig } from '../../../types/Projects';
|
|
6
6
|
type LocalDevManagerConstructorOptions = {
|
|
7
7
|
targetAccountId: number;
|
|
8
8
|
parentAccountId: number;
|