@hubspot/cli 7.5.1-experimental.0 → 7.5.2-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/api/migrate.d.ts +12 -3
- package/api/migrate.js +9 -2
- package/bin/cli.js +96 -93
- package/commands/account/auth.d.ts +6 -0
- package/commands/account/auth.js +167 -0
- package/commands/account/clean.d.ts +3 -7
- package/commands/account/clean.js +54 -14
- package/commands/account/createOverride.d.ts +6 -0
- package/commands/account/createOverride.js +121 -0
- package/commands/account/info.d.ts +3 -7
- package/commands/account/info.js +51 -9
- package/commands/account/list.d.ts +3 -7
- package/commands/account/list.js +38 -13
- package/commands/account/remove.d.ts +3 -7
- package/commands/account/remove.js +57 -11
- package/commands/account/removeOverride.d.ts +6 -0
- package/commands/account/removeOverride.js +93 -0
- 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 +39 -9
- package/commands/account.d.ts +3 -4
- package/commands/account.js +33 -53
- package/commands/app/migrate.d.ts +5 -6
- package/commands/app/migrate.js +60 -44
- 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 -10
- package/commands/auth.d.ts +3 -7
- package/commands/auth.js +20 -25
- 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 +133 -100
- package/commands/cms.d.ts +3 -1
- package/commands/cms.js +22 -16
- package/commands/completion.d.ts +3 -1
- package/commands/completion.js +23 -13
- package/commands/config/migrate.d.ts +6 -0
- package/commands/config/migrate.js +75 -0
- package/commands/config/set.d.ts +10 -1
- package/commands/config/set.js +61 -32
- package/commands/config.d.ts +3 -1
- package/commands/config.js +19 -11
- package/commands/create/api-sample.d.ts +3 -1
- package/commands/create/api-sample.js +34 -36
- 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 -75
- 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 +21 -11
- package/commands/customObject/schema/fetch-all.d.ts +4 -9
- package/commands/customObject/schema/fetch-all.js +19 -11
- package/commands/customObject/schema/fetch.d.ts +4 -9
- package/commands/customObject/schema/fetch.js +19 -11
- 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 +20 -48
- package/commands/doctor.d.ts +6 -8
- package/commands/doctor.js +30 -22
- package/commands/feedback.d.ts +4 -1
- package/commands/feedback.js +38 -48
- package/commands/fetch.d.ts +12 -1
- package/commands/fetch.js +49 -34
- 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 -42
- 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 -11
- package/commands/hubdb/clear.d.ts +4 -9
- package/commands/hubdb/clear.js +21 -15
- package/commands/hubdb/create.d.ts +4 -9
- package/commands/hubdb/create.js +23 -17
- package/commands/hubdb/delete.d.ts +4 -9
- package/commands/hubdb/delete.js +24 -16
- package/commands/hubdb/fetch.d.ts +4 -9
- package/commands/hubdb/fetch.js +20 -14
- 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 +24 -47
- package/commands/init.d.ts +3 -7
- package/commands/init.js +25 -23
- package/commands/lint.d.ts +6 -4
- package/commands/lint.js +42 -44
- package/commands/list.d.ts +3 -7
- package/commands/list.js +21 -16
- package/commands/logs.d.ts +10 -1
- package/commands/logs.js +53 -45
- package/commands/module/marketplace-validate.d.ts +6 -1
- package/commands/module/marketplace-validate.js +39 -30
- package/commands/module.d.ts +3 -1
- package/commands/module.js +23 -12
- package/commands/mv.d.ts +3 -7
- package/commands/mv.js +20 -15
- package/commands/open.d.ts +3 -7
- package/commands/open.js +20 -15
- package/commands/project/add.d.ts +8 -9
- package/commands/project/add.js +53 -85
- package/commands/project/cloneApp.d.ts +6 -8
- package/commands/project/cloneApp.js +51 -47
- package/commands/project/create.d.ts +4 -1
- package/commands/project/create.js +132 -81
- package/commands/project/deploy.d.ts +4 -6
- package/commands/project/deploy.js +66 -36
- package/commands/project/dev/deprecatedFlow.d.ts +8 -2
- package/commands/project/dev/deprecatedFlow.js +41 -26
- package/commands/project/dev/index.d.ts +4 -5
- package/commands/project/dev/index.js +103 -33
- package/commands/project/dev/unifiedFlow.d.ts +11 -2
- package/commands/project/dev/unifiedFlow.js +85 -46
- 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 +7 -8
- package/commands/project/migrate.js +49 -26
- 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/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 +10 -1
- package/commands/project/upload.js +110 -56
- 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 -37
- package/commands/remove.d.ts +3 -7
- package/commands/remove.js +22 -20
- package/commands/sandbox/create.d.ts +4 -9
- package/commands/sandbox/create.js +27 -21
- package/commands/sandbox/delete.d.ts +4 -9
- package/commands/sandbox/delete.js +35 -29
- package/commands/sandbox.d.ts +3 -4
- package/commands/sandbox.js +18 -44
- package/commands/secret/addSecret.d.ts +4 -9
- package/commands/secret/addSecret.js +21 -15
- package/commands/secret/deleteSecret.d.ts +4 -9
- package/commands/secret/deleteSecret.js +28 -18
- package/commands/secret/listSecret.d.ts +4 -9
- package/commands/secret/listSecret.js +19 -13
- package/commands/secret/updateSecret.d.ts +4 -9
- package/commands/secret/updateSecret.js +25 -17
- package/commands/secret.d.ts +3 -4
- package/commands/secret.js +23 -49
- package/commands/theme/generate-selectors.d.ts +3 -7
- package/commands/theme/generate-selectors.js +20 -16
- package/commands/theme/marketplace-validate.d.ts +4 -9
- package/commands/theme/marketplace-validate.js +22 -18
- package/commands/theme/preview.d.ts +4 -9
- package/commands/theme/preview.js +36 -30
- package/commands/theme.d.ts +3 -4
- package/commands/theme.js +22 -48
- package/commands/upload.d.ts +12 -1
- package/commands/upload.js +116 -135
- package/commands/watch.d.ts +14 -1
- package/commands/watch.js +74 -76
- package/lang/en.d.ts +3094 -0
- package/lang/en.js +2957 -3316
- package/lang/en.lyaml +89 -214
- package/lib/accountTypes.d.ts +1 -0
- package/lib/accountTypes.js +11 -0
- package/lib/app/migrate.d.ts +33 -4
- package/lib/app/migrate.js +171 -86
- package/lib/app/migrate_legacy.d.ts +2 -2
- package/lib/app/migrate_legacy.js +12 -11
- package/lib/app/urls.d.ts +16 -0
- package/lib/app/urls.js +16 -0
- package/lib/buildAccount.d.ts +1 -2
- package/lib/buildAccount.js +11 -10
- package/lib/commonOpts.d.ts +4 -7
- package/lib/commonOpts.js +47 -19
- package/lib/configMigrate.d.ts +2 -0
- package/lib/configMigrate.js +83 -0
- package/lib/configOptions.d.ts +4 -0
- package/lib/configOptions.js +41 -45
- package/lib/constants.d.ts +28 -0
- package/lib/constants.js +29 -1
- package/lib/dependencyManagement.d.ts +0 -5
- package/lib/dependencyManagement.js +14 -40
- 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 +59 -45
- package/lib/errorHandlers/index.js +6 -7
- package/lib/errorHandlers/suppressError.js +18 -26
- package/lib/filesystem.d.ts +1 -1
- package/lib/generateSelectors.js +3 -6
- package/lib/hasFeature.d.ts +3 -1
- 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/middleware/__test__/yargsChecksMiddleware.test.js +3 -3
- package/lib/middleware/autoUpdateMiddleware.d.ts +1 -0
- package/lib/middleware/autoUpdateMiddleware.js +89 -0
- package/lib/middleware/configMiddleware.js +23 -3
- package/lib/middleware/fireAlarmMiddleware.d.ts +4 -0
- package/lib/middleware/fireAlarmMiddleware.js +125 -0
- package/lib/middleware/yargsChecksMiddleware.js +2 -2
- package/lib/npm.d.ts +9 -0
- package/lib/npm.js +36 -0
- package/lib/oauth.js +1 -2
- package/lib/process.js +1 -2
- package/lib/projectProfiles.d.ts +6 -0
- package/lib/projectProfiles.js +65 -0
- package/lib/projects/ProjectLogsManager.d.ts +1 -1
- package/lib/projects/ProjectLogsManager.js +16 -21
- 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 +45 -41
- package/lib/projects/components.d.ts +2 -0
- package/lib/projects/components.js +82 -0
- package/lib/projects/config.d.ts +9 -0
- package/lib/projects/config.js +79 -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} +23 -15
- package/lib/projects/create/v3.d.ts +27 -0
- package/lib/projects/create/v3.js +158 -0
- package/lib/projects/ensureProjectExists.d.ts +11 -0
- package/lib/projects/ensureProjectExists.js +97 -0
- package/lib/projects/localDev/AppDevModeInterface.d.ts +27 -0
- package/lib/projects/localDev/AppDevModeInterface.js +186 -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/projects/localDev/DevServerManagerV2.d.ts +22 -0
- package/lib/{DevServerManagerV2.js → projects/localDev/DevServerManagerV2.js} +22 -19
- package/lib/projects/localDev/LocalDevLogger.d.ts +30 -0
- package/lib/projects/localDev/LocalDevLogger.js +159 -0
- package/lib/{LocalDevManager.d.ts → projects/localDev/LocalDevManager.d.ts} +1 -1
- package/lib/{LocalDevManager.js → projects/localDev/LocalDevManager.js} +57 -83
- 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/{localDev.d.ts → projects/localDev/helpers.d.ts} +6 -4
- package/lib/{localDev.js → projects/localDev/helpers.js} +127 -114
- package/lib/projects/ui.d.ts +1 -0
- package/lib/projects/ui.js +15 -0
- package/lib/projects/upload.d.ts +14 -2
- package/lib/projects/upload.js +25 -35
- package/lib/projects/urls.d.ts +2 -0
- package/lib/projects/urls.js +14 -2
- 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.d.ts +2 -10
- 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 +20 -4
- package/lib/prompts/createProjectPrompt.js +41 -13
- package/lib/prompts/createTemplatePrompt.d.ts +22 -4
- package/lib/prompts/createTemplatePrompt.js +1 -2
- package/lib/prompts/downloadProjectPrompt.js +3 -4
- package/lib/prompts/installAppPrompt.d.ts +1 -0
- package/lib/prompts/installAppPrompt.js +35 -0
- package/lib/prompts/personalAccessKeyPrompt.js +17 -18
- package/lib/prompts/previewPrompt.js +5 -6
- package/lib/prompts/projectAddPrompt.d.ts +5 -1
- package/lib/prompts/projectAddPrompt.js +35 -8
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +6 -1
- package/lib/prompts/projectDevTargetAccountPrompt.js +15 -16
- package/lib/prompts/projectNamePrompt.js +5 -6
- package/lib/prompts/projectsLogsPrompt.js +3 -2
- package/lib/prompts/promptUtils.d.ts +3 -2
- package/lib/prompts/promptUtils.js +2 -1
- package/lib/prompts/sandboxesPrompt.js +5 -6
- package/lib/prompts/secretPrompt.js +2 -3
- package/lib/prompts/selectAppPrompt.d.ts +2 -0
- package/lib/prompts/selectAppPrompt.js +40 -0
- package/lib/prompts/selectHubDBTablePrompt.js +11 -8
- package/lib/prompts/{selectPublicAppPrompt.d.ts → selectPublicAppForMigrationPrompt.d.ts} +1 -1
- package/lib/prompts/{selectPublicAppPrompt.js → selectPublicAppForMigrationPrompt.js} +8 -9
- package/lib/prompts/setAsDefaultAccountPrompt.js +11 -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/testUtils.d.ts +3 -3
- package/lib/testUtils.js +8 -9
- 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 +20 -17
- 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/upload.d.ts +1 -1
- package/lib/validation.js +4 -5
- package/lib/yargsUtils.d.ts +5 -1
- package/lib/yargsUtils.js +6 -0
- package/package.json +17 -11
- package/types/Cms.d.ts +30 -0
- package/types/Cms.js +2 -0
- package/types/LocalDev.d.ts +34 -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 +14 -14
- package/lib/DevServerManagerV2.d.ts +0 -33
- package/lib/LocalDevManagerV2.d.ts +0 -64
- package/lib/LocalDevManagerV2.js +0 -377
- package/lib/projects/create.d.ts +0 -5
- package/lib/projects/index.d.ts +0 -21
- package/lib/projects/index.js +0 -194
- package/lib/prompts/installPublicAppPrompt.d.ts +0 -1
- package/lib/prompts/installPublicAppPrompt.js +0 -40
|
@@ -6,31 +6,31 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const path_1 = __importDefault(require("path"));
|
|
7
7
|
const chokidar_1 = __importDefault(require("chokidar"));
|
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
-
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
10
9
|
const localDevAuth_1 = require("@hubspot/local-dev-lib/api/localDevAuth");
|
|
11
10
|
const appsDev_1 = require("@hubspot/local-dev-lib/api/appsDev");
|
|
12
11
|
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
13
|
-
const
|
|
14
|
-
const
|
|
12
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
13
|
+
const constants_1 = require("../../constants");
|
|
14
|
+
const SpinniesManager_1 = __importDefault(require("../../ui/SpinniesManager"));
|
|
15
15
|
const DevServerManager_1 = __importDefault(require("./DevServerManager"));
|
|
16
|
-
const exitCodes_1 = require("
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
16
|
+
const exitCodes_1 = require("../../enums/exitCodes");
|
|
17
|
+
const helpers_1 = require("./helpers");
|
|
18
|
+
const structure_1 = require("../../projects/structure");
|
|
19
|
+
const Projects_1 = require("../../../types/Projects");
|
|
20
|
+
const ui_1 = require("../../ui");
|
|
21
|
+
const index_1 = require("../../errorHandlers/index");
|
|
22
|
+
const installAppPrompt_1 = require("../../prompts/installAppPrompt");
|
|
23
|
+
const promptUtils_1 = require("../../prompts/promptUtils");
|
|
24
|
+
const process_1 = require("../../process");
|
|
25
|
+
const en_1 = require("../../../lang/en");
|
|
26
|
+
const logger_2 = require("../../ui/logger");
|
|
27
|
+
const urls_1 = require("../../app/urls");
|
|
27
28
|
const WATCH_EVENTS = {
|
|
28
29
|
add: 'add',
|
|
29
30
|
change: 'change',
|
|
30
31
|
unlink: 'unlink',
|
|
31
32
|
unlinkDir: 'unlinkDir',
|
|
32
33
|
};
|
|
33
|
-
const i18nKey = 'lib.LocalDevManager';
|
|
34
34
|
class LocalDevManager {
|
|
35
35
|
targetAccountId;
|
|
36
36
|
targetProjectAccountId;
|
|
@@ -69,15 +69,13 @@ class LocalDevManager {
|
|
|
69
69
|
this.mostRecentUploadWarning = null;
|
|
70
70
|
this.projectSourceDir = path_1.default.join(this.projectDir, this.projectConfig.srcDir);
|
|
71
71
|
if (!this.targetAccountId || !this.projectConfig || !this.projectDir) {
|
|
72
|
-
|
|
72
|
+
logger_2.uiLogger.log(en_1.lib.LocalDevManager.failedToInitialize);
|
|
73
73
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
async setActiveApp(appUid) {
|
|
77
77
|
if (!appUid) {
|
|
78
|
-
|
|
79
|
-
devCommand: (0, ui_1.uiCommandReference)('hs project dev'),
|
|
80
|
-
}));
|
|
78
|
+
logger_2.uiLogger.error(en_1.lib.LocalDevManager.missingUid);
|
|
81
79
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
82
80
|
}
|
|
83
81
|
this.activeApp =
|
|
@@ -115,14 +113,10 @@ class LocalDevManager {
|
|
|
115
113
|
return;
|
|
116
114
|
}
|
|
117
115
|
(0, ui_1.uiLine)();
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
installCount: this.publicAppActiveInstalls,
|
|
121
|
-
accountText: this.publicAppActiveInstalls === 1 ? 'account' : 'accounts',
|
|
122
|
-
}));
|
|
123
|
-
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.activeInstallWarning.explanation`));
|
|
116
|
+
logger_2.uiLogger.warn(en_1.lib.LocalDevManager.activeInstallWarning.installCount(this.activePublicAppData.name, this.publicAppActiveInstalls));
|
|
117
|
+
logger_2.uiLogger.log(en_1.lib.LocalDevManager.activeInstallWarning.explanation);
|
|
124
118
|
(0, ui_1.uiLine)();
|
|
125
|
-
const proceed = await (0, promptUtils_1.confirmPrompt)(
|
|
119
|
+
const proceed = await (0, promptUtils_1.confirmPrompt)(en_1.lib.LocalDevManager.activeInstallWarning.confirmationPrompt, { defaultAnswer: false });
|
|
126
120
|
if (!proceed) {
|
|
127
121
|
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
128
122
|
}
|
|
@@ -132,12 +126,8 @@ class LocalDevManager {
|
|
|
132
126
|
SpinniesManager_1.default.init();
|
|
133
127
|
// Local dev currently relies on the existence of a deployed build in the target account
|
|
134
128
|
if (!this.deployedBuild) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
accountIdentifier: (0, ui_1.uiAccountDescription)(this.targetProjectAccountId),
|
|
138
|
-
uploadCommand: this.getUploadCommand(),
|
|
139
|
-
}));
|
|
140
|
-
logger_1.logger.log();
|
|
129
|
+
logger_2.uiLogger.error(en_1.lib.LocalDevManager.noDeployedBuild(this.projectConfig.name, (0, ui_1.uiAccountDescription)(this.targetProjectAccountId), this.getUploadCommand()));
|
|
130
|
+
logger_2.uiLogger.log('');
|
|
141
131
|
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
142
132
|
}
|
|
143
133
|
const setupSucceeded = await this.devServerSetup();
|
|
@@ -147,21 +137,18 @@ class LocalDevManager {
|
|
|
147
137
|
else if (!this.debug) {
|
|
148
138
|
console.clear();
|
|
149
139
|
}
|
|
150
|
-
(0, ui_1.uiBetaTag)(
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
projectName: this.projectConfig.name,
|
|
156
|
-
})));
|
|
157
|
-
logger_1.logger.log((0, ui_1.uiLink)((0, lang_1.i18n)(`${i18nKey}.viewProjectLink`), (0, urls_1.getProjectDetailUrl)(this.projectConfig.name, this.targetProjectAccountId) || ''));
|
|
140
|
+
(0, ui_1.uiBetaTag)(en_1.lib.LocalDevManager.betaMessage);
|
|
141
|
+
logger_2.uiLogger.log((0, ui_1.uiLink)(en_1.lib.LocalDevManager.learnMoreLocalDevServer, 'https://developers.hubspot.com/docs/platform/project-cli-commands#start-a-local-development-server'));
|
|
142
|
+
logger_2.uiLogger.log('');
|
|
143
|
+
logger_2.uiLogger.log(chalk_1.default.hex(ui_1.UI_COLORS.SORBET)(en_1.lib.LocalDevManager.running(this.projectConfig.name, (0, ui_1.uiAccountDescription)(this.targetAccountId))));
|
|
144
|
+
logger_2.uiLogger.log(en_1.lib.LocalDevManager.viewProjectLink(this.projectConfig.name, this.targetProjectAccountId));
|
|
158
145
|
if (this.activeApp?.type === Projects_1.ComponentTypes.PublicApp) {
|
|
159
|
-
|
|
146
|
+
logger_2.uiLogger.log((0, ui_1.uiLink)(en_1.lib.LocalDevManager.viewTestAccountLink, (0, helpers_1.getAccountHomeUrl)(this.targetAccountId)));
|
|
160
147
|
}
|
|
161
|
-
|
|
162
|
-
|
|
148
|
+
logger_2.uiLogger.log('');
|
|
149
|
+
logger_2.uiLogger.log(en_1.lib.LocalDevManager.quitHelper);
|
|
163
150
|
(0, ui_1.uiLine)();
|
|
164
|
-
|
|
151
|
+
logger_2.uiLogger.log('');
|
|
165
152
|
await this.devServerStart();
|
|
166
153
|
// Initialize project file watcher to detect configuration file changes
|
|
167
154
|
this.startWatching();
|
|
@@ -174,7 +161,7 @@ class LocalDevManager {
|
|
|
174
161
|
async stop(showProgress = true) {
|
|
175
162
|
if (showProgress) {
|
|
176
163
|
SpinniesManager_1.default.add('cleanupMessage', {
|
|
177
|
-
text:
|
|
164
|
+
text: en_1.lib.LocalDevManager.exitingStart,
|
|
178
165
|
});
|
|
179
166
|
}
|
|
180
167
|
await this.stopWatching();
|
|
@@ -182,14 +169,14 @@ class LocalDevManager {
|
|
|
182
169
|
if (!cleanupSucceeded) {
|
|
183
170
|
if (showProgress) {
|
|
184
171
|
SpinniesManager_1.default.fail('cleanupMessage', {
|
|
185
|
-
text:
|
|
172
|
+
text: en_1.lib.LocalDevManager.exitingFail,
|
|
186
173
|
});
|
|
187
174
|
}
|
|
188
175
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
189
176
|
}
|
|
190
177
|
if (showProgress) {
|
|
191
178
|
SpinniesManager_1.default.succeed('cleanupMessage', {
|
|
192
|
-
text:
|
|
179
|
+
text: en_1.lib.LocalDevManager.exitingSucceed,
|
|
193
180
|
});
|
|
194
181
|
}
|
|
195
182
|
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
@@ -201,7 +188,14 @@ class LocalDevManager {
|
|
|
201
188
|
const { data: { isInstalledWithScopeGroups, previouslyAuthorizedScopeGroups }, } = await (0, localDevAuth_1.fetchAppInstallationData)(this.targetAccountId, this.projectId, this.activeApp.config.uid, this.activeApp.config.auth.requiredScopes, this.activeApp.config.auth.optionalScopes);
|
|
202
189
|
const isReinstall = previouslyAuthorizedScopeGroups.length > 0;
|
|
203
190
|
if (!isInstalledWithScopeGroups) {
|
|
204
|
-
|
|
191
|
+
const installUrl = (0, urls_1.getOauthAppInstallUrl)({
|
|
192
|
+
targetAccountId: this.targetAccountId,
|
|
193
|
+
env: this.env,
|
|
194
|
+
clientId: this.activePublicAppData.clientId,
|
|
195
|
+
scopes: this.activeApp.config.auth.requiredScopes,
|
|
196
|
+
redirectUrls: this.activeApp.config.auth.redirectUrls,
|
|
197
|
+
});
|
|
198
|
+
await (0, installAppPrompt_1.installAppPrompt)(installUrl, isReinstall);
|
|
205
199
|
}
|
|
206
200
|
}
|
|
207
201
|
updateKeypressListeners() {
|
|
@@ -227,31 +221,22 @@ class LocalDevManager {
|
|
|
227
221
|
(0, structure_1.componentIsPublicApp)(this.activeApp) &&
|
|
228
222
|
this.publicAppActiveInstalls &&
|
|
229
223
|
this.publicAppActiveInstalls > 0
|
|
230
|
-
?
|
|
231
|
-
|
|
232
|
-
installText: this.publicAppActiveInstalls === 1 ? 'install' : 'installs',
|
|
233
|
-
})
|
|
234
|
-
: (0, lang_1.i18n)(`${i18nKey}.uploadWarning.defaultWarning`);
|
|
224
|
+
? en_1.lib.LocalDevManager.uploadWarning.defaultPublicAppWarning(this.publicAppActiveInstalls, this.publicAppActiveInstalls === 1 ? 'install' : 'installs')
|
|
225
|
+
: en_1.lib.LocalDevManager.uploadWarning.defaultWarning;
|
|
235
226
|
}
|
|
236
227
|
// Avoid logging the warning to the console if it is currently the most
|
|
237
228
|
// recently logged warning. We do not want to spam the console with the same message.
|
|
238
229
|
if (!this.uploadWarnings[warning]) {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
command: (0, ui_1.uiCommandReference)('hs project dev'),
|
|
243
|
-
}));
|
|
230
|
+
logger_2.uiLogger.log('');
|
|
231
|
+
logger_2.uiLogger.warn(en_1.lib.LocalDevManager.uploadWarning.header(warning));
|
|
232
|
+
logger_2.uiLogger.log(en_1.lib.LocalDevManager.uploadWarning.stopDev);
|
|
244
233
|
if (this.isGithubLinked) {
|
|
245
|
-
|
|
234
|
+
logger_2.uiLogger.log(en_1.lib.LocalDevManager.uploadWarning.pushToGithub);
|
|
246
235
|
}
|
|
247
236
|
else {
|
|
248
|
-
|
|
249
|
-
command: this.getUploadCommand(),
|
|
250
|
-
}));
|
|
237
|
+
logger_2.uiLogger.log(en_1.lib.LocalDevManager.uploadWarning.runUpload(this.getUploadCommand()));
|
|
251
238
|
}
|
|
252
|
-
|
|
253
|
-
command: (0, ui_1.uiCommandReference)('hs project dev'),
|
|
254
|
-
}));
|
|
239
|
+
logger_2.uiLogger.log(en_1.lib.LocalDevManager.uploadWarning.restartDev);
|
|
255
240
|
this.mostRecentUploadWarning = warning;
|
|
256
241
|
this.uploadWarnings[warning] = true;
|
|
257
242
|
}
|
|
@@ -281,21 +266,19 @@ class LocalDevManager {
|
|
|
281
266
|
if (Object.values(Projects_1.ComponentTypes).includes(type)) {
|
|
282
267
|
const cardConfigs = (0, structure_1.getAppCardConfigs)(config, path);
|
|
283
268
|
if (!deployedComponentNames.includes(config.name)) {
|
|
284
|
-
missingComponents.push(`${
|
|
269
|
+
missingComponents.push(`${en_1.lib.LocalDevManager.uploadWarning.appLabel} ${config.name}`);
|
|
285
270
|
}
|
|
286
271
|
cardConfigs.forEach(cardConfig => {
|
|
287
272
|
if (cardConfig.data &&
|
|
288
273
|
cardConfig.data.title &&
|
|
289
274
|
!deployedComponentNames.includes(cardConfig.data.title)) {
|
|
290
|
-
missingComponents.push(`${
|
|
275
|
+
missingComponents.push(`${en_1.lib.LocalDevManager.uploadWarning.uiExtensionLabel} ${cardConfig.data.title}`);
|
|
291
276
|
}
|
|
292
277
|
});
|
|
293
278
|
}
|
|
294
279
|
});
|
|
295
280
|
if (missingComponents.length) {
|
|
296
|
-
this.logUploadWarning(
|
|
297
|
-
missingComponents: missingComponents.join(', '),
|
|
298
|
-
}));
|
|
281
|
+
this.logUploadWarning(en_1.lib.LocalDevManager.uploadWarning.missingComponents(missingComponents.join(', ')));
|
|
299
282
|
}
|
|
300
283
|
}
|
|
301
284
|
startWatching() {
|
|
@@ -348,9 +331,7 @@ class LocalDevManager {
|
|
|
348
331
|
if (this.debug) {
|
|
349
332
|
logger_1.logger.error(e);
|
|
350
333
|
}
|
|
351
|
-
|
|
352
|
-
message: e instanceof Error ? e.message : '',
|
|
353
|
-
}));
|
|
334
|
+
logger_2.uiLogger.error(en_1.lib.LocalDevManager.devServer.setupError(e instanceof Error ? e.message : ''));
|
|
354
335
|
return false;
|
|
355
336
|
}
|
|
356
337
|
}
|
|
@@ -365,9 +346,7 @@ class LocalDevManager {
|
|
|
365
346
|
if (this.debug) {
|
|
366
347
|
logger_1.logger.error(e);
|
|
367
348
|
}
|
|
368
|
-
|
|
369
|
-
message: e instanceof Error ? e.message : '',
|
|
370
|
-
}));
|
|
349
|
+
logger_2.uiLogger.error(en_1.lib.LocalDevManager.devServer.startError(e instanceof Error ? e.message : ''));
|
|
371
350
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
372
351
|
}
|
|
373
352
|
}
|
|
@@ -379,9 +358,7 @@ class LocalDevManager {
|
|
|
379
358
|
if (this.debug) {
|
|
380
359
|
logger_1.logger.error(e);
|
|
381
360
|
}
|
|
382
|
-
|
|
383
|
-
message: e instanceof Error ? e.message : '',
|
|
384
|
-
}));
|
|
361
|
+
logger_2.uiLogger.error(en_1.lib.LocalDevManager.devServer.fileChangeError(e instanceof Error ? e.message : ''));
|
|
385
362
|
}
|
|
386
363
|
}
|
|
387
364
|
async devServerCleanup() {
|
|
@@ -393,12 +370,9 @@ class LocalDevManager {
|
|
|
393
370
|
if (this.debug) {
|
|
394
371
|
logger_1.logger.error(e);
|
|
395
372
|
}
|
|
396
|
-
|
|
397
|
-
message: e instanceof Error ? e.message : '',
|
|
398
|
-
}));
|
|
373
|
+
logger_2.uiLogger.error(en_1.lib.LocalDevManager.devServer.cleanupError(e instanceof Error ? e.message : ''));
|
|
399
374
|
return false;
|
|
400
375
|
}
|
|
401
376
|
}
|
|
402
377
|
}
|
|
403
378
|
exports.default = LocalDevManager;
|
|
404
|
-
module.exports = LocalDevManager;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { IntermediateRepresentationNodeLocalDev } from '@hubspot/project-parsing-lib/src/lib/types';
|
|
2
|
+
import LocalDevState from './LocalDevState';
|
|
3
|
+
import LocalDevLogger from './LocalDevLogger';
|
|
4
|
+
import { LocalDevStateConstructorOptions, LocalDevStateListener, LocalDevServerMessage } from '../../../types/LocalDev';
|
|
5
|
+
declare class LocalDevProcess {
|
|
6
|
+
private state;
|
|
7
|
+
private _logger;
|
|
8
|
+
private devServerManager;
|
|
9
|
+
constructor(options: LocalDevStateConstructorOptions);
|
|
10
|
+
get projectDir(): string;
|
|
11
|
+
get projectId(): number;
|
|
12
|
+
get projectName(): string;
|
|
13
|
+
get targetProjectAccountId(): number;
|
|
14
|
+
get targetTestingAccountId(): number;
|
|
15
|
+
get projectNodes(): {
|
|
16
|
+
[key: string]: IntermediateRepresentationNodeLocalDev;
|
|
17
|
+
};
|
|
18
|
+
get logger(): LocalDevLogger;
|
|
19
|
+
get configFilesUpdatedSinceLastUpload(): Set<string>;
|
|
20
|
+
private setupDevServers;
|
|
21
|
+
private startDevServers;
|
|
22
|
+
private cleanupDevServers;
|
|
23
|
+
private compareLocalProjectToDeployed;
|
|
24
|
+
private projectConfigValidForUpload;
|
|
25
|
+
private updateProjectNodes;
|
|
26
|
+
handleFileChange(filePath: string, event: string): Promise<void>;
|
|
27
|
+
handleConfigFileChange(filePath: string, event: string): Promise<void>;
|
|
28
|
+
start(): Promise<void>;
|
|
29
|
+
stop(showProgress?: boolean): Promise<void>;
|
|
30
|
+
uploadProject(): Promise<boolean>;
|
|
31
|
+
addStateListener<K extends keyof LocalDevState>(key: K, listener: LocalDevStateListener<K>, callOnInit?: boolean): void;
|
|
32
|
+
sendDevServerMessage(message: LocalDevServerMessage): void;
|
|
33
|
+
}
|
|
34
|
+
export default LocalDevProcess;
|
|
@@ -0,0 +1,201 @@
|
|
|
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
|
+
const project_parsing_lib_1 = require("@hubspot/project-parsing-lib");
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const LocalDevState_1 = __importDefault(require("./LocalDevState"));
|
|
9
|
+
const LocalDevLogger_1 = __importDefault(require("./LocalDevLogger"));
|
|
10
|
+
const DevServerManagerV2_1 = __importDefault(require("./DevServerManagerV2"));
|
|
11
|
+
const exitCodes_1 = require("../../enums/exitCodes");
|
|
12
|
+
const transform_1 = require("@hubspot/project-parsing-lib/src/lib/transform");
|
|
13
|
+
const config_1 = require("../config");
|
|
14
|
+
const upload_1 = require("../upload");
|
|
15
|
+
const buildAndDeploy_1 = require("../buildAndDeploy");
|
|
16
|
+
class LocalDevProcess {
|
|
17
|
+
state;
|
|
18
|
+
_logger;
|
|
19
|
+
devServerManager;
|
|
20
|
+
constructor(options) {
|
|
21
|
+
this.state = new LocalDevState_1.default(options);
|
|
22
|
+
this._logger = new LocalDevLogger_1.default(this.state);
|
|
23
|
+
this.devServerManager = new DevServerManagerV2_1.default({
|
|
24
|
+
localDevState: this.state,
|
|
25
|
+
logger: this._logger,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
get projectDir() {
|
|
29
|
+
return this.state.projectDir;
|
|
30
|
+
}
|
|
31
|
+
get projectId() {
|
|
32
|
+
return this.state.projectId;
|
|
33
|
+
}
|
|
34
|
+
get projectName() {
|
|
35
|
+
return this.state.projectName;
|
|
36
|
+
}
|
|
37
|
+
get targetProjectAccountId() {
|
|
38
|
+
return this.state.targetProjectAccountId;
|
|
39
|
+
}
|
|
40
|
+
get targetTestingAccountId() {
|
|
41
|
+
return this.state.targetTestingAccountId;
|
|
42
|
+
}
|
|
43
|
+
get projectNodes() {
|
|
44
|
+
return this.state.projectNodes;
|
|
45
|
+
}
|
|
46
|
+
get logger() {
|
|
47
|
+
return this._logger;
|
|
48
|
+
}
|
|
49
|
+
get configFilesUpdatedSinceLastUpload() {
|
|
50
|
+
return this.state.configFilesUpdatedSinceLastUpload;
|
|
51
|
+
}
|
|
52
|
+
async setupDevServers() {
|
|
53
|
+
try {
|
|
54
|
+
await this.devServerManager.setup();
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
this.logger.devServerSetupError(e);
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async startDevServers() {
|
|
63
|
+
try {
|
|
64
|
+
await this.devServerManager.start();
|
|
65
|
+
}
|
|
66
|
+
catch (e) {
|
|
67
|
+
this.logger.devServerStartError(e);
|
|
68
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async cleanupDevServers() {
|
|
72
|
+
try {
|
|
73
|
+
await this.devServerManager.cleanup();
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
catch (e) {
|
|
77
|
+
this.logger.devServerCleanupError(e);
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
compareLocalProjectToDeployed() {
|
|
82
|
+
const deployedComponentNames = this.state.deployedBuild.subbuildStatuses.map(subbuildStatus => subbuildStatus.buildName);
|
|
83
|
+
const missingProjectNodes = [];
|
|
84
|
+
Object.values(this.projectNodes).forEach(node => {
|
|
85
|
+
if (!deployedComponentNames.includes(node.uid)) {
|
|
86
|
+
const userFriendlyName = (0, transform_1.mapToUserFriendlyName)(node.componentType);
|
|
87
|
+
const label = userFriendlyName ? `[${userFriendlyName}] ` : '';
|
|
88
|
+
missingProjectNodes.push(`${label}${node.uid}`);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
if (missingProjectNodes.length) {
|
|
92
|
+
this.logger.missingComponentsWarning(missingProjectNodes);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async projectConfigValidForUpload() {
|
|
96
|
+
const { projectConfig } = await (0, config_1.getProjectConfig)();
|
|
97
|
+
if (!projectConfig) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
Object.keys(projectConfig).forEach(key => {
|
|
101
|
+
const field = key;
|
|
102
|
+
if (projectConfig[field] !== this.state.projectConfig[field]) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
async updateProjectNodes() {
|
|
109
|
+
const intermediateRepresentation = await (0, project_parsing_lib_1.translateForLocalDev)({
|
|
110
|
+
projectSourceDir: path_1.default.join(this.state.projectDir, this.state.projectConfig.srcDir),
|
|
111
|
+
platformVersion: this.state.projectConfig.platformVersion,
|
|
112
|
+
accountId: this.state.targetProjectAccountId,
|
|
113
|
+
}, {
|
|
114
|
+
configFilesUpdatedSinceLastUpload: this.state.configFilesUpdatedSinceLastUpload,
|
|
115
|
+
});
|
|
116
|
+
this.state.projectNodes =
|
|
117
|
+
intermediateRepresentation.intermediateNodesIndexedByUid;
|
|
118
|
+
}
|
|
119
|
+
async handleFileChange(filePath, event) {
|
|
120
|
+
await this.updateProjectNodes();
|
|
121
|
+
try {
|
|
122
|
+
this.devServerManager.fileChange({ filePath, event });
|
|
123
|
+
}
|
|
124
|
+
catch (e) {
|
|
125
|
+
this.logger.fileChangeError(e);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
async handleConfigFileChange(filePath, event) {
|
|
129
|
+
if (event === 'add' || event === 'change') {
|
|
130
|
+
this.state.addUpdatedConfigFileUpdatedSinceLastUpload(filePath);
|
|
131
|
+
}
|
|
132
|
+
await this.updateProjectNodes();
|
|
133
|
+
this.logger.uploadWarning();
|
|
134
|
+
}
|
|
135
|
+
async start() {
|
|
136
|
+
this.logger.resetSpinnies();
|
|
137
|
+
// Local dev currently relies on the existence of a deployed build in the target account
|
|
138
|
+
if (!this.state.deployedBuild) {
|
|
139
|
+
this.logger.noDeployedBuild();
|
|
140
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
141
|
+
}
|
|
142
|
+
const setupSucceeded = await this.setupDevServers();
|
|
143
|
+
if (!setupSucceeded) {
|
|
144
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
145
|
+
}
|
|
146
|
+
this.logger.startupMessage();
|
|
147
|
+
await this.startDevServers();
|
|
148
|
+
this.logger.monitorConsoleOutput();
|
|
149
|
+
// Verify that there are no mismatches between components in the local project
|
|
150
|
+
// and components in the deployed build of the project.
|
|
151
|
+
this.compareLocalProjectToDeployed();
|
|
152
|
+
}
|
|
153
|
+
async stop(showProgress = true) {
|
|
154
|
+
if (showProgress) {
|
|
155
|
+
this.logger.cleanupStart();
|
|
156
|
+
}
|
|
157
|
+
const cleanupSucceeded = await this.cleanupDevServers();
|
|
158
|
+
if (!cleanupSucceeded) {
|
|
159
|
+
if (showProgress) {
|
|
160
|
+
this.logger.cleanupError();
|
|
161
|
+
}
|
|
162
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
163
|
+
}
|
|
164
|
+
if (showProgress) {
|
|
165
|
+
this.logger.cleanupSuccess();
|
|
166
|
+
}
|
|
167
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
168
|
+
}
|
|
169
|
+
async uploadProject() {
|
|
170
|
+
this.logger.uploadInitiated();
|
|
171
|
+
const isUploadable = await this.projectConfigValidForUpload();
|
|
172
|
+
if (!isUploadable) {
|
|
173
|
+
this.logger.projectConfigMismatch();
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
const { uploadError } = await (0, upload_1.handleProjectUpload)({
|
|
177
|
+
accountId: this.state.targetProjectAccountId,
|
|
178
|
+
projectConfig: this.state.projectConfig,
|
|
179
|
+
projectDir: this.state.projectDir,
|
|
180
|
+
callbackFunc: buildAndDeploy_1.pollProjectBuildAndDeploy,
|
|
181
|
+
sendIR: true,
|
|
182
|
+
skipValidation: true,
|
|
183
|
+
});
|
|
184
|
+
if (uploadError) {
|
|
185
|
+
this.logger.uploadError(uploadError);
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
this.state.resetConfigFilesUpdatedSinceLastUpload();
|
|
189
|
+
this.updateProjectNodes();
|
|
190
|
+
this.logger.uploadSuccess();
|
|
191
|
+
this.logger.clearUploadWarnings();
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
addStateListener(key, listener, callOnInit = false) {
|
|
195
|
+
this.state.addListener(key, listener, callOnInit);
|
|
196
|
+
}
|
|
197
|
+
sendDevServerMessage(message) {
|
|
198
|
+
this.state.devServerMessage = message;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
exports.default = LocalDevProcess;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Build } from '@hubspot/local-dev-lib/types/Build';
|
|
2
|
+
import { IntermediateRepresentationNodeLocalDev } from '@hubspot/project-parsing-lib/src/lib/types';
|
|
3
|
+
import { Environment } from '@hubspot/local-dev-lib/types/Config';
|
|
4
|
+
import { ProjectConfig } from '../../../types/Projects';
|
|
5
|
+
import { LocalDevStateConstructorOptions, LocalDevStateListener, AppLocalDevData, LocalDevServerMessage } from '../../../types/LocalDev';
|
|
6
|
+
declare class LocalDevState {
|
|
7
|
+
private _targetProjectAccountId;
|
|
8
|
+
private _targetTestingAccountId;
|
|
9
|
+
private _projectConfig;
|
|
10
|
+
private _projectDir;
|
|
11
|
+
private _projectId;
|
|
12
|
+
private _projectName;
|
|
13
|
+
private _debug;
|
|
14
|
+
private _deployedBuild?;
|
|
15
|
+
private _isGithubLinked;
|
|
16
|
+
private _projectNodes;
|
|
17
|
+
private _env;
|
|
18
|
+
private _listeners;
|
|
19
|
+
private _configFilesUpdatedSinceLastUpload;
|
|
20
|
+
private _appData;
|
|
21
|
+
private _devServerMessage;
|
|
22
|
+
constructor({ targetProjectAccountId, targetTestingAccountId, projectConfig, projectDir, projectId, projectName, debug, deployedBuild, isGithubLinked, initialProjectNodes, env, }: LocalDevStateConstructorOptions);
|
|
23
|
+
private runListeners;
|
|
24
|
+
get targetProjectAccountId(): number;
|
|
25
|
+
get targetTestingAccountId(): number;
|
|
26
|
+
get projectConfig(): ProjectConfig;
|
|
27
|
+
get projectDir(): string;
|
|
28
|
+
get projectId(): number;
|
|
29
|
+
get projectName(): string;
|
|
30
|
+
get debug(): boolean;
|
|
31
|
+
get deployedBuild(): Build | undefined;
|
|
32
|
+
get isGithubLinked(): boolean;
|
|
33
|
+
get projectNodes(): {
|
|
34
|
+
[key: string]: IntermediateRepresentationNodeLocalDev;
|
|
35
|
+
};
|
|
36
|
+
set projectNodes(nodes: {
|
|
37
|
+
[key: string]: IntermediateRepresentationNodeLocalDev;
|
|
38
|
+
});
|
|
39
|
+
get env(): Environment;
|
|
40
|
+
get configFilesUpdatedSinceLastUpload(): Set<string>;
|
|
41
|
+
addUpdatedConfigFileUpdatedSinceLastUpload(filePath: string): void;
|
|
42
|
+
resetConfigFilesUpdatedSinceLastUpload(): void;
|
|
43
|
+
get appData(): Record<string, AppLocalDevData>;
|
|
44
|
+
getAppDataByUid(uid: string): AppLocalDevData | undefined;
|
|
45
|
+
setAppDataForUid(uid: string, appData: AppLocalDevData): void;
|
|
46
|
+
get devServerMessage(): string;
|
|
47
|
+
set devServerMessage(message: LocalDevServerMessage);
|
|
48
|
+
addListener<K extends keyof LocalDevState>(key: K, listener: LocalDevStateListener<K>, callOnInit?: boolean): void;
|
|
49
|
+
}
|
|
50
|
+
export default LocalDevState;
|