@hubspot/cli 7.7.21-experimental.0 → 7.7.21-experimental.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/__tests__/migrate.test.js +29 -27
- package/api/migrate.js +22 -14
- package/bin/cli.js +101 -92
- package/bin/hs +2 -2
- package/bin/hscms +2 -2
- package/bin/silenceErrors.js +2 -1
- package/commands/__tests__/account.test.js +34 -29
- package/commands/__tests__/auth.test.js +16 -11
- package/commands/__tests__/cms.test.js +20 -15
- package/commands/__tests__/config.test.js +19 -14
- package/commands/__tests__/create.test.js +15 -10
- package/commands/__tests__/customObject.test.js +19 -14
- package/commands/__tests__/doctor.test.js +48 -43
- package/commands/__tests__/feedback.test.js +45 -7
- package/commands/__tests__/fetch.test.js +28 -29
- package/commands/__tests__/filemanager.test.js +19 -14
- package/commands/__tests__/function.test.js +21 -16
- package/commands/__tests__/getStarted.test.js +50 -55
- package/commands/__tests__/hubdb.test.js +22 -17
- package/commands/__tests__/init.test.js +17 -12
- package/commands/__tests__/lint.test.js +18 -13
- package/commands/__tests__/list.test.js +23 -18
- package/commands/__tests__/logs.test.js +27 -28
- package/commands/__tests__/mcp.test.js +19 -14
- package/commands/__tests__/mv.test.js +52 -14
- package/commands/__tests__/open.test.js +51 -13
- package/commands/__tests__/project.test.js +49 -44
- package/commands/__tests__/remove.test.js +51 -13
- package/commands/__tests__/sandbox.test.js +19 -14
- package/commands/__tests__/secret.test.js +21 -16
- package/commands/__tests__/testAccount.test.js +21 -16
- package/commands/__tests__/theme.test.js +20 -15
- package/commands/account/__tests__/auth.test.js +16 -11
- package/commands/account/__tests__/clean.test.js +17 -12
- package/commands/account/__tests__/createOverride.test.js +15 -10
- package/commands/account/__tests__/info.test.js +16 -11
- package/commands/account/__tests__/list.test.js +16 -11
- package/commands/account/__tests__/remove.test.js +18 -13
- package/commands/account/__tests__/removeOverride.js +13 -8
- package/commands/account/__tests__/rename.test.js +20 -15
- package/commands/account/__tests__/use.test.js +15 -10
- package/commands/account/auth.d.ts +1 -1
- package/commands/account/auth.js +67 -65
- package/commands/account/clean.d.ts +1 -1
- package/commands/account/clean.js +60 -55
- package/commands/account/createOverride.d.ts +1 -1
- package/commands/account/createOverride.js +57 -52
- package/commands/account/info.d.ts +1 -1
- package/commands/account/info.js +35 -33
- package/commands/account/list.d.ts +1 -1
- package/commands/account/list.js +45 -43
- package/commands/account/remove.d.ts +1 -1
- package/commands/account/remove.js +42 -37
- package/commands/account/removeOverride.d.ts +1 -1
- package/commands/account/removeOverride.js +43 -38
- package/commands/account/rename.d.ts +1 -1
- package/commands/account/rename.js +20 -18
- package/commands/account/use.d.ts +1 -1
- package/commands/account/use.js +31 -29
- package/commands/account.d.ts +1 -1
- package/commands/account.js +28 -23
- package/commands/app/__tests__/install.test.js +52 -0
- package/commands/app/__tests__/migrate.test.js +34 -29
- package/commands/app/install.d.ts +8 -0
- package/commands/app/install.js +127 -0
- package/commands/app/migrate.d.ts +2 -2
- package/commands/app/migrate.js +43 -40
- package/commands/app/secret/__tests__/add.test.js +11 -6
- package/commands/app/secret/__tests__/delete.test.js +11 -6
- package/commands/app/secret/__tests__/list.test.js +11 -6
- package/commands/app/secret/__tests__/update.test.js +11 -6
- package/commands/app/secret/add.d.ts +1 -1
- package/commands/app/secret/add.js +30 -28
- package/commands/app/secret/delete.d.ts +1 -1
- package/commands/app/secret/delete.js +36 -34
- package/commands/app/secret/list.d.ts +1 -1
- package/commands/app/secret/list.js +27 -25
- package/commands/app/secret/update.d.ts +1 -1
- package/commands/app/secret/update.js +34 -32
- package/commands/app/secret.d.ts +1 -1
- package/commands/app/secret.js +17 -12
- package/commands/app.d.ts +1 -1
- package/commands/app.js +16 -6
- package/commands/auth.d.ts +1 -1
- package/commands/auth.js +72 -70
- package/commands/cms/convertFields.d.ts +1 -1
- package/commands/cms/convertFields.js +39 -34
- package/commands/cms/getReactModule.d.ts +1 -1
- package/commands/cms/getReactModule.js +37 -32
- package/commands/cms/lighthouseScore.d.ts +1 -1
- package/commands/cms/lighthouseScore.js +72 -67
- package/commands/cms.d.ts +1 -1
- package/commands/cms.js +16 -11
- package/commands/completion.d.ts +1 -1
- package/commands/completion.js +15 -10
- package/commands/config/migrate.d.ts +1 -1
- package/commands/config/migrate.js +32 -27
- package/commands/config/set.d.ts +1 -1
- package/commands/config/set.js +25 -23
- package/commands/config.d.ts +1 -1
- package/commands/config.js +13 -8
- package/commands/create/api-sample.d.ts +1 -1
- package/commands/create/api-sample.js +33 -28
- package/commands/create/app.d.ts +1 -1
- package/commands/create/app.js +5 -3
- package/commands/create/function.d.ts +1 -1
- package/commands/create/function.js +11 -9
- package/commands/create/index.d.ts +1 -1
- package/commands/create/index.js +24 -19
- package/commands/create/module.d.ts +1 -1
- package/commands/create/module.js +14 -12
- package/commands/create/react-app.d.ts +1 -1
- package/commands/create/react-app.js +5 -3
- package/commands/create/template.d.ts +1 -1
- package/commands/create/template.js +14 -12
- package/commands/create/vue-app.d.ts +1 -1
- package/commands/create/vue-app.js +5 -3
- package/commands/create/webpack-serverless.d.ts +1 -1
- package/commands/create/webpack-serverless.js +5 -3
- package/commands/create/website-theme.d.ts +1 -1
- package/commands/create/website-theme.js +7 -5
- package/commands/create.d.ts +2 -2
- package/commands/create.js +35 -30
- package/commands/customObject/__tests__/create.test.js +18 -13
- package/commands/customObject/__tests__/schema.test.js +23 -18
- package/commands/customObject/create.d.ts +1 -1
- package/commands/customObject/create.js +30 -28
- package/commands/customObject/schema/__tests__/create.test.js +18 -13
- package/commands/customObject/schema/__tests__/delete.test.js +18 -13
- package/commands/customObject/schema/__tests__/fetch-all.test.js +18 -13
- package/commands/customObject/schema/__tests__/fetch.test.js +18 -13
- package/commands/customObject/schema/__tests__/list.test.js +18 -13
- package/commands/customObject/schema/__tests__/update.test.js +18 -13
- package/commands/customObject/schema/create.d.ts +1 -1
- package/commands/customObject/schema/create.js +30 -28
- package/commands/customObject/schema/delete.d.ts +1 -1
- package/commands/customObject/schema/delete.js +26 -24
- package/commands/customObject/schema/fetch-all.d.ts +1 -1
- package/commands/customObject/schema/fetch-all.js +24 -22
- package/commands/customObject/schema/fetch.d.ts +1 -1
- package/commands/customObject/schema/fetch.js +26 -24
- package/commands/customObject/schema/list.d.ts +1 -1
- package/commands/customObject/schema/list.js +15 -13
- package/commands/customObject/schema/update.d.ts +1 -1
- package/commands/customObject/schema/update.js +34 -32
- package/commands/customObject/schema.d.ts +1 -1
- package/commands/customObject/schema.js +22 -17
- package/commands/customObject.d.ts +1 -1
- package/commands/customObject.js +18 -13
- package/commands/doctor.d.ts +1 -1
- package/commands/doctor.js +33 -28
- package/commands/feedback.d.ts +1 -1
- package/commands/feedback.js +24 -19
- package/commands/fetch.d.ts +1 -1
- package/commands/fetch.js +30 -28
- package/commands/filemanager/__tests__/fetch.test.js +22 -17
- package/commands/filemanager/__tests__/upload.test.js +20 -15
- package/commands/filemanager/fetch.d.ts +1 -1
- package/commands/filemanager/fetch.js +25 -23
- package/commands/filemanager/upload.d.ts +1 -1
- package/commands/filemanager/upload.js +44 -39
- package/commands/filemanager.d.ts +1 -1
- package/commands/filemanager.js +13 -8
- package/commands/function/deploy.d.ts +1 -1
- package/commands/function/deploy.js +40 -35
- package/commands/function/list.d.ts +1 -1
- package/commands/function/list.js +29 -24
- package/commands/function/server.d.ts +1 -1
- package/commands/function/server.js +17 -15
- package/commands/function.d.ts +1 -1
- package/commands/function.js +18 -12
- package/commands/getStarted.d.ts +1 -1
- package/commands/getStarted.js +131 -140
- package/commands/hubdb/__tests__/clear.test.js +18 -13
- package/commands/hubdb/__tests__/create.test.js +18 -13
- package/commands/hubdb/__tests__/delete.test.js +18 -13
- package/commands/hubdb/__tests__/fetch.test.js +18 -13
- package/commands/hubdb/__tests__/list.test.js +28 -23
- package/commands/hubdb/clear.d.ts +1 -1
- package/commands/hubdb/clear.js +22 -20
- package/commands/hubdb/create.d.ts +1 -1
- package/commands/hubdb/create.js +35 -30
- package/commands/hubdb/delete.d.ts +1 -1
- package/commands/hubdb/delete.js +26 -24
- package/commands/hubdb/fetch.d.ts +1 -1
- package/commands/hubdb/fetch.js +19 -17
- package/commands/hubdb/list.d.ts +1 -1
- package/commands/hubdb/list.js +35 -33
- package/commands/hubdb.d.ts +1 -1
- package/commands/hubdb.js +24 -18
- package/commands/init.d.ts +1 -1
- package/commands/init.js +88 -83
- package/commands/lint.d.ts +1 -1
- package/commands/lint.js +26 -24
- package/commands/list.d.ts +1 -1
- package/commands/list.js +37 -32
- package/commands/logs.d.ts +1 -1
- package/commands/logs.js +37 -35
- package/commands/mcp/__tests__/setup.test.js +12 -7
- package/commands/mcp/__tests__/start.test.js +12 -7
- package/commands/mcp/setup.d.ts +1 -1
- package/commands/mcp/setup.js +20 -17
- package/commands/mcp/start.d.ts +5 -2
- package/commands/mcp/start.js +41 -31
- package/commands/mcp.d.ts +1 -1
- package/commands/mcp.js +12 -7
- package/commands/module/marketplace-validate.d.ts +1 -1
- package/commands/module/marketplace-validate.js +26 -21
- package/commands/module.d.ts +1 -1
- package/commands/module.js +13 -7
- package/commands/mv.d.ts +1 -1
- package/commands/mv.js +22 -20
- package/commands/open.d.ts +1 -1
- package/commands/open.js +21 -19
- package/commands/project/__tests__/add.test.js +15 -10
- package/commands/project/__tests__/create.test.js +19 -14
- package/commands/project/__tests__/deploy.test.js +143 -103
- package/commands/project/__tests__/devUnifiedFlow.test.js +157 -148
- package/commands/project/__tests__/download.test.js +19 -14
- package/commands/project/__tests__/installDeps.test.js +70 -32
- package/commands/project/__tests__/listBuilds.test.js +19 -14
- package/commands/project/__tests__/logs.test.js +94 -56
- package/commands/project/__tests__/migrate.test.js +30 -25
- package/commands/project/__tests__/migrateApp.test.js +22 -17
- package/commands/project/__tests__/open.test.js +21 -16
- package/commands/project/__tests__/profile.test.js +19 -14
- package/commands/project/__tests__/upload.test.js +23 -18
- package/commands/project/__tests__/watch.test.js +19 -14
- package/commands/project/add.d.ts +1 -1
- package/commands/project/add.js +36 -34
- package/commands/project/cloneApp.d.ts +1 -1
- package/commands/project/cloneApp.js +72 -67
- package/commands/project/create.d.ts +2 -2
- package/commands/project/create.js +68 -63
- package/commands/project/deploy.d.ts +3 -2
- package/commands/project/deploy.js +102 -91
- package/commands/project/dev/deprecatedFlow.d.ts +2 -2
- package/commands/project/dev/deprecatedFlow.js +58 -52
- package/commands/project/dev/index.d.ts +1 -1
- package/commands/project/dev/index.js +47 -44
- package/commands/project/dev/unifiedFlow.d.ts +3 -3
- package/commands/project/dev/unifiedFlow.js +74 -67
- package/commands/project/download.d.ts +1 -1
- package/commands/project/download.js +40 -35
- package/commands/project/installDeps.d.ts +1 -1
- package/commands/project/installDeps.js +34 -29
- package/commands/project/listBuilds.d.ts +1 -1
- package/commands/project/listBuilds.js +45 -40
- package/commands/project/logs.d.ts +1 -1
- package/commands/project/logs.js +54 -52
- package/commands/project/migrate.d.ts +1 -1
- package/commands/project/migrate.js +26 -24
- package/commands/project/migrateApp.d.ts +2 -2
- package/commands/project/migrateApp.js +20 -18
- package/commands/project/open.d.ts +1 -1
- package/commands/project/open.js +30 -25
- package/commands/project/profile/add.d.ts +1 -1
- package/commands/project/profile/add.js +73 -68
- package/commands/project/profile/delete.d.ts +1 -1
- package/commands/project/profile/delete.js +56 -51
- package/commands/project/profile.d.ts +1 -1
- package/commands/project/profile.js +14 -9
- package/commands/project/upload.d.ts +1 -1
- package/commands/project/upload.js +55 -50
- package/commands/project/validate.d.ts +1 -1
- package/commands/project/validate.js +40 -35
- package/commands/project/watch.d.ts +1 -1
- package/commands/project/watch.js +61 -59
- package/commands/project.d.ts +1 -1
- package/commands/project.js +43 -38
- package/commands/remove.d.ts +1 -1
- package/commands/remove.js +17 -15
- package/commands/sandbox/__tests__/create.test.js +20 -15
- package/commands/sandbox/__tests__/delete.test.js +20 -15
- package/commands/sandbox/create.d.ts +1 -1
- package/commands/sandbox/create.js +69 -67
- package/commands/sandbox/delete.d.ts +1 -1
- package/commands/sandbox/delete.js +96 -94
- package/commands/sandbox.d.ts +1 -1
- package/commands/sandbox.js +14 -9
- package/commands/secret/__tests__/addSecret.test.js +18 -13
- package/commands/secret/__tests__/deleteSecret.test.js +18 -13
- package/commands/secret/__tests__/listSecret.test.js +18 -13
- package/commands/secret/__tests__/updateSecret.test.js +18 -13
- package/commands/secret/addSecret.d.ts +1 -1
- package/commands/secret/addSecret.js +28 -26
- package/commands/secret/deleteSecret.d.ts +1 -1
- package/commands/secret/deleteSecret.js +29 -27
- package/commands/secret/listSecret.d.ts +1 -1
- package/commands/secret/listSecret.js +21 -19
- package/commands/secret/updateSecret.d.ts +1 -1
- package/commands/secret/updateSecret.js +27 -25
- package/commands/secret.d.ts +1 -1
- package/commands/secret.js +18 -13
- package/commands/testAccount/__tests__/create.test.js +22 -17
- package/commands/testAccount/__tests__/createConfig.test.js +11 -9
- package/commands/testAccount/__tests__/delete.test.js +20 -15
- package/commands/testAccount/create.d.ts +1 -1
- package/commands/testAccount/create.js +57 -62
- package/commands/testAccount/createConfig.d.ts +1 -3
- package/commands/testAccount/createConfig.js +47 -43
- package/commands/testAccount/delete.d.ts +1 -1
- package/commands/testAccount/delete.js +19 -17
- package/commands/testAccount.d.ts +1 -1
- package/commands/testAccount.js +15 -10
- package/commands/theme/__tests__/generate-selectors.test.js +12 -7
- package/commands/theme/__tests__/marketplace-validate.test.js +19 -14
- package/commands/theme/__tests__/preview.test.js +17 -12
- package/commands/theme/generate-selectors.d.ts +1 -1
- package/commands/theme/generate-selectors.js +28 -23
- package/commands/theme/marketplace-validate.d.ts +1 -1
- package/commands/theme/marketplace-validate.js +24 -19
- package/commands/theme/preview.d.ts +1 -1
- package/commands/theme/preview.js +65 -60
- package/commands/theme.d.ts +1 -1
- package/commands/theme.js +16 -11
- package/commands/upload.d.ts +1 -1
- package/commands/upload.js +82 -77
- package/commands/watch.d.ts +1 -1
- package/commands/watch.js +51 -45
- package/lang/en.d.ts +62 -23
- package/lang/en.js +434 -389
- package/lang/en.lyaml +0 -26
- package/lib/__tests__/accountTypes.test.js +22 -20
- package/lib/__tests__/buildAccount.test.js +90 -27
- package/lib/__tests__/commonOpts.test.js +22 -20
- package/lib/__tests__/dependencyManagement.test.js +51 -46
- package/lib/__tests__/developerTestAccounts.test.js +62 -27
- package/lib/__tests__/hasFeature.test.js +8 -6
- package/lib/__tests__/npm.test.js +20 -15
- package/lib/__tests__/oauth.test.js +28 -23
- package/lib/__tests__/parsing.test.js +20 -18
- package/lib/__tests__/polling.test.js +26 -24
- package/lib/__tests__/process.test.js +19 -14
- package/lib/__tests__/projectProfiles.test.js +39 -34
- package/lib/__tests__/sandboxSync.test.js +35 -30
- package/lib/__tests__/sandboxes.test.js +31 -29
- package/lib/__tests__/serverlessLogs.test.js +13 -8
- package/lib/__tests__/usageTracking.test.js +42 -47
- package/lib/__tests__/validation.test.js +20 -18
- package/lib/__tests__/yargsUtils.test.js +41 -6
- package/lib/accountTypes.js +34 -24
- package/lib/app/__tests__/migrate.test.js +99 -94
- package/lib/app/__tests__/migrate_legacy.test.js +31 -29
- package/lib/app/migrate.d.ts +3 -3
- package/lib/app/migrate.js +145 -127
- package/lib/app/migrate_legacy.d.ts +1 -1
- package/lib/app/migrate_legacy.js +78 -72
- package/lib/app/urls.js +9 -5
- package/lib/buildAccount.d.ts +8 -2
- package/lib/buildAccount.js +119 -61
- package/lib/commonOpts.d.ts +1 -1
- package/lib/commonOpts.js +59 -42
- package/lib/configMigrate.js +38 -34
- package/lib/configOptions.js +40 -34
- package/lib/constants.js +34 -31
- package/lib/customObject.js +6 -2
- package/lib/dependencyManagement.js +45 -37
- package/lib/developerTestAccounts.d.ts +1 -1
- package/lib/developerTestAccounts.js +39 -34
- package/lib/doctor/Diagnosis.d.ts +1 -1
- package/lib/doctor/Diagnosis.js +29 -25
- package/lib/doctor/DiagnosticInfoBuilder.d.ts +1 -1
- package/lib/doctor/DiagnosticInfoBuilder.js +37 -30
- package/lib/doctor/Doctor.d.ts +1 -1
- package/lib/doctor/Doctor.js +101 -94
- package/lib/doctor/__tests__/Diagnosis.test.js +14 -9
- package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.js +34 -29
- package/lib/doctor/__tests__/Doctor.test.js +26 -24
- package/lib/enums/exitCodes.js +4 -1
- package/lib/errorHandlers/index.js +41 -32
- package/lib/errorHandlers/suppressError.d.ts +1 -1
- package/lib/errorHandlers/suppressError.js +31 -28
- package/lib/filesystem.js +15 -8
- package/lib/generateSelectors.js +29 -18
- package/lib/hasFeature.d.ts +1 -1
- package/lib/hasFeature.js +6 -3
- package/lib/interpolation.js +18 -11
- package/lib/lang.d.ts +1 -1
- package/lib/lang.js +27 -22
- package/lib/links.js +24 -16
- package/lib/marketplaceValidate.js +39 -29
- package/lib/mcp/setup.js +105 -72
- package/lib/middleware/__test__/configMiddleware.test.js +55 -20
- package/lib/middleware/__test__/gitMiddleware.test.js +42 -7
- package/lib/middleware/__test__/notificationsMiddleware.test.js +4 -2
- package/lib/middleware/__test__/requestMiddleware.test.js +11 -6
- package/lib/middleware/__test__/utils.test.js +11 -9
- package/lib/middleware/__test__/yargsChecksMiddleware.test.js +44 -9
- package/lib/middleware/autoUpdateMiddleware.js +40 -33
- package/lib/middleware/configMiddleware.js +42 -36
- package/lib/middleware/fireAlarmMiddleware.js +18 -12
- package/lib/middleware/gitMiddleware.js +8 -5
- package/lib/middleware/notificationsMiddleware.js +23 -16
- package/lib/middleware/requestMiddleware.js +10 -4
- package/lib/middleware/utils.js +4 -1
- package/lib/middleware/yargsChecksMiddleware.js +13 -10
- package/lib/npm.js +23 -14
- package/lib/oauth.js +35 -29
- package/lib/parsing.js +6 -3
- package/lib/polling.js +15 -11
- package/lib/process.js +19 -11
- package/lib/projectProfiles.d.ts +2 -2
- package/lib/projectProfiles.js +42 -32
- package/lib/projects/ProjectLogsManager.js +21 -18
- package/lib/projects/__tests__/AppDevModeInterface.test.js +145 -140
- package/lib/projects/__tests__/LocalDevProcess.test.js +73 -68
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +37 -32
- package/lib/projects/__tests__/ProjectLogsManager.test.js +58 -56
- package/lib/projects/__tests__/buildAndDeploy.test.js +9 -7
- package/lib/projects/__tests__/components.test.js +14 -9
- package/lib/projects/__tests__/projects.test.js +40 -35
- package/lib/projects/__tests__/structure.test.js +81 -43
- package/lib/projects/add/__tests__/legacyAddComponent.test.js +28 -26
- package/lib/projects/add/__tests__/v3AddComponent.test.js +30 -25
- package/lib/projects/add/legacyAddComponent.d.ts +1 -1
- package/lib/projects/add/legacyAddComponent.js +30 -24
- package/lib/projects/add/v3AddComponent.d.ts +1 -1
- package/lib/projects/add/v3AddComponent.js +42 -36
- package/lib/projects/buildAndDeploy.d.ts +1 -1
- package/lib/projects/buildAndDeploy.js +97 -88
- package/lib/projects/components.js +25 -19
- package/lib/projects/config.d.ts +1 -1
- package/lib/projects/config.js +41 -32
- package/lib/projects/create/__tests__/legacy.test.js +57 -22
- package/lib/projects/create/__tests__/v3.test.js +7 -5
- package/lib/projects/create/index.d.ts +3 -3
- package/lib/projects/create/index.js +22 -19
- package/lib/projects/create/legacy.d.ts +1 -1
- package/lib/projects/create/legacy.js +31 -25
- package/lib/projects/create/v3.d.ts +3 -3
- package/lib/projects/create/v3.js +59 -49
- package/lib/projects/ensureProjectExists.js +37 -31
- package/lib/projects/localDev/AppDevModeInterface.d.ts +3 -3
- package/lib/projects/localDev/AppDevModeInterface.js +60 -58
- package/lib/projects/localDev/DevServerManager.d.ts +1 -1
- package/lib/projects/localDev/DevServerManager.js +24 -24
- package/lib/projects/localDev/DevServerManagerV2.d.ts +2 -2
- package/lib/projects/localDev/DevServerManagerV2.js +20 -17
- package/lib/projects/localDev/LocalDevLogger.d.ts +1 -1
- package/lib/projects/localDev/LocalDevLogger.js +64 -59
- package/lib/projects/localDev/LocalDevManager.d.ts +1 -1
- package/lib/projects/localDev/LocalDevManager.js +111 -106
- package/lib/projects/localDev/LocalDevProcess.d.ts +4 -4
- package/lib/projects/localDev/LocalDevProcess.js +30 -25
- package/lib/projects/localDev/LocalDevState.d.ts +3 -3
- package/lib/projects/localDev/LocalDevState.js +5 -3
- package/lib/projects/localDev/LocalDevWatcher.d.ts +1 -1
- package/lib/projects/localDev/LocalDevWatcher.js +11 -6
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +1 -1
- package/lib/projects/localDev/LocalDevWebsocketServer.js +27 -25
- package/lib/projects/localDev/helpers.d.ts +4 -4
- package/lib/projects/localDev/helpers.js +174 -156
- package/lib/projects/structure.d.ts +4 -4
- package/lib/projects/structure.js +78 -32
- package/lib/projects/ui.js +13 -10
- package/lib/projects/upload.d.ts +3 -2
- package/lib/projects/upload.js +65 -55
- package/lib/projects/urls.js +24 -14
- package/lib/projects/watch.d.ts +1 -1
- package/lib/projects/watch.js +54 -48
- package/lib/prompts/__tests__/downloadProjectPrompt.test.js +11 -9
- package/lib/prompts/__tests__/projectsLogsPrompt.test.js +16 -11
- package/lib/prompts/accountNamePrompt.d.ts +1 -1
- package/lib/prompts/accountNamePrompt.js +31 -26
- package/lib/prompts/accountsPrompt.js +15 -12
- package/lib/prompts/cmsFieldPrompt.js +19 -13
- package/lib/prompts/createApiSamplePrompt.d.ts +1 -1
- package/lib/prompts/createApiSamplePrompt.js +12 -9
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.d.ts +11 -10
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +88 -43
- package/lib/prompts/createFunctionPrompt.js +20 -17
- package/lib/prompts/createModulePrompt.js +15 -12
- package/lib/prompts/createTemplatePrompt.js +8 -5
- package/lib/prompts/downloadProjectPrompt.js +20 -17
- package/lib/prompts/installAppPrompt.js +26 -19
- package/lib/prompts/personalAccessKeyPrompt.d.ts +2 -2
- package/lib/prompts/personalAccessKeyPrompt.js +47 -40
- package/lib/prompts/previewPrompt.js +22 -15
- package/lib/prompts/projectAddPrompt.d.ts +1 -1
- package/lib/prompts/projectAddPrompt.js +18 -14
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +1 -1
- package/lib/prompts/projectDevTargetAccountPrompt.js +54 -48
- package/lib/prompts/projectNameAndDestPrompt.d.ts +1 -1
- package/lib/prompts/projectNameAndDestPrompt.js +29 -22
- package/lib/prompts/projectNamePrompt.js +14 -11
- package/lib/prompts/projectsLogsPrompt.js +8 -5
- package/lib/prompts/promptUtils.d.ts +1 -1
- package/lib/prompts/promptUtils.js +87 -70
- package/lib/prompts/sandboxesPrompt.d.ts +1 -1
- package/lib/prompts/sandboxesPrompt.js +30 -26
- package/lib/prompts/secretPrompt.js +15 -10
- package/lib/prompts/selectAppPrompt.js +14 -11
- package/lib/prompts/selectHubDBTablePrompt.js +30 -24
- package/lib/prompts/selectProjectTemplatePrompt.d.ts +1 -1
- package/lib/prompts/selectProjectTemplatePrompt.js +13 -10
- package/lib/prompts/selectPublicAppForMigrationPrompt.js +25 -22
- package/lib/prompts/setAsDefaultAccountPrompt.js +16 -13
- package/lib/prompts/uploadPrompt.js +17 -11
- package/lib/sandboxSync.d.ts +1 -1
- package/lib/sandboxSync.js +65 -58
- package/lib/sandboxes.d.ts +1 -1
- package/lib/sandboxes.js +76 -68
- package/lib/schema.js +23 -12
- package/lib/serverlessLogs.js +52 -45
- package/lib/testUtils.js +8 -4
- package/lib/ui/SpinniesManager.d.ts +1 -1
- package/lib/ui/SpinniesManager.js +34 -29
- package/lib/ui/boxen.js +14 -11
- package/lib/ui/git.js +20 -14
- package/lib/ui/index.js +74 -56
- package/lib/ui/logger.js +13 -10
- package/lib/ui/serverlessFunctionLogs.js +20 -14
- package/lib/ui/spinniesUtils.js +39 -24
- package/lib/ui/supportHyperlinks.js +6 -3
- package/lib/ui/supportsColor.js +17 -11
- package/lib/ui/table.js +13 -6
- package/lib/upload.js +21 -15
- package/lib/usageTracking.d.ts +11 -0
- package/lib/usageTracking.js +95 -95
- package/lib/utils/hasFlag.js +8 -2
- package/lib/validation.js +87 -48
- package/lib/yargsUtils.d.ts +1 -1
- package/lib/yargsUtils.js +16 -13
- package/mcp-server/server.js +8 -6
- package/mcp-server/tools/index.js +16 -13
- package/mcp-server/tools/project/AddFeatureToProject.d.ts +1 -1
- package/mcp-server/tools/project/AddFeatureToProject.js +41 -34
- package/mcp-server/tools/project/CreateProjectTool.d.ts +3 -3
- package/mcp-server/tools/project/CreateProjectTool.js +52 -45
- package/mcp-server/tools/project/DeployProject.d.ts +1 -1
- package/mcp-server/tools/project/DeployProject.js +24 -17
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +1 -1
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +27 -20
- package/mcp-server/tools/project/UploadProjectTools.d.ts +1 -1
- package/mcp-server/tools/project/UploadProjectTools.js +21 -11
- package/mcp-server/tools/project/ValidateProjectTool.d.ts +1 -1
- package/mcp-server/tools/project/ValidateProjectTool.js +19 -12
- package/mcp-server/tools/project/__tests__/AddFeatureToProject.test.js +15 -12
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +16 -13
- package/mcp-server/tools/project/__tests__/DeployProject.test.js +9 -6
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.js +7 -4
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.js +7 -4
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.js +7 -4
- package/mcp-server/tools/project/constants.js +9 -3
- package/mcp-server/types.js +5 -1
- package/mcp-server/utils/__tests__/command.test.js +11 -9
- package/mcp-server/utils/__tests__/project.test.js +26 -18
- package/mcp-server/utils/command.d.ts +1 -1
- package/mcp-server/utils/command.js +11 -4
- package/mcp-server/utils/content.d.ts +1 -1
- package/mcp-server/utils/content.js +6 -2
- package/mcp-server/utils/project.js +17 -8
- package/mcp-server/utils/toolUsageTracking.d.ts +1 -0
- package/mcp-server/utils/toolUsageTracking.js +25 -0
- package/package.json +13 -17
- package/types/{cms.d.ts → Cms.d.ts} +1 -1
- package/types/Cms.js +2 -0
- package/types/LocalDev.d.ts +4 -4
- package/types/LocalDev.js +2 -1
- package/types/ProjectComponents.d.ts +2 -2
- package/types/ProjectComponents.js +2 -1
- package/types/Projects.d.ts +1 -1
- package/types/Projects.js +5 -2
- package/types/Prompts.js +2 -1
- package/types/Sandboxes.js +2 -0
- package/types/Yargs.js +2 -1
- package/types/sandboxes.js +0 -1
- /package/{types/cms.js → commands/app/__tests__/install.test.d.ts} +0 -0
- /package/types/{sandboxes.d.ts → Sandboxes.d.ts} +0 -0
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleDeprecatedEnvVariables = handleDeprecatedEnvVariables;
|
|
4
|
+
exports.injectAccountIdMiddleware = injectAccountIdMiddleware;
|
|
5
|
+
exports.loadConfigMiddleware = loadConfigMiddleware;
|
|
6
|
+
exports.validateAccountOptions = validateAccountOptions;
|
|
7
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
8
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
9
|
+
const validation_1 = require("../validation");
|
|
10
|
+
const exitCodes_1 = require("../enums/exitCodes");
|
|
11
|
+
const lang_1 = require("../lang");
|
|
12
|
+
const ui_1 = require("../ui");
|
|
13
|
+
const utils_1 = require("./utils");
|
|
14
|
+
const parsing_1 = require("../parsing");
|
|
15
|
+
const logger_2 = require("../ui/logger");
|
|
16
|
+
const en_1 = require("../../lang/en");
|
|
17
|
+
function handleDeprecatedEnvVariables(argv) {
|
|
12
18
|
// HUBSPOT_PORTAL_ID is deprecated, but we'll still support it for now
|
|
13
19
|
// The HubSpot GH Deploy Action still uses HUBSPOT_PORTAL_ID
|
|
14
20
|
if (argv.useEnv &&
|
|
15
21
|
process.env.HUBSPOT_PORTAL_ID &&
|
|
16
22
|
!process.env.HUBSPOT_ACCOUNT_ID) {
|
|
17
|
-
uiDeprecatedTag(i18n(`commands.generalErrors.handleDeprecatedEnvVariables.portalEnvVarDeprecated`, {
|
|
18
|
-
configPath: getConfigPath(),
|
|
23
|
+
(0, ui_1.uiDeprecatedTag)((0, lang_1.i18n)(`commands.generalErrors.handleDeprecatedEnvVariables.portalEnvVarDeprecated`, {
|
|
24
|
+
configPath: (0, config_1.getConfigPath)(),
|
|
19
25
|
}));
|
|
20
26
|
process.env.HUBSPOT_ACCOUNT_ID = process.env.HUBSPOT_PORTAL_ID;
|
|
21
27
|
}
|
|
@@ -23,20 +29,20 @@ export function handleDeprecatedEnvVariables(argv) {
|
|
|
23
29
|
/**
|
|
24
30
|
* Auto-injects the derivedAccountId flag into all commands
|
|
25
31
|
*/
|
|
26
|
-
|
|
32
|
+
async function injectAccountIdMiddleware(argv) {
|
|
27
33
|
const { account } = argv;
|
|
28
34
|
// Preserves the original --account flag for certain commands.
|
|
29
35
|
argv.userProvidedAccount = account;
|
|
30
36
|
if (argv.useEnv && process.env.HUBSPOT_ACCOUNT_ID) {
|
|
31
37
|
try {
|
|
32
|
-
argv.derivedAccountId = parseStringToNumber(process.env.HUBSPOT_ACCOUNT_ID);
|
|
38
|
+
argv.derivedAccountId = (0, parsing_1.parseStringToNumber)(process.env.HUBSPOT_ACCOUNT_ID);
|
|
33
39
|
}
|
|
34
40
|
catch (err) {
|
|
35
|
-
uiLogger.error(lib.configMiddleWare.invalidAccountIdEnvironmentVariable);
|
|
41
|
+
logger_2.uiLogger.error(en_1.lib.configMiddleWare.invalidAccountIdEnvironmentVariable);
|
|
36
42
|
}
|
|
37
43
|
}
|
|
38
44
|
else {
|
|
39
|
-
argv.derivedAccountId = getAccountId(account);
|
|
45
|
+
argv.derivedAccountId = (0, config_1.getAccountId)(account);
|
|
40
46
|
}
|
|
41
47
|
}
|
|
42
48
|
const SKIP_CONFIG_VALIDATION = {
|
|
@@ -50,40 +56,40 @@ const SKIP_CONFIG_VALIDATION = {
|
|
|
50
56
|
},
|
|
51
57
|
},
|
|
52
58
|
};
|
|
53
|
-
|
|
59
|
+
async function loadConfigMiddleware(argv) {
|
|
54
60
|
// Skip this when no command is provided
|
|
55
61
|
if (!argv._.length || argv.help) {
|
|
56
62
|
return;
|
|
57
63
|
}
|
|
58
64
|
const maybeValidateConfig = () => {
|
|
59
|
-
if (!isTargetedCommand(argv._, SKIP_CONFIG_VALIDATION) &&
|
|
60
|
-
!validateConfig()) {
|
|
61
|
-
process.exit(EXIT_CODES.ERROR);
|
|
65
|
+
if (!(0, utils_1.isTargetedCommand)(argv._, SKIP_CONFIG_VALIDATION) &&
|
|
66
|
+
!(0, config_1.validateConfig)()) {
|
|
67
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
62
68
|
}
|
|
63
69
|
};
|
|
64
|
-
if (!configFileExists(true) &&
|
|
65
|
-
isTargetedCommand(argv._, {
|
|
70
|
+
if (!(0, config_1.configFileExists)(true) &&
|
|
71
|
+
(0, utils_1.isTargetedCommand)(argv._, {
|
|
66
72
|
account: { target: false, subCommands: { auth: { target: true } } },
|
|
67
73
|
config: { target: false, subCommands: { migrate: { target: true } } },
|
|
68
74
|
})) {
|
|
69
75
|
return;
|
|
70
76
|
}
|
|
71
|
-
if (configFileExists(true) &&
|
|
77
|
+
if ((0, config_1.configFileExists)(true) &&
|
|
72
78
|
argv.config &&
|
|
73
|
-
!isTargetedCommand(argv._, {
|
|
79
|
+
!(0, utils_1.isTargetedCommand)(argv._, {
|
|
74
80
|
config: { target: false, subCommands: { migrate: { target: true } } },
|
|
75
81
|
})) {
|
|
76
|
-
logger.error(i18n(`commands.generalErrors.loadConfigMiddleware.configFileExists`, {
|
|
77
|
-
configPath: getConfigPath(),
|
|
82
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.generalErrors.loadConfigMiddleware.configFileExists`, {
|
|
83
|
+
configPath: (0, config_1.getConfigPath)(),
|
|
78
84
|
}));
|
|
79
|
-
process.exit(EXIT_CODES.ERROR);
|
|
85
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
80
86
|
}
|
|
81
|
-
else if (!isTargetedCommand(argv._, { init: { target: true } })) {
|
|
82
|
-
const config = loadConfig(argv.config, argv);
|
|
87
|
+
else if (!(0, utils_1.isTargetedCommand)(argv._, { init: { target: true } })) {
|
|
88
|
+
const config = (0, config_1.loadConfig)(argv.config, argv);
|
|
83
89
|
// We don't run validateConfig() for auth because users should be able to run it when
|
|
84
90
|
// no accounts are configured, but we still want to exit if the config file is not found
|
|
85
|
-
if (isTargetedCommand(argv._, { auth: { target: true } }) && !config) {
|
|
86
|
-
process.exit(EXIT_CODES.ERROR);
|
|
91
|
+
if ((0, utils_1.isTargetedCommand)(argv._, { auth: { target: true } }) && !config) {
|
|
92
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
87
93
|
}
|
|
88
94
|
}
|
|
89
95
|
maybeValidateConfig();
|
|
@@ -127,15 +133,15 @@ const SKIP_ACCOUNT_VALIDATION = {
|
|
|
127
133
|
sandboxes: sandboxesSubCommands,
|
|
128
134
|
config: configSubCommands,
|
|
129
135
|
};
|
|
130
|
-
|
|
136
|
+
async function validateAccountOptions(argv) {
|
|
131
137
|
// Skip this when no command is provided
|
|
132
138
|
if (argv._.length && !argv.help) {
|
|
133
139
|
let validAccount = true;
|
|
134
|
-
if (!isTargetedCommand(argv._, SKIP_ACCOUNT_VALIDATION)) {
|
|
135
|
-
validAccount = await validateAccount(argv);
|
|
140
|
+
if (!(0, utils_1.isTargetedCommand)(argv._, SKIP_ACCOUNT_VALIDATION)) {
|
|
141
|
+
validAccount = await (0, validation_1.validateAccount)(argv);
|
|
136
142
|
}
|
|
137
143
|
if (!validAccount) {
|
|
138
|
-
process.exit(EXIT_CODES.ERROR);
|
|
144
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
139
145
|
}
|
|
140
146
|
}
|
|
141
147
|
}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.checkFireAlarms = checkFireAlarms;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const fireAlarm_1 = require("@hubspot/local-dev-lib/api/fireAlarm");
|
|
9
|
+
const errorHandlers_1 = require("../errorHandlers");
|
|
10
|
+
const package_json_1 = __importDefault(require("../../package.json"));
|
|
11
|
+
const boxen_1 = require("../ui/boxen");
|
|
6
12
|
/*
|
|
7
13
|
* Versions can be formatted like this:
|
|
8
14
|
* =7.2.2 -> targets the exact version 7.2.2
|
|
@@ -80,11 +86,11 @@ function filterFireAlarm(fireAlarm, command, version) {
|
|
|
80
86
|
async function getFireAlarms(accountId, command, version) {
|
|
81
87
|
let relevantAlarms = [];
|
|
82
88
|
try {
|
|
83
|
-
const { data: fireAlarms } = await fetchFireAlarms(accountId);
|
|
89
|
+
const { data: fireAlarms } = await (0, fireAlarm_1.fetchFireAlarms)(accountId);
|
|
84
90
|
relevantAlarms = fireAlarms.filter(fireAlarm => filterFireAlarm(fireAlarm, command, version));
|
|
85
91
|
}
|
|
86
92
|
catch (error) {
|
|
87
|
-
debugError(error);
|
|
93
|
+
(0, errorHandlers_1.debugError)(error);
|
|
88
94
|
}
|
|
89
95
|
return relevantAlarms;
|
|
90
96
|
}
|
|
@@ -94,11 +100,11 @@ async function logFireAlarms(accountId, command, version) {
|
|
|
94
100
|
const notifications = alarms.reduce((acc, alarm) => {
|
|
95
101
|
if (alarm.title && alarm.message) {
|
|
96
102
|
return (acc +
|
|
97
|
-
`${acc.length > 0 ? '\n\n' : ''}${
|
|
103
|
+
`${acc.length > 0 ? '\n\n' : ''}${chalk_1.default.bold(alarm.title)}\n${alarm.message}`);
|
|
98
104
|
}
|
|
99
105
|
return acc;
|
|
100
106
|
}, '');
|
|
101
|
-
await logInBox({
|
|
107
|
+
await (0, boxen_1.logInBox)({
|
|
102
108
|
contents: notifications,
|
|
103
109
|
options: {
|
|
104
110
|
title: 'Notifications',
|
|
@@ -106,14 +112,14 @@ async function logFireAlarms(accountId, command, version) {
|
|
|
106
112
|
});
|
|
107
113
|
}
|
|
108
114
|
}
|
|
109
|
-
|
|
115
|
+
async function checkFireAlarms(argv) {
|
|
110
116
|
const { derivedAccountId } = argv;
|
|
111
117
|
try {
|
|
112
118
|
if (derivedAccountId) {
|
|
113
|
-
await logFireAlarms(derivedAccountId, argv._.join(' '),
|
|
119
|
+
await logFireAlarms(derivedAccountId, argv._.join(' '), package_json_1.default.version);
|
|
114
120
|
}
|
|
115
121
|
}
|
|
116
122
|
catch (error) {
|
|
117
|
-
debugError(error);
|
|
123
|
+
(0, errorHandlers_1.debugError)(error);
|
|
118
124
|
}
|
|
119
125
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkAndWarnGitInclusionMiddleware = checkAndWarnGitInclusionMiddleware;
|
|
4
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
5
|
+
const git_1 = require("../ui/git");
|
|
6
|
+
function checkAndWarnGitInclusionMiddleware(argv) {
|
|
4
7
|
// Skip this when no command is provided
|
|
5
8
|
if (argv._.length) {
|
|
6
|
-
const configPath = getConfigPath();
|
|
9
|
+
const configPath = (0, config_1.getConfigPath)();
|
|
7
10
|
if (configPath) {
|
|
8
|
-
checkAndWarnGitInclusion(configPath);
|
|
11
|
+
(0, git_1.checkAndWarnGitInclusion)(configPath);
|
|
9
12
|
}
|
|
10
13
|
}
|
|
11
14
|
}
|
|
@@ -1,34 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.notifyAboutUpdates = notifyAboutUpdates;
|
|
7
|
+
// Update-notifier is CommonJS, so we need to use require
|
|
8
|
+
const updateNotifier = require('update-notifier');
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
const package_json_1 = __importDefault(require("../../package.json"));
|
|
11
|
+
const ui_1 = require("../ui");
|
|
12
|
+
const lang_1 = require("../lang");
|
|
6
13
|
const notifier = updateNotifier({
|
|
7
|
-
pkg: { ...
|
|
14
|
+
pkg: { ...package_json_1.default, name: '@hubspot/cli' },
|
|
8
15
|
distTag: 'latest',
|
|
9
16
|
shouldNotifyInNpmScript: true,
|
|
10
17
|
});
|
|
11
18
|
const CMS_CLI_PACKAGE_NAME = '@hubspot/cms-cli';
|
|
12
|
-
|
|
19
|
+
function notifyAboutUpdates() {
|
|
13
20
|
notifier.notify({
|
|
14
|
-
message:
|
|
15
|
-
? i18n(`commands.generalErrors.updateNotify.cmsUpdateNotification`, {
|
|
21
|
+
message: package_json_1.default.name === CMS_CLI_PACKAGE_NAME
|
|
22
|
+
? (0, lang_1.i18n)(`commands.generalErrors.updateNotify.cmsUpdateNotification`, {
|
|
16
23
|
packageName: CMS_CLI_PACKAGE_NAME,
|
|
17
|
-
updateCommand: uiCommandReference('{updateCommand}'),
|
|
24
|
+
updateCommand: (0, ui_1.uiCommandReference)('{updateCommand}'),
|
|
18
25
|
})
|
|
19
|
-
: i18n(`commands.generalErrors.updateNotify.cliUpdateNotification`, {
|
|
20
|
-
updateCommand: uiCommandReference('{updateCommand}'),
|
|
26
|
+
: (0, lang_1.i18n)(`commands.generalErrors.updateNotify.cliUpdateNotification`, {
|
|
27
|
+
updateCommand: (0, ui_1.uiCommandReference)('{updateCommand}'),
|
|
21
28
|
}),
|
|
22
29
|
defer: false,
|
|
23
30
|
boxenOptions: {
|
|
24
|
-
borderColor: UI_COLORS.MARIGOLD_DARK,
|
|
31
|
+
borderColor: ui_1.UI_COLORS.MARIGOLD_DARK,
|
|
25
32
|
margin: 1,
|
|
26
33
|
padding: 1,
|
|
27
34
|
textAlignment: 'center',
|
|
28
35
|
borderStyle: 'round',
|
|
29
|
-
title:
|
|
30
|
-
?
|
|
31
|
-
:
|
|
36
|
+
title: package_json_1.default.name === CMS_CLI_PACKAGE_NAME
|
|
37
|
+
? null
|
|
38
|
+
: chalk_1.default.bold((0, lang_1.i18n)(`commands.generalErrors.updateNotify.notifyTitle`)),
|
|
32
39
|
},
|
|
33
40
|
});
|
|
34
41
|
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.setRequestHeaders = setRequestHeaders;
|
|
7
|
+
const http_1 = require("@hubspot/local-dev-lib/http");
|
|
8
|
+
const package_json_1 = __importDefault(require("../../package.json"));
|
|
9
|
+
function setRequestHeaders() {
|
|
10
|
+
(0, http_1.addUserAgentHeader)('HubSpot CLI', package_json_1.default.version);
|
|
5
11
|
}
|
package/lib/middleware/utils.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isTargetedCommand = isTargetedCommand;
|
|
4
|
+
function isTargetedCommand(commandParts, targetCommandMap) {
|
|
2
5
|
const currentCommand = commandParts[0];
|
|
3
6
|
if (!targetCommandMap[currentCommand]) {
|
|
4
7
|
return false;
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.performChecks = performChecks;
|
|
4
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
5
|
+
const exitCodes_1 = require("../enums/exitCodes");
|
|
6
|
+
const lang_1 = require("../lang");
|
|
7
|
+
const config_1 = require("../projects/config");
|
|
8
|
+
const utils_1 = require("./utils");
|
|
6
9
|
const UPLOAD_AND_WATCH_COMMANDS = {
|
|
7
10
|
upload: { target: true },
|
|
8
11
|
watch: { target: true },
|
|
9
12
|
};
|
|
10
|
-
|
|
13
|
+
function performChecks(argv) {
|
|
11
14
|
// Require "project" command when running upload/watch inside of a project
|
|
12
|
-
if (isTargetedCommand(argv._, UPLOAD_AND_WATCH_COMMANDS) &&
|
|
13
|
-
getIsInProject(argv.src)) {
|
|
14
|
-
logger.error(i18n(`commands.generalErrors.srcIsProject`, {
|
|
15
|
+
if ((0, utils_1.isTargetedCommand)(argv._, UPLOAD_AND_WATCH_COMMANDS) &&
|
|
16
|
+
(0, config_1.getIsInProject)(argv.src)) {
|
|
17
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.generalErrors.srcIsProject`, {
|
|
15
18
|
src: argv.src || './',
|
|
16
19
|
command: argv._.join(' '),
|
|
17
20
|
}));
|
|
18
|
-
process.exit(EXIT_CODES.ERROR);
|
|
21
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
19
22
|
}
|
|
20
23
|
return true;
|
|
21
24
|
}
|
package/lib/npm.js
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DEFAULT_PACKAGE_MANAGER = void 0;
|
|
7
|
+
exports.isGloballyInstalled = isGloballyInstalled;
|
|
8
|
+
exports.getLatestCliVersion = getLatestCliVersion;
|
|
9
|
+
exports.executeInstall = executeInstall;
|
|
10
|
+
const child_process_1 = require("child_process");
|
|
11
|
+
const util_1 = __importDefault(require("util"));
|
|
12
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
13
|
+
const package_json_1 = __importDefault(require("../package.json"));
|
|
14
|
+
exports.DEFAULT_PACKAGE_MANAGER = 'npm';
|
|
15
|
+
async function isGloballyInstalled(packageName) {
|
|
16
|
+
const exec = util_1.default.promisify(child_process_1.exec);
|
|
8
17
|
try {
|
|
9
18
|
await exec(`${packageName} --version`);
|
|
10
19
|
return true;
|
|
@@ -13,15 +22,15 @@ export async function isGloballyInstalled(packageName) {
|
|
|
13
22
|
return false;
|
|
14
23
|
}
|
|
15
24
|
}
|
|
16
|
-
|
|
17
|
-
const exec =
|
|
18
|
-
const { stdout } = await exec(`npm info ${
|
|
25
|
+
async function getLatestCliVersion() {
|
|
26
|
+
const exec = util_1.default.promisify(child_process_1.exec);
|
|
27
|
+
const { stdout } = await exec(`npm info ${package_json_1.default.name} dist-tags --json`);
|
|
19
28
|
const { latest, next } = JSON.parse(stdout);
|
|
20
29
|
return { latest, next };
|
|
21
30
|
}
|
|
22
|
-
|
|
23
|
-
const installCommand = `${DEFAULT_PACKAGE_MANAGER} install${flags ? ` ${flags}` : ''} ${packages.join(' ')}`;
|
|
24
|
-
logger.debug('Running ', installCommand);
|
|
25
|
-
const exec =
|
|
31
|
+
async function executeInstall(packages = [], flags, options) {
|
|
32
|
+
const installCommand = `${exports.DEFAULT_PACKAGE_MANAGER} install${flags ? ` ${flags}` : ''} ${packages.join(' ')}`;
|
|
33
|
+
logger_1.logger.debug('Running ', installCommand);
|
|
34
|
+
const exec = util_1.default.promisify(child_process_1.exec);
|
|
26
35
|
await exec(installCommand, options);
|
|
27
36
|
}
|
package/lib/oauth.js
CHANGED
|
@@ -1,27 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.authenticateWithOauth = authenticateWithOauth;
|
|
7
|
+
const express_1 = __importDefault(require("express"));
|
|
8
|
+
const open_1 = __importDefault(require("open"));
|
|
9
|
+
const OAuth2Manager_1 = require("@hubspot/local-dev-lib/models/OAuth2Manager");
|
|
10
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
11
|
+
const getAccountIdentifier_1 = require("@hubspot/local-dev-lib/config/getAccountIdentifier");
|
|
12
|
+
const oauth_1 = require("@hubspot/local-dev-lib/oauth");
|
|
13
|
+
const urls_1 = require("@hubspot/local-dev-lib/urls");
|
|
14
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
15
|
+
const environments_1 = require("@hubspot/local-dev-lib/constants/environments");
|
|
16
|
+
const auth_1 = require("@hubspot/local-dev-lib/constants/auth");
|
|
17
|
+
const process_1 = require("./process");
|
|
18
|
+
const lang_1 = require("./lang");
|
|
19
|
+
const exitCodes_1 = require("./enums/exitCodes");
|
|
14
20
|
const PORT = 3000;
|
|
15
21
|
const redirectUri = `http://localhost:${PORT}/oauth-callback`;
|
|
16
22
|
function buildAuthUrl(oauthManager) {
|
|
17
23
|
const { env: accountEnv, clientId, scopes: accountScopes, } = oauthManager.account;
|
|
18
|
-
const env = accountEnv || ENVIRONMENTS.PROD;
|
|
19
|
-
const scopes = accountScopes || DEFAULT_OAUTH_SCOPES;
|
|
24
|
+
const env = accountEnv || environments_1.ENVIRONMENTS.PROD;
|
|
25
|
+
const scopes = accountScopes || auth_1.DEFAULT_OAUTH_SCOPES;
|
|
20
26
|
if (!clientId) {
|
|
21
|
-
logger.error(i18n(`lib.oauth.missingClientId`));
|
|
22
|
-
process.exit(EXIT_CODES.ERROR);
|
|
27
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.oauth.missingClientId`));
|
|
28
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
23
29
|
}
|
|
24
|
-
return (`${getHubSpotWebsiteOrigin(env)}/oauth/${oauthManager.account.accountId}/authorize` +
|
|
30
|
+
return (`${(0, urls_1.getHubSpotWebsiteOrigin)(env)}/oauth/${oauthManager.account.accountId}/authorize` +
|
|
25
31
|
`?client_id=${encodeURIComponent(clientId)}` + // app's client ID
|
|
26
32
|
`&scope=${encodeURIComponent(scopes.join(' '))}` + // scopes being requested by the app
|
|
27
33
|
`&redirect_uri=${encodeURIComponent(redirectUri)}` // where to send the user after the consent page
|
|
@@ -31,16 +37,16 @@ function handleServerOnProcessEnd(server) {
|
|
|
31
37
|
const shutdownServerIfRunning = () => {
|
|
32
38
|
server?.close();
|
|
33
39
|
};
|
|
34
|
-
handleExit(shutdownServerIfRunning);
|
|
40
|
+
(0, process_1.handleExit)(shutdownServerIfRunning);
|
|
35
41
|
}
|
|
36
42
|
async function authorize(oauthManager) {
|
|
37
43
|
if (process.env.BROWSER !== 'none') {
|
|
38
|
-
|
|
44
|
+
(0, open_1.default)(buildAuthUrl(oauthManager), { url: true });
|
|
39
45
|
}
|
|
40
46
|
// eslint-disable-next-line no-async-promise-executor
|
|
41
47
|
return new Promise(async (resolve, reject) => {
|
|
42
48
|
let server;
|
|
43
|
-
const app =
|
|
49
|
+
const app = (0, express_1.default)();
|
|
44
50
|
app.get('/oauth-callback', async (req, res) => {
|
|
45
51
|
if (req.query.code) {
|
|
46
52
|
const authCodeProof = {
|
|
@@ -77,21 +83,21 @@ async function authorize(oauthManager) {
|
|
|
77
83
|
reject();
|
|
78
84
|
}
|
|
79
85
|
});
|
|
80
|
-
server = app.listen(PORT, () => logger.log(`Waiting for authorization...`));
|
|
86
|
+
server = app.listen(PORT, () => logger_1.logger.log(`Waiting for authorization...`));
|
|
81
87
|
handleServerOnProcessEnd(server);
|
|
82
88
|
});
|
|
83
89
|
}
|
|
84
90
|
function setupOauth(accountConfig) {
|
|
85
|
-
const accountId = getAccountIdentifier(accountConfig);
|
|
86
|
-
const config = getAccountConfig(accountId);
|
|
87
|
-
return new OAuth2Manager({
|
|
91
|
+
const accountId = (0, getAccountIdentifier_1.getAccountIdentifier)(accountConfig);
|
|
92
|
+
const config = (0, config_1.getAccountConfig)(accountId);
|
|
93
|
+
return new OAuth2Manager_1.OAuth2Manager({
|
|
88
94
|
...accountConfig,
|
|
89
|
-
env: accountConfig.env || config?.env || ENVIRONMENTS.PROD,
|
|
95
|
+
env: accountConfig.env || config?.env || environments_1.ENVIRONMENTS.PROD,
|
|
90
96
|
});
|
|
91
97
|
}
|
|
92
|
-
|
|
98
|
+
async function authenticateWithOauth(accountConfig) {
|
|
93
99
|
const oauthManager = setupOauth(accountConfig);
|
|
94
|
-
logger.log('Authorizing');
|
|
100
|
+
logger_1.logger.log('Authorizing');
|
|
95
101
|
await authorize(oauthManager);
|
|
96
|
-
addOauthToAccountConfig(oauthManager);
|
|
102
|
+
(0, oauth_1.addOauthToAccountConfig)(oauthManager);
|
|
97
103
|
}
|
package/lib/parsing.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseStringToNumber = parseStringToNumber;
|
|
4
|
+
const en_1 = require("../lang/en");
|
|
5
|
+
function parseStringToNumber(maybeNumber) {
|
|
3
6
|
const result = parseInt(maybeNumber, 10);
|
|
4
7
|
if (Number.isNaN(result) || !/^-?\d+$/.test(maybeNumber)) {
|
|
5
|
-
throw new Error(lib.parsing.unableToParseStringToNumber);
|
|
8
|
+
throw new Error(en_1.lib.parsing.unableToParseStringToNumber);
|
|
6
9
|
}
|
|
7
10
|
return result;
|
|
8
11
|
}
|
package/lib/polling.js
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_POLLING_STATUS_LOOKUP = exports.DEFAULT_POLLING_STATES = void 0;
|
|
4
|
+
exports.poll = poll;
|
|
5
|
+
const constants_1 = require("./constants");
|
|
6
|
+
const en_1 = require("../lang/en");
|
|
7
|
+
exports.DEFAULT_POLLING_STATES = {
|
|
4
8
|
STARTED: 'STARTED',
|
|
5
9
|
SUCCESS: 'SUCCESS',
|
|
6
10
|
ERROR: 'ERROR',
|
|
7
11
|
REVERTED: 'REVERTED',
|
|
8
12
|
FAILURE: 'FAILURE',
|
|
9
13
|
};
|
|
10
|
-
|
|
11
|
-
successStates: [DEFAULT_POLLING_STATES.SUCCESS],
|
|
14
|
+
exports.DEFAULT_POLLING_STATUS_LOOKUP = {
|
|
15
|
+
successStates: [exports.DEFAULT_POLLING_STATES.SUCCESS],
|
|
12
16
|
errorStates: [
|
|
13
|
-
DEFAULT_POLLING_STATES.ERROR,
|
|
14
|
-
DEFAULT_POLLING_STATES.REVERTED,
|
|
15
|
-
DEFAULT_POLLING_STATES.FAILURE,
|
|
17
|
+
exports.DEFAULT_POLLING_STATES.ERROR,
|
|
18
|
+
exports.DEFAULT_POLLING_STATES.REVERTED,
|
|
19
|
+
exports.DEFAULT_POLLING_STATES.FAILURE,
|
|
16
20
|
],
|
|
17
21
|
};
|
|
18
|
-
|
|
22
|
+
function poll(callback, statusLookup = exports.DEFAULT_POLLING_STATUS_LOOKUP, timeoutMs = 60000 // Default 60 second timeout
|
|
19
23
|
) {
|
|
20
24
|
return new Promise((resolve, reject) => {
|
|
21
25
|
const pollInterval = setInterval(async () => {
|
|
@@ -38,11 +42,11 @@ export function poll(callback, statusLookup = DEFAULT_POLLING_STATUS_LOOKUP, tim
|
|
|
38
42
|
clearTimeout(timeoutId);
|
|
39
43
|
reject(error);
|
|
40
44
|
}
|
|
41
|
-
}, DEFAULT_POLLING_DELAY);
|
|
45
|
+
}, constants_1.DEFAULT_POLLING_DELAY);
|
|
42
46
|
// Set a timeout to stop polling after specified duration
|
|
43
47
|
const timeoutId = setTimeout(() => {
|
|
44
48
|
clearInterval(pollInterval);
|
|
45
|
-
reject(new Error(lib.polling.timeoutError(timeoutMs)));
|
|
49
|
+
reject(new Error(en_1.lib.polling.timeoutError(timeoutMs)));
|
|
46
50
|
}, timeoutMs);
|
|
47
51
|
});
|
|
48
52
|
}
|
package/lib/process.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TERMINATION_SIGNALS = void 0;
|
|
7
|
+
exports.handleExit = handleExit;
|
|
8
|
+
exports.handleKeypress = handleKeypress;
|
|
9
|
+
const readline_1 = __importDefault(require("readline"));
|
|
10
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
11
|
+
const lang_1 = require("./lang");
|
|
12
|
+
exports.TERMINATION_SIGNALS = [
|
|
5
13
|
'beforeExit',
|
|
6
14
|
'SIGINT', // Terminal trying to interrupt (Ctrl + C)
|
|
7
15
|
'SIGUSR1', // Start Debugger User-defined signal 1
|
|
@@ -10,9 +18,9 @@ export const TERMINATION_SIGNALS = [
|
|
|
10
18
|
'SIGTERM', // Represents a graceful termination
|
|
11
19
|
'SIGHUP', // Parent terminal has been closed
|
|
12
20
|
];
|
|
13
|
-
|
|
21
|
+
function handleExit(callback) {
|
|
14
22
|
let exitInProgress = false;
|
|
15
|
-
TERMINATION_SIGNALS.forEach(signal => {
|
|
23
|
+
exports.TERMINATION_SIGNALS.forEach(signal => {
|
|
16
24
|
process.removeAllListeners(signal);
|
|
17
25
|
process.on(signal, async () => {
|
|
18
26
|
// Prevent duplicate exit handling
|
|
@@ -21,17 +29,17 @@ export function handleExit(callback) {
|
|
|
21
29
|
const isSIGHUP = signal === 'SIGHUP';
|
|
22
30
|
// Prevent logs when terminal closes
|
|
23
31
|
if (isSIGHUP) {
|
|
24
|
-
setLogLevel(LOG_LEVEL.NONE);
|
|
32
|
+
(0, logger_1.setLogLevel)(logger_1.LOG_LEVEL.NONE);
|
|
25
33
|
}
|
|
26
|
-
logger.debug(i18n(`lib.process.exitDebug`, { signal }));
|
|
34
|
+
logger_1.logger.debug((0, lang_1.i18n)(`lib.process.exitDebug`, { signal }));
|
|
27
35
|
await callback({ isSIGHUP });
|
|
28
36
|
}
|
|
29
37
|
});
|
|
30
38
|
});
|
|
31
39
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
function handleKeypress(callback) {
|
|
41
|
+
readline_1.default.createInterface(process.stdin, process.stdout);
|
|
42
|
+
readline_1.default.emitKeypressEvents(process.stdin);
|
|
35
43
|
if (process.stdin.isTTY) {
|
|
36
44
|
process.stdin.setRawMode(true);
|
|
37
45
|
}
|
package/lib/projectProfiles.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HsProfileFile } from '@hubspot/project-parsing-lib/src/lib/types
|
|
2
|
-
import { ProjectConfig } from '../types/Projects
|
|
1
|
+
import { HsProfileFile } from '@hubspot/project-parsing-lib/src/lib/types';
|
|
2
|
+
import { ProjectConfig } from '../types/Projects';
|
|
3
3
|
export declare function logProfileHeader(profileName: string): void;
|
|
4
4
|
export declare function logProfileFooter(profile: HsProfileFile, includeVariables?: boolean): void;
|
|
5
5
|
export declare function loadProfile(projectConfig: ProjectConfig | null, projectDir: string | null, profileName: string): HsProfileFile | undefined;
|