@hubspot/cli 7.5.3-experimental.0 → 7.5.4-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/migrate.d.ts +12 -3
- package/api/migrate.js +9 -2
- package/bin/cli.js +100 -93
- package/commands/account/auth.d.ts +8 -0
- package/commands/account/auth.js +175 -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 +36 -5
- package/commands/account/list.d.ts +3 -7
- package/commands/account/list.js +38 -15
- package/commands/account/remove.d.ts +3 -7
- package/commands/account/remove.js +49 -9
- 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 +27 -6
- 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 +5 -7
- package/commands/auth.js +37 -33
- 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 -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 +56 -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 -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 -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 +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 +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/getStarted.d.ts +9 -0
- package/commands/getStarted.js +227 -0
- 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 +31 -24
- 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/mcp/setup.d.ts +7 -0
- package/commands/mcp/setup.js +50 -0
- package/commands/mcp/start.d.ts +3 -0
- package/commands/mcp/start.js +75 -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 -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 +5 -6
- package/commands/project/deploy.js +93 -37
- 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 -30
- 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 +94 -56
- package/commands/project/validate.d.ts +6 -0
- package/commands/project/validate.js +85 -0
- 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 +49 -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 +3217 -0
- package/lang/en.js +3074 -3313
- package/lang/en.lyaml +96 -228
- 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 +179 -88
- 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 +33 -0
- package/lib/constants.js +34 -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 +60 -46
- package/lib/errorHandlers/index.js +13 -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/mcp/setup.d.ts +21 -0
- package/lib/mcp/setup.js +215 -0
- 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 +37 -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 +7 -0
- package/lib/projectProfiles.js +83 -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 +46 -42
- 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 +30 -0
- package/lib/projects/localDev/AppDevModeInterface.js +215 -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 +17 -2
- package/lib/projects/upload.js +74 -50
- package/lib/projects/urls.d.ts +4 -0
- package/lib/projects/urls.js +23 -1
- 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 +43 -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 +2 -0
- package/lib/prompts/installAppPrompt.js +45 -0
- package/lib/prompts/personalAccessKeyPrompt.js +35 -25
- 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 +4 -2
- package/lib/prompts/promptUtils.js +3 -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/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/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/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 +26 -17
- 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 +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
package/lib/commonOpts.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { Argv, Arguments } from 'yargs';
|
|
2
2
|
import { CmsPublishMode } from '@hubspot/local-dev-lib/types/Files';
|
|
3
3
|
import { ConfigArgs } from '../types/Yargs';
|
|
4
|
-
export declare function addGlobalOptions(yargs: Argv): Argv<{
|
|
5
|
-
debug: boolean;
|
|
6
|
-
}>;
|
|
4
|
+
export declare function addGlobalOptions(yargs: Argv): Argv<{}>;
|
|
7
5
|
export declare function addAccountOptions(yargs: Argv): Argv;
|
|
8
6
|
export declare function addConfigOptions(yargs: Argv): Argv<ConfigArgs>;
|
|
9
7
|
export declare function addOverwriteOptions(yargs: Argv): Argv;
|
|
@@ -13,13 +11,12 @@ export declare function addCmsPublishModeOptions(yargs: Argv, { read, write }: {
|
|
|
13
11
|
}): Argv;
|
|
14
12
|
export declare function addTestingOptions(yargs: Argv): Argv;
|
|
15
13
|
export declare function addUseEnvironmentOptions(yargs: Argv): Argv;
|
|
16
|
-
export declare function addCustomHelpOutput(yargs: Argv, command: string, describe
|
|
14
|
+
export declare function addCustomHelpOutput(yargs: Argv, command: string | string[], describe?: string): Promise<void>;
|
|
17
15
|
export declare function setLogLevel(options: Arguments<{
|
|
18
16
|
debug?: boolean;
|
|
17
|
+
networkDebug?: boolean;
|
|
19
18
|
}>): void;
|
|
20
|
-
export declare function getCommandName(argv: Arguments
|
|
21
|
-
_?: string[];
|
|
22
|
-
}>): string;
|
|
19
|
+
export declare function getCommandName(argv: Arguments): string;
|
|
23
20
|
export declare function getCmsPublishMode(options: Arguments<{
|
|
24
21
|
cmsPublishMode?: CmsPublishMode;
|
|
25
22
|
derivedAccountId?: number;
|
package/lib/commonOpts.js
CHANGED
|
@@ -23,34 +23,39 @@ const lang_1 = require("./lang");
|
|
|
23
23
|
const errorHandlers_1 = require("./errorHandlers");
|
|
24
24
|
const exitCodes_1 = require("./enums/exitCodes");
|
|
25
25
|
const ui_1 = require("./ui");
|
|
26
|
-
const i18nKey = 'lib.commonOpts';
|
|
27
26
|
function addGlobalOptions(yargs) {
|
|
28
27
|
yargs.version(false);
|
|
29
|
-
|
|
28
|
+
yargs.option('debug', {
|
|
30
29
|
alias: 'd',
|
|
31
30
|
default: false,
|
|
32
|
-
describe: (0, lang_1.i18n)(
|
|
31
|
+
describe: (0, lang_1.i18n)(`lib.commonOpts.options.debug.describe`),
|
|
33
32
|
type: 'boolean',
|
|
34
33
|
});
|
|
34
|
+
yargs.option('network-debug', {
|
|
35
|
+
default: false,
|
|
36
|
+
type: 'boolean',
|
|
37
|
+
hidden: true,
|
|
38
|
+
});
|
|
39
|
+
return yargs;
|
|
35
40
|
}
|
|
36
41
|
function addAccountOptions(yargs) {
|
|
37
42
|
return yargs.option('account', {
|
|
38
43
|
alias: 'a',
|
|
39
|
-
describe: (0, lang_1.i18n)(
|
|
44
|
+
describe: (0, lang_1.i18n)(`lib.commonOpts.options.account.describe`),
|
|
40
45
|
type: 'string',
|
|
41
46
|
});
|
|
42
47
|
}
|
|
43
48
|
function addConfigOptions(yargs) {
|
|
44
49
|
return yargs.option('config', {
|
|
45
50
|
alias: 'c',
|
|
46
|
-
describe: (0, lang_1.i18n)(
|
|
51
|
+
describe: (0, lang_1.i18n)(`lib.commonOpts.options.config.describe`),
|
|
47
52
|
type: 'string',
|
|
48
53
|
});
|
|
49
54
|
}
|
|
50
55
|
function addOverwriteOptions(yargs) {
|
|
51
56
|
return yargs.option('overwrite', {
|
|
52
57
|
alias: 'o',
|
|
53
|
-
describe: (0, lang_1.i18n)(
|
|
58
|
+
describe: (0, lang_1.i18n)(`lib.commonOpts.options.overwrite.describe`),
|
|
54
59
|
type: 'boolean',
|
|
55
60
|
default: false,
|
|
56
61
|
});
|
|
@@ -59,39 +64,58 @@ function addCmsPublishModeOptions(yargs, { read, write }) {
|
|
|
59
64
|
const cmsPublishModes = `<${Object.values(files_1.CMS_PUBLISH_MODE).join(' | ')}>`;
|
|
60
65
|
return yargs.option('cms-publish-mode', {
|
|
61
66
|
alias: 'm',
|
|
62
|
-
describe: (0, lang_1.i18n)(
|
|
67
|
+
describe: (0, lang_1.i18n)(`lib.commonOpts.options.modes.describe.${read ? 'read' : write ? 'write' : 'default'}`, { modes: cmsPublishModes }),
|
|
63
68
|
type: 'string',
|
|
64
69
|
});
|
|
65
70
|
}
|
|
66
71
|
function addTestingOptions(yargs) {
|
|
67
72
|
return yargs.option('qa', {
|
|
68
|
-
describe: (0, lang_1.i18n)(
|
|
73
|
+
describe: (0, lang_1.i18n)(`lib.commonOpts.options.qa.describe`),
|
|
69
74
|
type: 'boolean',
|
|
70
75
|
default: false,
|
|
71
76
|
hidden: true,
|
|
72
77
|
});
|
|
73
78
|
}
|
|
74
79
|
function addUseEnvironmentOptions(yargs) {
|
|
75
|
-
|
|
76
|
-
.
|
|
77
|
-
describe: (0, lang_1.i18n)(`${i18nKey}.options.useEnv.describe`),
|
|
80
|
+
yargs.option('use-env', {
|
|
81
|
+
describe: (0, lang_1.i18n)(`lib.commonOpts.options.useEnv.describe`),
|
|
78
82
|
type: 'boolean',
|
|
79
|
-
})
|
|
80
|
-
|
|
83
|
+
});
|
|
84
|
+
yargs.conflicts('use-env', 'account');
|
|
85
|
+
return yargs;
|
|
81
86
|
}
|
|
82
87
|
async function addCustomHelpOutput(yargs, command, describe) {
|
|
83
88
|
try {
|
|
84
89
|
const parsedArgv = (0, yargs_parser_1.default)(process.argv.slice(2));
|
|
85
90
|
if (parsedArgv && parsedArgv.help) {
|
|
86
|
-
// Construct the full command, including positional arguments
|
|
87
91
|
const commandBase = `hs ${parsedArgv._.slice(0, -1).join(' ')}`;
|
|
88
|
-
|
|
92
|
+
// Make sure we are targeting the correct command by confirming that
|
|
93
|
+
// "command" matches the last part of the user's input command
|
|
94
|
+
const checkIsTargetCommand = (command) => {
|
|
95
|
+
const targetBaseCommand = command.split(' ')[0];
|
|
96
|
+
return targetBaseCommand === parsedArgv._[parsedArgv._.length - 1];
|
|
97
|
+
};
|
|
98
|
+
const isTargetedCommand = Array.isArray(command)
|
|
99
|
+
? command.some(checkIsTargetCommand)
|
|
100
|
+
: checkIsTargetCommand(command);
|
|
101
|
+
if (!isTargetedCommand) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
// Construct the full command, including positional arguments
|
|
105
|
+
const commandString = Array.isArray(command) ? command[0] : command;
|
|
106
|
+
const fullCommand = `${commandBase.trim()} ${commandString}`;
|
|
89
107
|
// Format the original help output to be more readable
|
|
90
108
|
let commandHelp = await yargs.getHelp();
|
|
91
|
-
['Options:', 'Examples:', 'Positionals:'].forEach(header => {
|
|
109
|
+
['Options:', 'Commands:', 'Examples:', 'Positionals:'].forEach(header => {
|
|
92
110
|
commandHelp = commandHelp.replace(header, chalk_1.default.bold(header));
|
|
93
111
|
});
|
|
94
|
-
|
|
112
|
+
// Remove "hs <command>" from the help output (this shows up for command buckets)
|
|
113
|
+
commandHelp = commandHelp.replace('hs <command>\n', '');
|
|
114
|
+
// Remove the first line of the help output if it's empty
|
|
115
|
+
if (commandHelp.startsWith('\n')) {
|
|
116
|
+
commandHelp = commandHelp.slice(1);
|
|
117
|
+
}
|
|
118
|
+
logger_1.logger.log(`${(0, ui_1.uiCommandReference)(fullCommand, false)}\n\n${describe ? `${describe}\n\n` : ''}${commandHelp}`);
|
|
95
119
|
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
96
120
|
}
|
|
97
121
|
}
|
|
@@ -101,16 +125,20 @@ async function addCustomHelpOutput(yargs, command, describe) {
|
|
|
101
125
|
}
|
|
102
126
|
}
|
|
103
127
|
function setLogLevel(options) {
|
|
104
|
-
const { debug } = options;
|
|
128
|
+
const { debug, networkDebug } = options;
|
|
105
129
|
if (debug) {
|
|
106
130
|
(0, logger_1.setLogLevel)(logger_1.LOG_LEVEL.DEBUG);
|
|
107
131
|
}
|
|
108
132
|
else {
|
|
109
133
|
(0, logger_1.setLogLevel)(logger_1.LOG_LEVEL.LOG);
|
|
110
134
|
}
|
|
135
|
+
if (networkDebug) {
|
|
136
|
+
process.env.HUBSPOT_NETWORK_LOGGING = 'true';
|
|
137
|
+
(0, logger_1.setLogLevel)(logger_1.LOG_LEVEL.DEBUG);
|
|
138
|
+
}
|
|
111
139
|
}
|
|
112
140
|
function getCommandName(argv) {
|
|
113
|
-
return (argv && argv._ && argv._[0]) || '';
|
|
141
|
+
return String(argv && argv._ && argv._[0]) || '';
|
|
114
142
|
}
|
|
115
143
|
function getCmsPublishMode(options) {
|
|
116
144
|
// 1. --cmsPublishMode
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleMigration = handleMigration;
|
|
4
|
+
exports.handleMerge = handleMerge;
|
|
5
|
+
const migrate_1 = require("@hubspot/local-dev-lib/config/migrate");
|
|
6
|
+
const config_1 = require("@hubspot/local-dev-lib/constants/config");
|
|
7
|
+
const promptUtils_1 = require("./prompts/promptUtils");
|
|
8
|
+
const en_1 = require("../lang/en");
|
|
9
|
+
const logger_1 = require("./ui/logger");
|
|
10
|
+
async function handleMigration(deprecatedConfigPath, hideWarning) {
|
|
11
|
+
if (!hideWarning) {
|
|
12
|
+
logger_1.uiLogger.warn(en_1.lib.configMigrate.deprecatedConfigWarning(deprecatedConfigPath || (0, migrate_1.getConfigPath)(undefined, false)));
|
|
13
|
+
logger_1.uiLogger.log('');
|
|
14
|
+
}
|
|
15
|
+
logger_1.uiLogger.log(en_1.lib.configMigrate.handleMigration.description(config_1.ARCHIVED_HUBSPOT_CONFIG_YAML_FILE_NAME));
|
|
16
|
+
logger_1.uiLogger.log('');
|
|
17
|
+
const { shouldMigrateConfig } = await (0, promptUtils_1.promptUser)({
|
|
18
|
+
name: 'shouldMigrateConfig',
|
|
19
|
+
type: 'confirm',
|
|
20
|
+
message: en_1.lib.configMigrate.handleMigration.confirmPrompt,
|
|
21
|
+
});
|
|
22
|
+
if (!shouldMigrateConfig) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
const deprecatedConfig = (0, migrate_1.getDeprecatedConfig)(deprecatedConfigPath);
|
|
26
|
+
(0, migrate_1.migrateConfig)(deprecatedConfig);
|
|
27
|
+
logger_1.uiLogger.success(en_1.lib.configMigrate.handleMigration.success);
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
async function handleMergeConfigProperties(globalConfig, deprecatedConfig, force) {
|
|
31
|
+
const { initialConfig, conflicts, } = (0, migrate_1.mergeConfigProperties)(globalConfig, deprecatedConfig, force);
|
|
32
|
+
if (conflicts.length > 0) {
|
|
33
|
+
const properties = conflicts.map(c => c.property);
|
|
34
|
+
const propertyList = properties.length <= 2
|
|
35
|
+
? properties.join(' and ')
|
|
36
|
+
: `${properties.slice(0, -1).join(', ')}, and ${properties.at(-1)}`;
|
|
37
|
+
logger_1.uiLogger.log('');
|
|
38
|
+
logger_1.uiLogger.warn(en_1.lib.configMigrate.handleMergeConfigProperties.mergeConflictMessage(conflicts.length, propertyList));
|
|
39
|
+
for (const conflict of conflicts) {
|
|
40
|
+
const { property, newValue, oldValue } = conflict;
|
|
41
|
+
const { shouldOverwrite } = await (0, promptUtils_1.promptUser)({
|
|
42
|
+
name: 'shouldOverwrite',
|
|
43
|
+
type: 'confirm',
|
|
44
|
+
message: en_1.lib.configMigrate.handleMergeConfigProperties.mergeConfigConflictPrompt(property, newValue.toString(), oldValue.toString()),
|
|
45
|
+
});
|
|
46
|
+
if (shouldOverwrite) {
|
|
47
|
+
// @ts-expect-error Cannot reconcile CLIConfig_NEW and CLIConfig_DEPRECATED
|
|
48
|
+
initialConfig[property] = oldValue;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return initialConfig;
|
|
53
|
+
}
|
|
54
|
+
async function handleMerge(deprecatedConfigPath, force, hideWarning) {
|
|
55
|
+
if (!hideWarning) {
|
|
56
|
+
logger_1.uiLogger.warn(en_1.lib.configMigrate.deprecatedConfigWarning(deprecatedConfigPath || (0, migrate_1.getConfigPath)(undefined, false)));
|
|
57
|
+
logger_1.uiLogger.log('');
|
|
58
|
+
}
|
|
59
|
+
logger_1.uiLogger.log(en_1.lib.configMigrate.handleMerge.description(config_1.ARCHIVED_HUBSPOT_CONFIG_YAML_FILE_NAME));
|
|
60
|
+
logger_1.uiLogger.log('');
|
|
61
|
+
const { shouldMergeConfigs } = await (0, promptUtils_1.promptUser)({
|
|
62
|
+
name: 'shouldMergeConfigs',
|
|
63
|
+
type: 'confirm',
|
|
64
|
+
message: en_1.lib.configMigrate.handleMerge.confirmPrompt,
|
|
65
|
+
});
|
|
66
|
+
if (!shouldMergeConfigs) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
const deprecatedConfig = (0, migrate_1.getDeprecatedConfig)(deprecatedConfigPath);
|
|
70
|
+
const globalConfig = (0, migrate_1.getGlobalConfig)();
|
|
71
|
+
if (!deprecatedConfig || !globalConfig) {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
const mergedConfig = await handleMergeConfigProperties(globalConfig, deprecatedConfig, force);
|
|
75
|
+
const { skippedAccountIds } = (0, migrate_1.mergeExistingConfigs)(mergedConfig, deprecatedConfig);
|
|
76
|
+
if (skippedAccountIds.length > 0) {
|
|
77
|
+
logger_1.uiLogger.log('');
|
|
78
|
+
logger_1.uiLogger.log(en_1.lib.configMigrate.handleMerge.skippedExistingAccounts(skippedAccountIds));
|
|
79
|
+
logger_1.uiLogger.log('');
|
|
80
|
+
}
|
|
81
|
+
logger_1.uiLogger.success(en_1.lib.configMigrate.handleMerge.success);
|
|
82
|
+
return true;
|
|
83
|
+
}
|
package/lib/configOptions.d.ts
CHANGED
|
@@ -3,6 +3,10 @@ export declare function setAllowUsageTracking({ accountId, allowUsageTracking, }
|
|
|
3
3
|
accountId: number;
|
|
4
4
|
allowUsageTracking?: boolean;
|
|
5
5
|
}): Promise<void>;
|
|
6
|
+
export declare function setAllowAutoUpdates({ accountId, allowAutoUpdates, }: {
|
|
7
|
+
accountId: number;
|
|
8
|
+
allowAutoUpdates?: boolean;
|
|
9
|
+
}): Promise<void>;
|
|
6
10
|
export declare function setDefaultCmsPublishMode({ accountId, defaultCmsPublishMode, }: {
|
|
7
11
|
accountId: number;
|
|
8
12
|
defaultCmsPublishMode?: CmsPublishMode;
|
package/lib/configOptions.js
CHANGED
|
@@ -1,36 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setAllowUsageTracking = setAllowUsageTracking;
|
|
4
|
+
exports.setAllowAutoUpdates = setAllowAutoUpdates;
|
|
4
5
|
exports.setDefaultCmsPublishMode = setDefaultCmsPublishMode;
|
|
5
6
|
exports.setHttpTimeout = setHttpTimeout;
|
|
6
|
-
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
7
7
|
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
8
8
|
const files_1 = require("@hubspot/local-dev-lib/constants/files");
|
|
9
9
|
const text_1 = require("@hubspot/local-dev-lib/text");
|
|
10
10
|
const usageTracking_1 = require("./usageTracking");
|
|
11
11
|
const promptUtils_1 = require("./prompts/promptUtils");
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
async function
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
],
|
|
31
|
-
default: true,
|
|
32
|
-
},
|
|
33
|
-
]);
|
|
12
|
+
const en_1 = require("../lang/en");
|
|
13
|
+
const logger_1 = require("./ui/logger");
|
|
14
|
+
async function enableOrDisableBooleanFieldPrompt(fieldName) {
|
|
15
|
+
const isEnabled = await (0, promptUtils_1.listPrompt)(en_1.lib.configOptions.enableOrDisableBooleanFieldPrompt.message(fieldName), {
|
|
16
|
+
choices: [
|
|
17
|
+
{
|
|
18
|
+
name: en_1.lib.configOptions.enableOrDisableBooleanFieldPrompt.labels
|
|
19
|
+
.enabled,
|
|
20
|
+
value: true,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: en_1.lib.configOptions.enableOrDisableBooleanFieldPrompt.labels
|
|
24
|
+
.disabled,
|
|
25
|
+
value: false,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
defaultAnswer: true,
|
|
29
|
+
});
|
|
34
30
|
return isEnabled;
|
|
35
31
|
}
|
|
36
32
|
async function setAllowUsageTracking({ accountId, allowUsageTracking, }) {
|
|
@@ -40,25 +36,29 @@ async function setAllowUsageTracking({ accountId, allowUsageTracking, }) {
|
|
|
40
36
|
isEnabled = allowUsageTracking;
|
|
41
37
|
}
|
|
42
38
|
else {
|
|
43
|
-
isEnabled = await
|
|
39
|
+
isEnabled = await enableOrDisableBooleanFieldPrompt(en_1.lib.configOptions.setAllowUsageTracking.fieldName);
|
|
44
40
|
}
|
|
45
41
|
(0, config_1.updateAllowUsageTracking)(isEnabled);
|
|
46
|
-
logger_1.
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
logger_1.uiLogger.success(en_1.lib.configOptions.setAllowUsageTracking.success(isEnabled.toString()));
|
|
43
|
+
}
|
|
44
|
+
async function setAllowAutoUpdates({ accountId, allowAutoUpdates, }) {
|
|
45
|
+
(0, usageTracking_1.trackCommandUsage)('config-set-allow-auto-updates', undefined, accountId);
|
|
46
|
+
let isEnabled;
|
|
47
|
+
if (typeof allowAutoUpdates === 'boolean') {
|
|
48
|
+
isEnabled = allowAutoUpdates;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
isEnabled = await enableOrDisableBooleanFieldPrompt(en_1.lib.configOptions.setAllowAutoUpdates.fieldName);
|
|
52
|
+
}
|
|
53
|
+
(0, config_1.updateAllowAutoUpdates)(isEnabled);
|
|
54
|
+
logger_1.uiLogger.success(en_1.lib.configOptions.setAllowAutoUpdates.success(isEnabled.toString()));
|
|
49
55
|
}
|
|
50
56
|
const ALL_CMS_PUBLISH_MODES = Object.values(files_1.CMS_PUBLISH_MODE);
|
|
51
57
|
async function selectCmsPublishMode() {
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
pageSize: 20,
|
|
57
|
-
message: (0, lang_1.i18n)(`${i18nKey}.defaultMode.promptMessage`),
|
|
58
|
-
choices: ALL_CMS_PUBLISH_MODES,
|
|
59
|
-
default: files_1.CMS_PUBLISH_MODE.publish,
|
|
60
|
-
},
|
|
61
|
-
]);
|
|
58
|
+
const cmsPublishMode = await (0, promptUtils_1.listPrompt)(en_1.lib.configOptions.setDefaultCmsPublishMode.promptMessage, {
|
|
59
|
+
choices: ALL_CMS_PUBLISH_MODES,
|
|
60
|
+
defaultAnswer: files_1.CMS_PUBLISH_MODE.publish,
|
|
61
|
+
});
|
|
62
62
|
return cmsPublishMode;
|
|
63
63
|
}
|
|
64
64
|
async function setDefaultCmsPublishMode({ accountId, defaultCmsPublishMode, }) {
|
|
@@ -72,21 +72,17 @@ async function setDefaultCmsPublishMode({ accountId, defaultCmsPublishMode, }) {
|
|
|
72
72
|
newDefault = defaultCmsPublishMode;
|
|
73
73
|
}
|
|
74
74
|
else {
|
|
75
|
-
logger_1.
|
|
76
|
-
validModes: (0, text_1.commaSeparatedValues)(ALL_CMS_PUBLISH_MODES),
|
|
77
|
-
}));
|
|
75
|
+
logger_1.uiLogger.error(en_1.lib.configOptions.setDefaultCmsPublishMode.error((0, text_1.commaSeparatedValues)(ALL_CMS_PUBLISH_MODES)));
|
|
78
76
|
newDefault = await selectCmsPublishMode();
|
|
79
77
|
}
|
|
80
78
|
(0, config_1.updateDefaultCmsPublishMode)(newDefault);
|
|
81
|
-
logger_1.
|
|
82
|
-
mode: newDefault,
|
|
83
|
-
}));
|
|
79
|
+
logger_1.uiLogger.success(en_1.lib.configOptions.setDefaultCmsPublishMode.success(newDefault));
|
|
84
80
|
}
|
|
85
81
|
async function enterTimeout() {
|
|
86
82
|
const { timeout } = await (0, promptUtils_1.promptUser)([
|
|
87
83
|
{
|
|
88
84
|
name: 'timeout',
|
|
89
|
-
message:
|
|
85
|
+
message: en_1.lib.configOptions.setHttpTimeout.promptMessage,
|
|
90
86
|
type: 'input',
|
|
91
87
|
default: 30000,
|
|
92
88
|
},
|
|
@@ -103,5 +99,5 @@ async function setHttpTimeout({ accountId, httpTimeout, }) {
|
|
|
103
99
|
newHttpTimeout = httpTimeout;
|
|
104
100
|
}
|
|
105
101
|
(0, config_1.updateHttpTimeout)(newHttpTimeout);
|
|
106
|
-
logger_1.
|
|
102
|
+
logger_1.uiLogger.success(en_1.lib.configOptions.setHttpTimeout.success(newHttpTimeout));
|
|
107
103
|
}
|
package/lib/constants.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ export declare const PROJECT_ERROR_TYPES: {
|
|
|
49
49
|
readonly BUILD_NOT_IN_PROGRESS: "BuildPipelineErrorType.BUILD_NOT_IN_PROGRESS";
|
|
50
50
|
readonly SUBBUILD_FAILED: "BuildPipelineErrorType.DEPENDENT_SUBBUILD_FAILED";
|
|
51
51
|
readonly SUBDEPLOY_FAILED: "DeployPipelineErrorType.DEPENDENT_SUBDEPLOY_FAILED";
|
|
52
|
+
readonly DEPLOY_CONTAINS_REMOVALS: "DeployPipelineErrorType.WARNING_DEPLOY_CONTAINS_REMOVALS";
|
|
52
53
|
};
|
|
53
54
|
export declare const PROJECT_TASK_TYPES: {
|
|
54
55
|
[key: string]: string;
|
|
@@ -74,3 +75,35 @@ export declare const APP_AUTH_TYPES: {
|
|
|
74
75
|
readonly OAUTH: "oauth";
|
|
75
76
|
readonly STATIC: "static";
|
|
76
77
|
};
|
|
78
|
+
export declare const FEATURES: {
|
|
79
|
+
readonly UNIFIED_THEME_PREVIEW: "cms:react:unifiedThemePreview";
|
|
80
|
+
readonly UNIFIED_APPS: "Developers:UnifiedApps:PrivateBeta";
|
|
81
|
+
};
|
|
82
|
+
export declare const LOCAL_DEV_UI_MESSAGE_SEND_TYPES: {
|
|
83
|
+
UPLOAD_SUCCESS: string;
|
|
84
|
+
UPLOAD_FAILURE: string;
|
|
85
|
+
UPDATE_PROJECT_NODES: string;
|
|
86
|
+
UPDATE_APP_DATA: string;
|
|
87
|
+
UPDATE_PROJECT_DATA: string;
|
|
88
|
+
};
|
|
89
|
+
export declare const LOCAL_DEV_UI_MESSAGE_RECEIVE_TYPES: {
|
|
90
|
+
UPLOAD: string;
|
|
91
|
+
};
|
|
92
|
+
export declare const APP_INSTALLATION_STATES: {
|
|
93
|
+
readonly NOT_INSTALLED: "NOT_INSTALLED";
|
|
94
|
+
readonly INSTALLED: "INSTALLED";
|
|
95
|
+
readonly INSTALLED_WITH_OUTDATED_SCOPES: "INSTALLED_WITH_OUTDATED_SCOPES";
|
|
96
|
+
};
|
|
97
|
+
export declare const staticAuth = "static";
|
|
98
|
+
export declare const oAuth = "oauth";
|
|
99
|
+
export declare const privateDistribution = "private";
|
|
100
|
+
export declare const marketplaceDistribution = "marketplace";
|
|
101
|
+
export declare const appComponent = "app";
|
|
102
|
+
export declare const GET_STARTED_OPTIONS: {
|
|
103
|
+
readonly APP: "APP";
|
|
104
|
+
readonly CMS: "CMS";
|
|
105
|
+
};
|
|
106
|
+
export declare const LOCAL_DEV_SERVER_MESSAGE_TYPES: {
|
|
107
|
+
readonly INITIAL: "INITIAL";
|
|
108
|
+
readonly WEBSOCKET_SERVER_CONNECTED: "WEBSOCKET_SERVER_CONNECTED";
|
|
109
|
+
};
|
package/lib/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.APP_AUTH_TYPES = exports.APP_DISTRIBUTION_TYPES = exports.IR_COMPONENT_TYPES = exports.PLATFORM_VERSION_ERROR_TYPES = exports.PROJECT_COMPONENT_TYPES = exports.PROJECT_TASK_TYPES = exports.PROJECT_ERROR_TYPES = exports.PROJECT_DEPLOY_TEXT = exports.PROJECT_BUILD_TEXT = exports.PROJECT_DEPLOY_STATES = exports.PROJECT_BUILD_STATES = exports.PROJECT_CONFIG_FILE = exports.DEFAULT_POLLING_DELAY = exports.MARKETPLACE_FOLDER = exports.HUBSPOT_FOLDER = exports.FEEDBACK_INTERVAL = exports.DEFAULT_PROJECT_TEMPLATE_BRANCH = exports.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH = void 0;
|
|
3
|
+
exports.LOCAL_DEV_SERVER_MESSAGE_TYPES = exports.GET_STARTED_OPTIONS = exports.appComponent = exports.marketplaceDistribution = exports.privateDistribution = exports.oAuth = exports.staticAuth = exports.APP_INSTALLATION_STATES = exports.LOCAL_DEV_UI_MESSAGE_RECEIVE_TYPES = exports.LOCAL_DEV_UI_MESSAGE_SEND_TYPES = exports.FEATURES = exports.APP_AUTH_TYPES = exports.APP_DISTRIBUTION_TYPES = exports.IR_COMPONENT_TYPES = exports.PLATFORM_VERSION_ERROR_TYPES = exports.PROJECT_COMPONENT_TYPES = exports.PROJECT_TASK_TYPES = exports.PROJECT_ERROR_TYPES = exports.PROJECT_DEPLOY_TEXT = exports.PROJECT_BUILD_TEXT = exports.PROJECT_DEPLOY_STATES = exports.PROJECT_BUILD_STATES = exports.PROJECT_CONFIG_FILE = exports.DEFAULT_POLLING_DELAY = exports.MARKETPLACE_FOLDER = exports.HUBSPOT_FOLDER = exports.FEEDBACK_INTERVAL = exports.DEFAULT_PROJECT_TEMPLATE_BRANCH = exports.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH = void 0;
|
|
4
4
|
exports.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH = 'HubSpot/hubspot-project-components';
|
|
5
5
|
exports.DEFAULT_PROJECT_TEMPLATE_BRANCH = 'main';
|
|
6
6
|
exports.FEEDBACK_INTERVAL = 10;
|
|
@@ -41,6 +41,7 @@ exports.PROJECT_ERROR_TYPES = {
|
|
|
41
41
|
BUILD_NOT_IN_PROGRESS: 'BuildPipelineErrorType.BUILD_NOT_IN_PROGRESS',
|
|
42
42
|
SUBBUILD_FAILED: 'BuildPipelineErrorType.DEPENDENT_SUBBUILD_FAILED',
|
|
43
43
|
SUBDEPLOY_FAILED: 'DeployPipelineErrorType.DEPENDENT_SUBDEPLOY_FAILED',
|
|
44
|
+
DEPLOY_CONTAINS_REMOVALS: 'DeployPipelineErrorType.WARNING_DEPLOY_CONTAINS_REMOVALS',
|
|
44
45
|
};
|
|
45
46
|
exports.PROJECT_TASK_TYPES = {
|
|
46
47
|
PRIVATE_APP: 'private app',
|
|
@@ -69,3 +70,35 @@ exports.APP_AUTH_TYPES = {
|
|
|
69
70
|
OAUTH: 'oauth',
|
|
70
71
|
STATIC: 'static',
|
|
71
72
|
};
|
|
73
|
+
exports.FEATURES = {
|
|
74
|
+
UNIFIED_THEME_PREVIEW: 'cms:react:unifiedThemePreview',
|
|
75
|
+
UNIFIED_APPS: 'Developers:UnifiedApps:PrivateBeta',
|
|
76
|
+
};
|
|
77
|
+
exports.LOCAL_DEV_UI_MESSAGE_SEND_TYPES = {
|
|
78
|
+
UPLOAD_SUCCESS: 'server:uploadSuccess',
|
|
79
|
+
UPLOAD_FAILURE: 'server:uploadFailure',
|
|
80
|
+
UPDATE_PROJECT_NODES: 'server:updateProjectNodes',
|
|
81
|
+
UPDATE_APP_DATA: 'server:updateAppData',
|
|
82
|
+
UPDATE_PROJECT_DATA: 'server:updateProjectData',
|
|
83
|
+
};
|
|
84
|
+
exports.LOCAL_DEV_UI_MESSAGE_RECEIVE_TYPES = {
|
|
85
|
+
UPLOAD: 'client:upload',
|
|
86
|
+
};
|
|
87
|
+
exports.APP_INSTALLATION_STATES = {
|
|
88
|
+
NOT_INSTALLED: 'NOT_INSTALLED',
|
|
89
|
+
INSTALLED: 'INSTALLED',
|
|
90
|
+
INSTALLED_WITH_OUTDATED_SCOPES: 'INSTALLED_WITH_OUTDATED_SCOPES',
|
|
91
|
+
};
|
|
92
|
+
exports.staticAuth = 'static';
|
|
93
|
+
exports.oAuth = 'oauth';
|
|
94
|
+
exports.privateDistribution = 'private';
|
|
95
|
+
exports.marketplaceDistribution = 'marketplace';
|
|
96
|
+
exports.appComponent = 'app';
|
|
97
|
+
exports.GET_STARTED_OPTIONS = {
|
|
98
|
+
APP: 'APP',
|
|
99
|
+
CMS: 'CMS',
|
|
100
|
+
};
|
|
101
|
+
exports.LOCAL_DEV_SERVER_MESSAGE_TYPES = {
|
|
102
|
+
INITIAL: 'INITIAL',
|
|
103
|
+
WEBSOCKET_SERVER_CONNECTED: 'WEBSOCKET_SERVER_CONNECTED',
|
|
104
|
+
};
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
export declare function isGloballyInstalled(command: string): Promise<boolean>;
|
|
2
|
-
export declare function getLatestCliVersion(): Promise<{
|
|
3
|
-
latest: string;
|
|
4
|
-
next: string;
|
|
5
|
-
}>;
|
|
6
1
|
export declare function installPackages({ packages, installLocations, }: {
|
|
7
2
|
packages?: string[];
|
|
8
3
|
installLocations?: string[];
|
|
@@ -3,23 +3,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.isGloballyInstalled = isGloballyInstalled;
|
|
7
|
-
exports.getLatestCliVersion = getLatestCliVersion;
|
|
8
6
|
exports.installPackages = installPackages;
|
|
9
7
|
exports.getProjectPackageJsonLocations = getProjectPackageJsonLocations;
|
|
10
8
|
exports.hasMissingPackages = hasMissingPackages;
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const child_process_1 = require("child_process");
|
|
14
|
-
const fs_1 = require("@hubspot/local-dev-lib/fs");
|
|
9
|
+
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
const util_1 = __importDefault(require("util"));
|
|
15
11
|
const path_1 = __importDefault(require("path"));
|
|
12
|
+
const child_process_1 = require("child_process");
|
|
13
|
+
const fs_2 = require("@hubspot/local-dev-lib/fs");
|
|
14
|
+
const config_1 = require("./projects/config");
|
|
16
15
|
const ui_1 = require("./ui");
|
|
17
|
-
const util_1 = __importDefault(require("util"));
|
|
18
16
|
const lang_1 = require("./lang");
|
|
19
17
|
const SpinniesManager_1 = __importDefault(require("./ui/SpinniesManager"));
|
|
20
|
-
const
|
|
21
|
-
const package_json_1 = __importDefault(require("../package.json"));
|
|
22
|
-
const DEFAULT_PACKAGE_MANAGER = 'npm';
|
|
18
|
+
const npm_1 = require("./npm");
|
|
23
19
|
class NoPackageJsonFilesError extends Error {
|
|
24
20
|
constructor(projectName) {
|
|
25
21
|
super((0, lang_1.i18n)(`commands.project.subcommands.installDeps.noPackageJsonInProject`, {
|
|
@@ -28,22 +24,6 @@ class NoPackageJsonFilesError extends Error {
|
|
|
28
24
|
}));
|
|
29
25
|
}
|
|
30
26
|
}
|
|
31
|
-
async function isGloballyInstalled(command) {
|
|
32
|
-
const exec = util_1.default.promisify(child_process_1.exec);
|
|
33
|
-
try {
|
|
34
|
-
await exec(`${command} --version`);
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
catch (e) {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
async function getLatestCliVersion() {
|
|
42
|
-
const exec = util_1.default.promisify(child_process_1.exec);
|
|
43
|
-
const { stdout } = await exec(`npm info ${package_json_1.default.name} dist-tags --json`);
|
|
44
|
-
const { latest, next } = JSON.parse(stdout);
|
|
45
|
-
return { latest, next };
|
|
46
|
-
}
|
|
47
27
|
async function installPackages({ packages, installLocations, }) {
|
|
48
28
|
const installDirs = installLocations || (await getProjectPackageJsonLocations());
|
|
49
29
|
await Promise.all(installDirs.map(async (dir) => {
|
|
@@ -64,14 +44,8 @@ async function installPackagesInDirectory(directory, packages) {
|
|
|
64
44
|
directory: relativeDir,
|
|
65
45
|
}),
|
|
66
46
|
});
|
|
67
|
-
let installCommand = `${DEFAULT_PACKAGE_MANAGER} install`;
|
|
68
|
-
if (packages) {
|
|
69
|
-
installCommand = `${installCommand} ${packages.join(' ')}`;
|
|
70
|
-
}
|
|
71
|
-
logger_1.logger.debug(`Running ${installCommand}`);
|
|
72
47
|
try {
|
|
73
|
-
|
|
74
|
-
await exec(installCommand, { cwd: directory });
|
|
48
|
+
await (0, npm_1.executeInstall)(packages, null, { cwd: directory });
|
|
75
49
|
SpinniesManager_1.default.succeed(spinner, {
|
|
76
50
|
text: (0, lang_1.i18n)(`commands.project.subcommands.installDeps.installationSuccessful`, {
|
|
77
51
|
directory: relativeDir,
|
|
@@ -92,24 +66,24 @@ async function installPackagesInDirectory(directory, packages) {
|
|
|
92
66
|
}
|
|
93
67
|
}
|
|
94
68
|
async function getProjectPackageJsonLocations() {
|
|
95
|
-
const projectConfig = await (0,
|
|
69
|
+
const projectConfig = await (0, config_1.getProjectConfig)();
|
|
96
70
|
if (!projectConfig ||
|
|
97
71
|
!projectConfig.projectDir ||
|
|
98
72
|
!projectConfig.projectConfig) {
|
|
99
73
|
throw new Error((0, lang_1.i18n)(`commands.project.subcommands.installDeps.noProjectConfig`));
|
|
100
74
|
}
|
|
101
75
|
const { projectDir, projectConfig: { srcDir, name }, } = projectConfig;
|
|
102
|
-
if (!(await isGloballyInstalled(DEFAULT_PACKAGE_MANAGER))) {
|
|
76
|
+
if (!(await (0, npm_1.isGloballyInstalled)(npm_1.DEFAULT_PACKAGE_MANAGER))) {
|
|
103
77
|
throw new Error((0, lang_1.i18n)(`commands.project.subcommands.installDeps.packageManagerNotInstalled`, {
|
|
104
|
-
packageManager: DEFAULT_PACKAGE_MANAGER,
|
|
105
|
-
link: (0, ui_1.uiLink)(DEFAULT_PACKAGE_MANAGER, 'https://docs.npmjs.com/downloading-and-installing-node-js-and-npm'),
|
|
78
|
+
packageManager: npm_1.DEFAULT_PACKAGE_MANAGER,
|
|
79
|
+
link: (0, ui_1.uiLink)(npm_1.DEFAULT_PACKAGE_MANAGER, 'https://docs.npmjs.com/downloading-and-installing-node-js-and-npm'),
|
|
106
80
|
}));
|
|
107
81
|
}
|
|
108
|
-
if (!
|
|
109
|
-
!
|
|
82
|
+
if (!fs_1.default.existsSync(projectConfig.projectDir) ||
|
|
83
|
+
!fs_1.default.existsSync(path_1.default.join(projectDir, srcDir))) {
|
|
110
84
|
throw new NoPackageJsonFilesError(name);
|
|
111
85
|
}
|
|
112
|
-
const packageJsonFiles = (await (0,
|
|
86
|
+
const packageJsonFiles = (await (0, fs_2.walk)(path_1.default.join(projectDir, srcDir))).filter(file => file.includes('package.json') &&
|
|
113
87
|
!file.includes('node_modules') &&
|
|
114
88
|
!file.includes('.vite'));
|
|
115
89
|
if (packageJsonFiles.length === 0) {
|
|
@@ -11,16 +11,15 @@ interface Section {
|
|
|
11
11
|
export declare class Diagnosis {
|
|
12
12
|
private readonly prefixes;
|
|
13
13
|
private readonly diagnosis;
|
|
14
|
-
private readonly indentation;
|
|
15
14
|
private errorCount;
|
|
16
15
|
private warningCount;
|
|
17
16
|
constructor({ diagnosticInfo, accountId }: DiagnosisOptions);
|
|
18
|
-
private indent;
|
|
19
17
|
getErrorCount(): number;
|
|
20
18
|
getWarningCount(): number;
|
|
21
19
|
addCliSection(section: Section): void;
|
|
22
20
|
addProjectSection(section: Section): void;
|
|
23
21
|
addCLIConfigSection(section: Section): void;
|
|
22
|
+
addDefaultAccountOverrideFileSection(section: Section): void;
|
|
24
23
|
toString(): string;
|
|
25
24
|
private generateSections;
|
|
26
25
|
}
|