@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/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cli",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.6.0-beta.1",
|
|
4
4
|
"description": "The official CLI for developing on HubSpot",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": "https://github.com/HubSpot/hubspot-cli",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@hubspot/local-dev-lib": "3.
|
|
9
|
-
"@hubspot/project-parsing-lib": "0.
|
|
10
|
-
"@hubspot/serverless-dev-runtime": "7.0.
|
|
8
|
+
"@hubspot/local-dev-lib": "3.10.0",
|
|
9
|
+
"@hubspot/project-parsing-lib": "0.3.2",
|
|
10
|
+
"@hubspot/serverless-dev-runtime": "7.0.6",
|
|
11
11
|
"@hubspot/theme-preview-dev-server": "0.0.10",
|
|
12
|
-
"@hubspot/ui-extensions-dev-server": "0.
|
|
12
|
+
"@hubspot/ui-extensions-dev-server": "0.9.2",
|
|
13
13
|
"archiver": "7.0.1",
|
|
14
14
|
"boxen": "8.0.1",
|
|
15
15
|
"chalk": "4.1.2",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"table": "6.9.0",
|
|
29
29
|
"tmp": "0.2.3",
|
|
30
30
|
"update-notifier": "5.1.0",
|
|
31
|
+
"ws": "^8.18.2",
|
|
31
32
|
"yargs": "17.7.2",
|
|
32
33
|
"yargs-parser": "21.1.1"
|
|
33
34
|
},
|
|
@@ -41,10 +42,11 @@
|
|
|
41
42
|
"@types/js-yaml": "^4.0.9",
|
|
42
43
|
"@types/semver": "^7.5.8",
|
|
43
44
|
"@types/tmp": "^0.2.6",
|
|
45
|
+
"@types/ws": "^8.18.1",
|
|
44
46
|
"@types/yargs": "^17.0.33",
|
|
45
47
|
"@typescript-eslint/eslint-plugin": "^8.30.1",
|
|
46
48
|
"@typescript-eslint/parser": "^8.11.0",
|
|
47
|
-
"axios": "^1.7.
|
|
49
|
+
"axios": "^1.7.4",
|
|
48
50
|
"eslint": "^8.56.0",
|
|
49
51
|
"eslint-plugin-import": "^2.31.0",
|
|
50
52
|
"husky": "^4.3.8",
|
|
@@ -59,24 +61,30 @@
|
|
|
59
61
|
"typescript": "^5.6.2"
|
|
60
62
|
},
|
|
61
63
|
"optionalDependencies": {
|
|
62
|
-
"@hubspot/cms-dev-server": "^1.0.9"
|
|
64
|
+
"@hubspot/cms-dev-server": "^1.0.9",
|
|
65
|
+
"@modelcontextprotocol/sdk": "1.13.3"
|
|
63
66
|
},
|
|
64
67
|
"scripts": {
|
|
65
68
|
"build": "ts-node ./scripts/build.ts",
|
|
66
|
-
"
|
|
69
|
+
"build-docker": "docker image build --tag hs-cli-image . && docker image prune -f",
|
|
70
|
+
"circular-deps": "yarn madge --circular .",
|
|
71
|
+
"debug-mcp": "yarn build && npx @modelcontextprotocol/inspector node dist/mcp-server/server.js",
|
|
72
|
+
"hs": "yarn build && node ./dist/bin/hs",
|
|
73
|
+
"hs-debug": "yarn build && NODE_DEBUG=http* node --inspect-brk ./dist/bin/hs",
|
|
74
|
+
"lint": "echo 'Linting is disabled for Blazar'",
|
|
75
|
+
"lint:local": "eslint . && prettier --list-different './**/*.{ts,js,json}'",
|
|
67
76
|
"list-all-commands": "yarn ts-node ./scripts/get-all-commands.ts",
|
|
77
|
+
"local-link": "yarn ts-node ./scripts/linking.ts",
|
|
78
|
+
"mcp-local": "yarn ts-node ./scripts/mcp-local.ts",
|
|
68
79
|
"prettier:write": "prettier --write './**/*.{ts,js,json}'",
|
|
69
|
-
"
|
|
80
|
+
"release": "yarn ts-node ./scripts/release.ts release",
|
|
81
|
+
"test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js",
|
|
70
82
|
"test-cli": "yarn build && yarn --cwd 'acceptance-tests' test-ci",
|
|
71
83
|
"test-cli-debug": "yarn build && yarn --cwd 'acceptance-tests' test-debug",
|
|
72
|
-
"test-cli-qa": "yarn build && yarn --cwd 'acceptance-tests' test-qa",
|
|
73
84
|
"test-cli-latest": "yarn build && yarn build-docker && docker container run -it --rm --name=hs-cli-container hs-cli-image yarn --cwd 'acceptance-tests' test-latest",
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"hs": "yarn build && node ./dist/bin/hs",
|
|
78
|
-
"hs-debug": "yarn build && NODE_DEBUG=http* node --inspect-brk ./dist/bin/hs",
|
|
79
|
-
"update-ldl": "yarn add --exact @hubspot/local-dev-lib@latest"
|
|
85
|
+
"test-cli-qa": "yarn build && yarn --cwd 'acceptance-tests' test-qa",
|
|
86
|
+
"update-ldl": "yarn add --exact @hubspot/local-dev-lib@latest",
|
|
87
|
+
"view-unreleased-changes": "node ./scripts/unreleasedChanges.js"
|
|
80
88
|
},
|
|
81
89
|
"lint-staged": {
|
|
82
90
|
"**/*.{js,ts,scss,css}": [
|
package/types/Cms.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { CommonArgs, ConfigArgs } from './Yargs';
|
|
2
|
+
export type CreateArgs = CommonArgs & ConfigArgs & {
|
|
3
|
+
branch?: string;
|
|
4
|
+
type: string;
|
|
5
|
+
dest: string;
|
|
6
|
+
name: string;
|
|
7
|
+
internal?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type CmsAssetOperationArgs = {
|
|
10
|
+
assetType: string;
|
|
11
|
+
name: string;
|
|
12
|
+
dest: string;
|
|
13
|
+
getInternalVersion: boolean;
|
|
14
|
+
commandArgs: CreateArgs;
|
|
15
|
+
};
|
|
16
|
+
export type CreatableCmsAsset = {
|
|
17
|
+
hidden: boolean;
|
|
18
|
+
dest: (args: CmsAssetOperationArgs) => string;
|
|
19
|
+
validate?: (args: CmsAssetOperationArgs) => boolean;
|
|
20
|
+
execute: (args: CmsAssetOperationArgs) => Promise<void>;
|
|
21
|
+
};
|
|
22
|
+
export type ApiSampleChoice = {
|
|
23
|
+
name: string;
|
|
24
|
+
description: string;
|
|
25
|
+
id: string;
|
|
26
|
+
languages: string[];
|
|
27
|
+
};
|
|
28
|
+
export type ApiSampleConfig = {
|
|
29
|
+
samples: ApiSampleChoice[];
|
|
30
|
+
};
|
package/types/Cms.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { IntermediateRepresentationNodeLocalDev } from '@hubspot/project-parsing-lib/src/lib/types';
|
|
2
|
+
import { Build } from '@hubspot/local-dev-lib/types/Build';
|
|
3
|
+
import { Environment } from '@hubspot/local-dev-lib/types/Config';
|
|
4
|
+
import { ValueOf } from '@hubspot/local-dev-lib/types/Utils';
|
|
5
|
+
import { ProjectConfig } from './Projects';
|
|
6
|
+
import LocalDevState from '../lib/projects/localDev/LocalDevState';
|
|
7
|
+
import { APP_INSTALLATION_STATES, LOCAL_DEV_SERVER_MESSAGE_TYPES } from '../lib/constants';
|
|
8
|
+
export type LocalDevStateConstructorOptions = {
|
|
9
|
+
targetProjectAccountId: number;
|
|
10
|
+
targetTestingAccountId: number;
|
|
11
|
+
projectConfig: ProjectConfig;
|
|
12
|
+
projectDir: string;
|
|
13
|
+
projectId: number;
|
|
14
|
+
projectName: string;
|
|
15
|
+
debug?: boolean;
|
|
16
|
+
deployedBuild?: Build;
|
|
17
|
+
isGithubLinked: boolean;
|
|
18
|
+
initialProjectNodes: {
|
|
19
|
+
[key: string]: IntermediateRepresentationNodeLocalDev;
|
|
20
|
+
};
|
|
21
|
+
env: Environment;
|
|
22
|
+
};
|
|
23
|
+
export type LocalDevWebsocketMessage = {
|
|
24
|
+
type: string;
|
|
25
|
+
data?: unknown;
|
|
26
|
+
};
|
|
27
|
+
export type LocalDevStateListener<K extends keyof LocalDevState> = (value: LocalDevState[K]) => void;
|
|
28
|
+
export type AppLocalDevData = {
|
|
29
|
+
id: number;
|
|
30
|
+
clientId: string;
|
|
31
|
+
name: string;
|
|
32
|
+
installationState: ValueOf<typeof APP_INSTALLATION_STATES>;
|
|
33
|
+
scopeGroupIds: number[];
|
|
34
|
+
};
|
|
35
|
+
export type LocalDevServerMessage = ValueOf<typeof LOCAL_DEV_SERVER_MESSAGE_TYPES>;
|
package/types/Projects.d.ts
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import { Build, SubbuildStatus } from '@hubspot/local-dev-lib/types/Build';
|
|
2
2
|
import { Deploy, SubdeployStatus } from '@hubspot/local-dev-lib/types/Deploy';
|
|
3
|
+
import { appComponent, marketplaceDistribution, oAuth, privateDistribution, staticAuth } from '../lib/constants';
|
|
3
4
|
export type ProjectTemplate = {
|
|
4
5
|
name: string;
|
|
5
6
|
label: string;
|
|
6
7
|
path: string;
|
|
7
|
-
insertPath: string;
|
|
8
8
|
};
|
|
9
9
|
export type ComponentTemplate = {
|
|
10
10
|
path: string;
|
|
11
11
|
label: string;
|
|
12
|
-
|
|
12
|
+
type: string;
|
|
13
|
+
parentComponent?: string;
|
|
14
|
+
supportedAuthTypes?: string[];
|
|
15
|
+
supportedDistributions?: string[];
|
|
16
|
+
};
|
|
17
|
+
export type ComponentTemplateChoice = {
|
|
18
|
+
name: string;
|
|
19
|
+
value: ComponentTemplate;
|
|
20
|
+
disabled?: string | boolean;
|
|
13
21
|
};
|
|
14
22
|
export type ProjectConfig = {
|
|
15
23
|
name: string;
|
|
@@ -32,9 +40,18 @@ export type ProjectPollStatusFunctionText = {
|
|
|
32
40
|
TYPE_KEY: string;
|
|
33
41
|
SUBTASK_NAME_KEY: string;
|
|
34
42
|
};
|
|
43
|
+
export type ParentComponent = {
|
|
44
|
+
label: string;
|
|
45
|
+
type: typeof appComponent;
|
|
46
|
+
authType: typeof staticAuth | typeof oAuth;
|
|
47
|
+
distribution: typeof privateDistribution | typeof marketplaceDistribution;
|
|
48
|
+
path: string;
|
|
49
|
+
};
|
|
35
50
|
export type ProjectTemplateRepoConfig = {
|
|
36
51
|
projects?: ProjectTemplate[];
|
|
37
52
|
components?: ComponentTemplate[];
|
|
53
|
+
defaultFiles?: string;
|
|
54
|
+
parentComponents?: ParentComponent[];
|
|
38
55
|
};
|
|
39
56
|
export type ProjectPollResult = {
|
|
40
57
|
succeeded: boolean;
|
package/types/Prompts.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DeveloperTestAccount } from '@hubspot/local-dev-lib/types/developerTestAccounts';
|
|
2
1
|
export type GenericPromptResponse = {
|
|
3
2
|
[key: string]: any;
|
|
4
3
|
};
|
|
@@ -23,10 +22,4 @@ export type PromptConfig<T extends GenericPromptResponse> = {
|
|
|
23
22
|
mask?: string;
|
|
24
23
|
filter?: (input: string) => string;
|
|
25
24
|
};
|
|
26
|
-
export type ProjectDevTargetAccountPromptResponse = {
|
|
27
|
-
targetAccountId: number | null;
|
|
28
|
-
createNestedAccount: boolean;
|
|
29
|
-
parentAccountId?: number | null;
|
|
30
|
-
notInConfigAccount?: DeveloperTestAccount | null;
|
|
31
|
-
};
|
|
32
25
|
export {};
|
package/types/Yargs.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Options, CommandModule, Argv } from 'yargs';
|
|
2
|
+
import { CmsPublishMode } from '@hubspot/local-dev-lib/types/Files';
|
|
2
3
|
export type CommonArgs = {
|
|
3
4
|
derivedAccountId: number;
|
|
4
5
|
providedAccountId?: number;
|
|
@@ -23,10 +24,18 @@ export type OverwriteArgs = Options & {
|
|
|
23
24
|
export type StringArgType = Options & {
|
|
24
25
|
type: 'string';
|
|
25
26
|
};
|
|
26
|
-
export type ProjectDevArgs = CommonArgs & ConfigArgs & EnvironmentArgs
|
|
27
|
+
export type ProjectDevArgs = CommonArgs & ConfigArgs & EnvironmentArgs & {
|
|
28
|
+
profile?: string;
|
|
29
|
+
testingAccount?: string | number;
|
|
30
|
+
projectAccount?: string | number;
|
|
31
|
+
};
|
|
27
32
|
export type TestingArgs = {
|
|
28
33
|
qa?: boolean;
|
|
29
34
|
};
|
|
35
|
+
export type CmsPublishModeArgs = {
|
|
36
|
+
'cms-publish-mode'?: CmsPublishMode;
|
|
37
|
+
m?: CmsPublishMode;
|
|
38
|
+
};
|
|
30
39
|
export interface YargsCommandModule<T, U> extends CommandModule<T, U> {
|
|
31
40
|
builder: (yargs: Argv) => Promise<Argv<U>>;
|
|
32
41
|
}
|
package/lib/projects/create.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { RepoPath } from '@hubspot/local-dev-lib/types/Github';
|
|
2
|
-
import { ProjectTemplate, ComponentTemplate } from '../../types/Projects';
|
|
3
|
-
export declare const EMPTY_PROJECT_TEMPLATE_NAME = "no-template";
|
|
4
|
-
export declare function getProjectComponentListFromRepo(githubRef: string): Promise<ComponentTemplate[]>;
|
|
5
|
-
export declare function getProjectTemplateListFromRepo(templateSource: RepoPath, githubRef: string): Promise<ProjectTemplate[]>;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { FSWatcher } from 'chokidar';
|
|
2
|
-
import { Build } from '@hubspot/local-dev-lib/types/Build';
|
|
3
|
-
import { PublicApp } from '@hubspot/local-dev-lib/types/Apps';
|
|
4
|
-
import { Environment } from '@hubspot/local-dev-lib/types/Config';
|
|
5
|
-
import { ProjectConfig } from '../../../types/Projects';
|
|
6
|
-
import { IntermediateRepresentationNodeLocalDev } from '@hubspot/project-parsing-lib/src/lib/types';
|
|
7
|
-
import { AppIRNode } from '../../../types/ProjectComponents';
|
|
8
|
-
type LocalDevManagerConstructorOptions = {
|
|
9
|
-
targetProjectAccountId: number;
|
|
10
|
-
targetTestingAccountId: number;
|
|
11
|
-
projectConfig: ProjectConfig;
|
|
12
|
-
projectDir: string;
|
|
13
|
-
projectId: number;
|
|
14
|
-
debug?: boolean;
|
|
15
|
-
deployedBuild?: Build;
|
|
16
|
-
isGithubLinked: boolean;
|
|
17
|
-
projectNodes: {
|
|
18
|
-
[key: string]: IntermediateRepresentationNodeLocalDev;
|
|
19
|
-
};
|
|
20
|
-
env: Environment;
|
|
21
|
-
};
|
|
22
|
-
declare class LocalDevManagerV2 {
|
|
23
|
-
targetProjectAccountId: number;
|
|
24
|
-
targetTestingAccountId: number;
|
|
25
|
-
projectConfig: ProjectConfig;
|
|
26
|
-
projectDir: string;
|
|
27
|
-
projectId: number;
|
|
28
|
-
debug: boolean;
|
|
29
|
-
deployedBuild?: Build;
|
|
30
|
-
isGithubLinked: boolean;
|
|
31
|
-
watcher: FSWatcher | null;
|
|
32
|
-
uploadWarnings: {
|
|
33
|
-
[key: string]: boolean;
|
|
34
|
-
};
|
|
35
|
-
projectNodes: {
|
|
36
|
-
[key: string]: IntermediateRepresentationNodeLocalDev;
|
|
37
|
-
};
|
|
38
|
-
activeApp: AppIRNode | null;
|
|
39
|
-
activePublicAppData: PublicApp | null;
|
|
40
|
-
env: Environment;
|
|
41
|
-
publicAppActiveInstalls: number | null;
|
|
42
|
-
projectSourceDir: string;
|
|
43
|
-
mostRecentUploadWarning: string | null;
|
|
44
|
-
constructor(options: LocalDevManagerConstructorOptions);
|
|
45
|
-
setActiveApp(appUid?: string): Promise<void>;
|
|
46
|
-
setActivePublicAppData(): Promise<void>;
|
|
47
|
-
checkActivePublicAppInstalls(): Promise<void>;
|
|
48
|
-
start(): Promise<void>;
|
|
49
|
-
stop(showProgress?: boolean): Promise<void>;
|
|
50
|
-
checkPublicAppInstallation(): Promise<void>;
|
|
51
|
-
updateKeypressListeners(): void;
|
|
52
|
-
getUploadCommand(): string;
|
|
53
|
-
logUploadWarning(reason?: string): void;
|
|
54
|
-
monitorConsoleOutput(): void;
|
|
55
|
-
compareLocalProjectToDeployed(): void;
|
|
56
|
-
startWatching(): void;
|
|
57
|
-
stopWatching(): Promise<void>;
|
|
58
|
-
handleWatchEvent(filePath: string, event: string, configPaths: string[]): void;
|
|
59
|
-
devServerSetup(): Promise<boolean>;
|
|
60
|
-
devServerStart(): Promise<void>;
|
|
61
|
-
devServerFileChange(filePath: string, event: string): void;
|
|
62
|
-
devServerCleanup(): Promise<boolean>;
|
|
63
|
-
}
|
|
64
|
-
export default LocalDevManagerV2;
|
|
@@ -1,345 +0,0 @@
|
|
|
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 path_1 = __importDefault(require("path"));
|
|
7
|
-
const chokidar_1 = __importDefault(require("chokidar"));
|
|
8
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
-
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
10
|
-
const localDevAuth_1 = require("@hubspot/local-dev-lib/api/localDevAuth");
|
|
11
|
-
const appsDev_1 = require("@hubspot/local-dev-lib/api/appsDev");
|
|
12
|
-
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
13
|
-
const project_parsing_lib_1 = require("@hubspot/project-parsing-lib");
|
|
14
|
-
const constants_1 = require("../../constants");
|
|
15
|
-
const SpinniesManager_1 = __importDefault(require("../../ui/SpinniesManager"));
|
|
16
|
-
const DevServerManagerV2_1 = __importDefault(require("./DevServerManagerV2"));
|
|
17
|
-
const exitCodes_1 = require("../../enums/exitCodes");
|
|
18
|
-
const urls_1 = require("../../projects/urls");
|
|
19
|
-
const structure_1 = require("../../projects/structure");
|
|
20
|
-
const ui_1 = require("../../ui");
|
|
21
|
-
const index_1 = require("../../errorHandlers/index");
|
|
22
|
-
const installPublicAppPrompt_1 = require("../../prompts/installPublicAppPrompt");
|
|
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 WATCH_EVENTS = {
|
|
28
|
-
add: 'add',
|
|
29
|
-
change: 'change',
|
|
30
|
-
unlink: 'unlink',
|
|
31
|
-
unlinkDir: 'unlinkDir',
|
|
32
|
-
};
|
|
33
|
-
class LocalDevManagerV2 {
|
|
34
|
-
targetProjectAccountId;
|
|
35
|
-
targetTestingAccountId;
|
|
36
|
-
projectConfig;
|
|
37
|
-
projectDir;
|
|
38
|
-
projectId;
|
|
39
|
-
debug;
|
|
40
|
-
deployedBuild;
|
|
41
|
-
isGithubLinked;
|
|
42
|
-
watcher;
|
|
43
|
-
uploadWarnings;
|
|
44
|
-
projectNodes;
|
|
45
|
-
activeApp;
|
|
46
|
-
activePublicAppData;
|
|
47
|
-
env;
|
|
48
|
-
publicAppActiveInstalls;
|
|
49
|
-
projectSourceDir;
|
|
50
|
-
mostRecentUploadWarning;
|
|
51
|
-
constructor(options) {
|
|
52
|
-
this.targetProjectAccountId = options.targetProjectAccountId;
|
|
53
|
-
this.targetTestingAccountId = options.targetTestingAccountId;
|
|
54
|
-
this.projectConfig = options.projectConfig;
|
|
55
|
-
this.projectDir = options.projectDir;
|
|
56
|
-
this.projectId = options.projectId;
|
|
57
|
-
this.debug = options.debug || false;
|
|
58
|
-
this.deployedBuild = options.deployedBuild;
|
|
59
|
-
this.isGithubLinked = options.isGithubLinked;
|
|
60
|
-
this.watcher = null;
|
|
61
|
-
this.uploadWarnings = {};
|
|
62
|
-
this.projectNodes = options.projectNodes;
|
|
63
|
-
this.activeApp = null;
|
|
64
|
-
this.activePublicAppData = null;
|
|
65
|
-
this.env = options.env;
|
|
66
|
-
this.publicAppActiveInstalls = null;
|
|
67
|
-
this.mostRecentUploadWarning = null;
|
|
68
|
-
this.projectSourceDir = path_1.default.join(this.projectDir, this.projectConfig.srcDir);
|
|
69
|
-
if (!this.targetProjectAccountId ||
|
|
70
|
-
!this.projectConfig ||
|
|
71
|
-
!this.projectDir) {
|
|
72
|
-
logger_2.uiLogger.log(en_1.lib.LocalDevManager.failedToInitialize);
|
|
73
|
-
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
async setActiveApp(appUid) {
|
|
77
|
-
if (!appUid) {
|
|
78
|
-
logger_2.uiLogger.error(en_1.lib.LocalDevManager.missingUid);
|
|
79
|
-
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
80
|
-
}
|
|
81
|
-
const app = Object.values(this.projectNodes).find(component => component.uid === appUid) || null;
|
|
82
|
-
if (app && (0, structure_1.isAppIRNode)(app)) {
|
|
83
|
-
this.activeApp = app;
|
|
84
|
-
if (app.config.distribution === constants_1.APP_DISTRIBUTION_TYPES.MARKETPLACE) {
|
|
85
|
-
try {
|
|
86
|
-
await this.setActivePublicAppData();
|
|
87
|
-
await this.checkActivePublicAppInstalls();
|
|
88
|
-
await this.checkPublicAppInstallation();
|
|
89
|
-
}
|
|
90
|
-
catch (e) {
|
|
91
|
-
(0, index_1.logError)(e);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
async setActivePublicAppData() {
|
|
98
|
-
const { data: { results: portalPublicApps }, } = await (0, appsDev_1.fetchPublicAppsForPortal)(this.targetProjectAccountId);
|
|
99
|
-
const activePublicAppData = portalPublicApps.find(({ sourceId }) => sourceId === this.activeApp?.uid);
|
|
100
|
-
if (!activePublicAppData) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
const { data: { uniquePortalInstallCount }, } = await (0, appsDev_1.fetchPublicAppProductionInstallCounts)(activePublicAppData.id, this.targetProjectAccountId);
|
|
104
|
-
this.activePublicAppData = activePublicAppData;
|
|
105
|
-
this.publicAppActiveInstalls = uniquePortalInstallCount;
|
|
106
|
-
}
|
|
107
|
-
async checkActivePublicAppInstalls() {
|
|
108
|
-
if (!this.activePublicAppData ||
|
|
109
|
-
!this.publicAppActiveInstalls ||
|
|
110
|
-
this.publicAppActiveInstalls < 1) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
(0, ui_1.uiLine)();
|
|
114
|
-
logger_2.uiLogger.warn(en_1.lib.LocalDevManager.activeInstallWarning.installCount(this.activePublicAppData.name, this.publicAppActiveInstalls, this.publicAppActiveInstalls === 1 ? 'account' : 'accounts'));
|
|
115
|
-
logger_2.uiLogger.log(en_1.lib.LocalDevManager.activeInstallWarning.explanation);
|
|
116
|
-
(0, ui_1.uiLine)();
|
|
117
|
-
const proceed = await (0, promptUtils_1.confirmPrompt)(en_1.lib.LocalDevManager.activeInstallWarning.confirmationPrompt, { defaultAnswer: false });
|
|
118
|
-
if (!proceed) {
|
|
119
|
-
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
async start() {
|
|
123
|
-
SpinniesManager_1.default.stopAll();
|
|
124
|
-
SpinniesManager_1.default.init();
|
|
125
|
-
// Local dev currently relies on the existence of a deployed build in the target account
|
|
126
|
-
if (!this.deployedBuild) {
|
|
127
|
-
logger_2.uiLogger.error(en_1.lib.LocalDevManager.noDeployedBuild(this.projectConfig.name, (0, ui_1.uiAccountDescription)(this.targetProjectAccountId), this.getUploadCommand()));
|
|
128
|
-
logger_2.uiLogger.log('');
|
|
129
|
-
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
130
|
-
}
|
|
131
|
-
const setupSucceeded = await this.devServerSetup();
|
|
132
|
-
if (!setupSucceeded) {
|
|
133
|
-
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
134
|
-
}
|
|
135
|
-
else if (!this.debug) {
|
|
136
|
-
console.clear();
|
|
137
|
-
}
|
|
138
|
-
(0, ui_1.uiBetaTag)(en_1.lib.LocalDevManager.betaMessage);
|
|
139
|
-
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'));
|
|
140
|
-
logger_2.uiLogger.log('');
|
|
141
|
-
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.targetProjectAccountId))));
|
|
142
|
-
logger_2.uiLogger.log((0, ui_1.uiLink)(en_1.lib.LocalDevManager.viewProjectLink, (0, urls_1.getProjectDetailUrl)(this.projectConfig.name, this.targetProjectAccountId) || ''));
|
|
143
|
-
logger_2.uiLogger.log('');
|
|
144
|
-
logger_2.uiLogger.log(en_1.lib.LocalDevManager.quitHelper);
|
|
145
|
-
(0, ui_1.uiLine)();
|
|
146
|
-
logger_2.uiLogger.log('');
|
|
147
|
-
await this.devServerStart();
|
|
148
|
-
// Initialize project file watcher to detect configuration file changes
|
|
149
|
-
this.startWatching();
|
|
150
|
-
this.updateKeypressListeners();
|
|
151
|
-
this.monitorConsoleOutput();
|
|
152
|
-
// Verify that there are no mismatches between components in the local project
|
|
153
|
-
// and components in the deployed build of the project.
|
|
154
|
-
this.compareLocalProjectToDeployed();
|
|
155
|
-
}
|
|
156
|
-
async stop(showProgress = true) {
|
|
157
|
-
if (showProgress) {
|
|
158
|
-
SpinniesManager_1.default.add('cleanupMessage', {
|
|
159
|
-
text: en_1.lib.LocalDevManager.exitingStart,
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
await this.stopWatching();
|
|
163
|
-
const cleanupSucceeded = await this.devServerCleanup();
|
|
164
|
-
if (!cleanupSucceeded) {
|
|
165
|
-
if (showProgress) {
|
|
166
|
-
SpinniesManager_1.default.fail('cleanupMessage', {
|
|
167
|
-
text: en_1.lib.LocalDevManager.exitingFail,
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
171
|
-
}
|
|
172
|
-
if (showProgress) {
|
|
173
|
-
SpinniesManager_1.default.succeed('cleanupMessage', {
|
|
174
|
-
text: en_1.lib.LocalDevManager.exitingSucceed,
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
178
|
-
}
|
|
179
|
-
async checkPublicAppInstallation() {
|
|
180
|
-
if (!this.activeApp || !this.activePublicAppData) {
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
const { data: { isInstalledWithScopeGroups, previouslyAuthorizedScopeGroups }, } = await (0, localDevAuth_1.fetchAppInstallationData)(this.targetTestingAccountId, this.projectId, this.activeApp.uid, this.activeApp.config.auth.requiredScopes, this.activeApp.config.auth.optionalScopes);
|
|
184
|
-
const isReinstall = previouslyAuthorizedScopeGroups.length > 0;
|
|
185
|
-
if (!isInstalledWithScopeGroups) {
|
|
186
|
-
await (0, installPublicAppPrompt_1.installPublicAppPrompt)(this.env, this.targetTestingAccountId, this.activePublicAppData.clientId, this.activeApp.config.auth.requiredScopes, this.activeApp.config.auth.redirectUrls, isReinstall);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
updateKeypressListeners() {
|
|
190
|
-
(0, process_1.handleKeypress)(async (key) => {
|
|
191
|
-
if ((key.ctrl && key.name === 'c') || key.name === 'q') {
|
|
192
|
-
this.stop();
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
getUploadCommand() {
|
|
197
|
-
const currentDefaultAccount = (0, config_1.getConfigDefaultAccount)() || undefined;
|
|
198
|
-
return this.targetProjectAccountId !== (0, config_1.getAccountId)(currentDefaultAccount)
|
|
199
|
-
? (0, ui_1.uiCommandReference)(`hs project upload --account=${this.targetProjectAccountId}`)
|
|
200
|
-
: (0, ui_1.uiCommandReference)('hs project upload');
|
|
201
|
-
}
|
|
202
|
-
logUploadWarning(reason) {
|
|
203
|
-
let warning = reason;
|
|
204
|
-
if (!warning) {
|
|
205
|
-
warning =
|
|
206
|
-
this.publicAppActiveInstalls && this.publicAppActiveInstalls > 0
|
|
207
|
-
? en_1.lib.LocalDevManager.uploadWarning.defaultMarketplaceAppWarning(this.publicAppActiveInstalls, this.publicAppActiveInstalls === 1 ? 'account' : 'accounts')
|
|
208
|
-
: en_1.lib.LocalDevManager.uploadWarning.defaultWarning;
|
|
209
|
-
}
|
|
210
|
-
// Avoid logging the warning to the console if it is currently the most
|
|
211
|
-
// recently logged warning. We do not want to spam the console with the same message.
|
|
212
|
-
if (!this.uploadWarnings[warning]) {
|
|
213
|
-
logger_2.uiLogger.log('');
|
|
214
|
-
logger_2.uiLogger.warn(en_1.lib.LocalDevManager.uploadWarning.header(warning));
|
|
215
|
-
logger_2.uiLogger.log(en_1.lib.LocalDevManager.uploadWarning.stopDev);
|
|
216
|
-
if (this.isGithubLinked) {
|
|
217
|
-
logger_2.uiLogger.log(en_1.lib.LocalDevManager.uploadWarning.pushToGithub);
|
|
218
|
-
}
|
|
219
|
-
else {
|
|
220
|
-
logger_2.uiLogger.log(en_1.lib.LocalDevManager.uploadWarning.runUpload(this.getUploadCommand()));
|
|
221
|
-
}
|
|
222
|
-
logger_2.uiLogger.log(en_1.lib.LocalDevManager.uploadWarning.restartDev);
|
|
223
|
-
this.mostRecentUploadWarning = warning;
|
|
224
|
-
this.uploadWarnings[warning] = true;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
monitorConsoleOutput() {
|
|
228
|
-
const originalStdoutWrite = process.stdout.write.bind(process.stdout);
|
|
229
|
-
function customStdoutWrite(chunk, encoding, callback) {
|
|
230
|
-
// Reset the most recently logged warning
|
|
231
|
-
if (this.mostRecentUploadWarning &&
|
|
232
|
-
this.uploadWarnings[this.mostRecentUploadWarning]) {
|
|
233
|
-
delete this.uploadWarnings[this.mostRecentUploadWarning];
|
|
234
|
-
}
|
|
235
|
-
if (typeof encoding === 'function') {
|
|
236
|
-
return originalStdoutWrite(chunk, callback);
|
|
237
|
-
}
|
|
238
|
-
return originalStdoutWrite(chunk, encoding, callback);
|
|
239
|
-
}
|
|
240
|
-
customStdoutWrite.bind(this);
|
|
241
|
-
process.stdout.write = customStdoutWrite;
|
|
242
|
-
}
|
|
243
|
-
compareLocalProjectToDeployed() {
|
|
244
|
-
const deployedComponentNames = this.deployedBuild.subbuildStatuses.map(subbuildStatus => subbuildStatus.buildName);
|
|
245
|
-
const missingProjectNodes = [];
|
|
246
|
-
Object.values(this.projectNodes).forEach(node => {
|
|
247
|
-
if (!deployedComponentNames.includes(node.uid)) {
|
|
248
|
-
const userFriendlyName = (0, project_parsing_lib_1.mapToUserFriendlyName)(node.componentType);
|
|
249
|
-
const label = userFriendlyName ? `[${userFriendlyName}] ` : '';
|
|
250
|
-
missingProjectNodes.push(`${label}${node.uid}`);
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
if (missingProjectNodes.length) {
|
|
254
|
-
this.logUploadWarning(en_1.lib.LocalDevManager.uploadWarning.missingComponents(missingProjectNodes.join(', ')));
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
startWatching() {
|
|
258
|
-
this.watcher = chokidar_1.default.watch(this.projectDir, {
|
|
259
|
-
ignoreInitial: true,
|
|
260
|
-
});
|
|
261
|
-
const configPaths = Object.values(this.projectNodes).map(component => component.localDev.componentConfigPath);
|
|
262
|
-
const projectConfigPath = path_1.default.join(this.projectDir, constants_1.PROJECT_CONFIG_FILE);
|
|
263
|
-
configPaths.push(projectConfigPath);
|
|
264
|
-
this.watcher.on('add', filePath => {
|
|
265
|
-
this.handleWatchEvent(filePath, WATCH_EVENTS.add, configPaths);
|
|
266
|
-
});
|
|
267
|
-
this.watcher.on('change', filePath => {
|
|
268
|
-
this.handleWatchEvent(filePath, WATCH_EVENTS.change, configPaths);
|
|
269
|
-
});
|
|
270
|
-
this.watcher.on('unlink', filePath => {
|
|
271
|
-
this.handleWatchEvent(filePath, WATCH_EVENTS.unlink, configPaths);
|
|
272
|
-
});
|
|
273
|
-
this.watcher.on('unlinkDir', filePath => {
|
|
274
|
-
this.handleWatchEvent(filePath, WATCH_EVENTS.unlinkDir, configPaths);
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
async stopWatching() {
|
|
278
|
-
await this.watcher?.close();
|
|
279
|
-
}
|
|
280
|
-
handleWatchEvent(filePath, event, configPaths) {
|
|
281
|
-
if (configPaths.includes(filePath)) {
|
|
282
|
-
this.logUploadWarning();
|
|
283
|
-
}
|
|
284
|
-
else {
|
|
285
|
-
this.devServerFileChange(filePath, event);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
async devServerSetup() {
|
|
289
|
-
try {
|
|
290
|
-
await DevServerManagerV2_1.default.setup({
|
|
291
|
-
projectNodes: this.projectNodes,
|
|
292
|
-
accountId: this.targetTestingAccountId,
|
|
293
|
-
setActiveApp: this.setActiveApp.bind(this),
|
|
294
|
-
});
|
|
295
|
-
return true;
|
|
296
|
-
}
|
|
297
|
-
catch (e) {
|
|
298
|
-
if (this.debug) {
|
|
299
|
-
logger_1.logger.error(e);
|
|
300
|
-
}
|
|
301
|
-
logger_2.uiLogger.error(en_1.lib.LocalDevManager.devServer.setupError(e instanceof Error ? e.message : ''));
|
|
302
|
-
return false;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
async devServerStart() {
|
|
306
|
-
try {
|
|
307
|
-
await DevServerManagerV2_1.default.start({
|
|
308
|
-
accountId: this.targetTestingAccountId,
|
|
309
|
-
projectConfig: this.projectConfig,
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
catch (e) {
|
|
313
|
-
if (this.debug) {
|
|
314
|
-
logger_1.logger.error(e);
|
|
315
|
-
}
|
|
316
|
-
logger_2.uiLogger.error(en_1.lib.LocalDevManager.devServer.startError(e instanceof Error ? e.message : ''));
|
|
317
|
-
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
devServerFileChange(filePath, event) {
|
|
321
|
-
try {
|
|
322
|
-
DevServerManagerV2_1.default.fileChange({ filePath, event });
|
|
323
|
-
}
|
|
324
|
-
catch (e) {
|
|
325
|
-
if (this.debug) {
|
|
326
|
-
logger_1.logger.error(e);
|
|
327
|
-
}
|
|
328
|
-
logger_2.uiLogger.error(en_1.lib.LocalDevManager.devServer.fileChangeError(e instanceof Error ? e.message : ''));
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
async devServerCleanup() {
|
|
332
|
-
try {
|
|
333
|
-
await DevServerManagerV2_1.default.cleanup();
|
|
334
|
-
return true;
|
|
335
|
-
}
|
|
336
|
-
catch (e) {
|
|
337
|
-
if (this.debug) {
|
|
338
|
-
logger_1.logger.error(e);
|
|
339
|
-
}
|
|
340
|
-
logger_2.uiLogger.error(en_1.lib.LocalDevManager.devServer.cleanupError(e instanceof Error ? e.message : ''));
|
|
341
|
-
return false;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
exports.default = LocalDevManagerV2;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function installPublicAppPrompt(env: string, targetAccountId: number, clientId: string, scopes: string[], redirectUrls: string[], isReinstall?: boolean): Promise<void>;
|