@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,35 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
4
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
5
|
+
const usageTracking_1 = require("../../lib/usageTracking");
|
|
6
|
+
const lang_1 = require("../../lib/lang");
|
|
7
|
+
const errorHandlers_1 = require("../../lib/errorHandlers");
|
|
8
|
+
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
9
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
8
10
|
const command = 'rename <account-name> <new-name>';
|
|
9
|
-
const describe = i18n(`commands.account.subcommands.rename.describe`);
|
|
11
|
+
const describe = (0, lang_1.i18n)(`commands.account.subcommands.rename.describe`);
|
|
10
12
|
async function handler(args) {
|
|
11
13
|
const { accountName, newName, derivedAccountId } = args;
|
|
12
|
-
trackCommandUsage('accounts-rename', undefined, derivedAccountId);
|
|
14
|
+
(0, usageTracking_1.trackCommandUsage)('accounts-rename', undefined, derivedAccountId);
|
|
13
15
|
try {
|
|
14
|
-
await renameAccount(accountName, newName);
|
|
16
|
+
await (0, config_1.renameAccount)(accountName, newName);
|
|
15
17
|
}
|
|
16
18
|
catch (error) {
|
|
17
|
-
logError(error);
|
|
18
|
-
process.exit(EXIT_CODES.ERROR);
|
|
19
|
+
(0, errorHandlers_1.logError)(error);
|
|
20
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
19
21
|
}
|
|
20
|
-
logger.log(i18n(`commands.account.subcommands.rename.success.renamed`, {
|
|
22
|
+
logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.rename.success.renamed`, {
|
|
21
23
|
name: accountName,
|
|
22
24
|
newName,
|
|
23
25
|
}));
|
|
24
|
-
process.exit(EXIT_CODES.SUCCESS);
|
|
26
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
25
27
|
}
|
|
26
28
|
function accountRenameBuilder(yargs) {
|
|
27
29
|
yargs.positional('account-name', {
|
|
28
|
-
describe: i18n(`commands.account.subcommands.rename.positionals.accountName.describe`),
|
|
30
|
+
describe: (0, lang_1.i18n)(`commands.account.subcommands.rename.positionals.accountName.describe`),
|
|
29
31
|
type: 'string',
|
|
30
32
|
});
|
|
31
33
|
yargs.positional('new-name', {
|
|
32
|
-
describe: i18n(`commands.account.subcommands.rename.positionals.newName.describe`),
|
|
34
|
+
describe: (0, lang_1.i18n)(`commands.account.subcommands.rename.positionals.newName.describe`),
|
|
33
35
|
type: 'string',
|
|
34
36
|
});
|
|
35
37
|
yargs.example([
|
|
@@ -37,7 +39,7 @@ function accountRenameBuilder(yargs) {
|
|
|
37
39
|
]);
|
|
38
40
|
return yargs;
|
|
39
41
|
}
|
|
40
|
-
const builder = makeYargsBuilder(accountRenameBuilder, command, describe, {
|
|
42
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(accountRenameBuilder, command, describe, {
|
|
41
43
|
useGlobalOptions: true,
|
|
42
44
|
useConfigOptions: true,
|
|
43
45
|
useAccountOptions: true,
|
|
@@ -48,4 +50,4 @@ const accountRenameCommand = {
|
|
|
48
50
|
handler,
|
|
49
51
|
builder,
|
|
50
52
|
};
|
|
51
|
-
|
|
53
|
+
exports.default = accountRenameCommand;
|
package/commands/account/use.js
CHANGED
|
@@ -1,64 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
4
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
5
|
+
const usageTracking_1 = require("../../lib/usageTracking");
|
|
6
|
+
const lang_1 = require("../../lib/lang");
|
|
7
|
+
const accountsPrompt_1 = require("../../lib/prompts/accountsPrompt");
|
|
8
|
+
const ui_1 = require("../../lib/ui");
|
|
9
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
8
10
|
const command = 'use [account]';
|
|
9
|
-
const describe = i18n('commands.account.subcommands.use.describe');
|
|
11
|
+
const describe = (0, lang_1.i18n)('commands.account.subcommands.use.describe');
|
|
10
12
|
async function handler(args) {
|
|
11
13
|
let newDefaultAccount = args.account;
|
|
12
14
|
if (!newDefaultAccount) {
|
|
13
|
-
newDefaultAccount = await selectAccountFromConfig();
|
|
15
|
+
newDefaultAccount = await (0, accountsPrompt_1.selectAccountFromConfig)();
|
|
14
16
|
}
|
|
15
|
-
else if (!getAccountId(newDefaultAccount)) {
|
|
16
|
-
logger.error(i18n('commands.account.subcommands.use.errors.accountNotFound', {
|
|
17
|
+
else if (!(0, config_1.getAccountId)(newDefaultAccount)) {
|
|
18
|
+
logger_1.logger.error((0, lang_1.i18n)('commands.account.subcommands.use.errors.accountNotFound', {
|
|
17
19
|
specifiedAccount: newDefaultAccount,
|
|
18
|
-
configPath: getConfigPath(),
|
|
20
|
+
configPath: (0, config_1.getConfigPath)(),
|
|
19
21
|
}));
|
|
20
|
-
newDefaultAccount = await selectAccountFromConfig();
|
|
22
|
+
newDefaultAccount = await (0, accountsPrompt_1.selectAccountFromConfig)();
|
|
21
23
|
}
|
|
22
|
-
trackCommandUsage('accounts-use', undefined, getAccountId(newDefaultAccount));
|
|
23
|
-
const accountOverride = getCWDAccountOverride();
|
|
24
|
-
const overrideFilePath = getDefaultAccountOverrideFilePath();
|
|
24
|
+
(0, usageTracking_1.trackCommandUsage)('accounts-use', undefined, (0, config_1.getAccountId)(newDefaultAccount));
|
|
25
|
+
const accountOverride = (0, config_1.getCWDAccountOverride)();
|
|
26
|
+
const overrideFilePath = (0, config_1.getDefaultAccountOverrideFilePath)();
|
|
25
27
|
if (accountOverride && overrideFilePath) {
|
|
26
|
-
logger.warn(i18n(`commands.account.subcommands.use.accountOverride`, {
|
|
28
|
+
logger_1.logger.warn((0, lang_1.i18n)(`commands.account.subcommands.use.accountOverride`, {
|
|
27
29
|
accountOverride,
|
|
28
30
|
}));
|
|
29
|
-
logger.log(i18n(`commands.account.subcommands.use.accountOverrideCommands`, {
|
|
30
|
-
createOverrideCommand: uiCommandReference('hs account create-override'),
|
|
31
|
-
removeOverrideCommand: uiCommandReference('hs account remove-override'),
|
|
31
|
+
logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.use.accountOverrideCommands`, {
|
|
32
|
+
createOverrideCommand: (0, ui_1.uiCommandReference)('hs account create-override'),
|
|
33
|
+
removeOverrideCommand: (0, ui_1.uiCommandReference)('hs account remove-override'),
|
|
32
34
|
}));
|
|
33
|
-
logger.log('');
|
|
35
|
+
logger_1.logger.log('');
|
|
34
36
|
}
|
|
35
|
-
updateDefaultAccount(newDefaultAccount);
|
|
36
|
-
return logger.success(i18n('commands.account.subcommands.use.success.defaultAccountUpdated', {
|
|
37
|
+
(0, config_1.updateDefaultAccount)(newDefaultAccount);
|
|
38
|
+
return logger_1.logger.success((0, lang_1.i18n)('commands.account.subcommands.use.success.defaultAccountUpdated', {
|
|
37
39
|
accountName: newDefaultAccount,
|
|
38
40
|
}));
|
|
39
41
|
}
|
|
40
42
|
function accountUseBuilder(yargs) {
|
|
41
43
|
yargs.positional('account', {
|
|
42
|
-
describe: i18n('commands.account.subcommands.use.options.account.describe'),
|
|
44
|
+
describe: (0, lang_1.i18n)('commands.account.subcommands.use.options.account.describe'),
|
|
43
45
|
type: 'string',
|
|
44
46
|
});
|
|
45
47
|
yargs.example([
|
|
46
48
|
[
|
|
47
49
|
'$0 accounts use',
|
|
48
|
-
i18n('commands.account.subcommands.use.examples.default'),
|
|
50
|
+
(0, lang_1.i18n)('commands.account.subcommands.use.examples.default'),
|
|
49
51
|
],
|
|
50
52
|
[
|
|
51
53
|
'$0 accounts use MyAccount',
|
|
52
|
-
i18n('commands.account.subcommands.use.examples.nameBased'),
|
|
54
|
+
(0, lang_1.i18n)('commands.account.subcommands.use.examples.nameBased'),
|
|
53
55
|
],
|
|
54
56
|
[
|
|
55
57
|
'$0 accounts use 1234567',
|
|
56
|
-
i18n('commands.account.subcommands.use.examples.idBased'),
|
|
58
|
+
(0, lang_1.i18n)('commands.account.subcommands.use.examples.idBased'),
|
|
57
59
|
],
|
|
58
60
|
]);
|
|
59
61
|
return yargs;
|
|
60
62
|
}
|
|
61
|
-
const builder = makeYargsBuilder(accountUseBuilder, command, describe, {
|
|
63
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(accountUseBuilder, command, describe, {
|
|
62
64
|
useGlobalOptions: true,
|
|
63
65
|
});
|
|
64
66
|
const accountUseCommand = {
|
|
@@ -67,4 +69,4 @@ const accountUseCommand = {
|
|
|
67
69
|
handler,
|
|
68
70
|
builder,
|
|
69
71
|
};
|
|
70
|
-
|
|
72
|
+
exports.default = accountUseCommand;
|
package/commands/account.d.ts
CHANGED
package/commands/account.js
CHANGED
|
@@ -1,35 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const lang_1 = require("../lib/lang");
|
|
7
|
+
const auth_1 = __importDefault(require("./account/auth"));
|
|
8
|
+
const list_1 = __importDefault(require("./account/list"));
|
|
9
|
+
const rename_1 = __importDefault(require("./account/rename"));
|
|
10
|
+
const use_1 = __importDefault(require("./account/use"));
|
|
11
|
+
const info_1 = __importDefault(require("./account/info"));
|
|
12
|
+
const remove_1 = __importDefault(require("./account/remove"));
|
|
13
|
+
const clean_1 = __importDefault(require("./account/clean"));
|
|
14
|
+
const createOverride_1 = __importDefault(require("./account/createOverride"));
|
|
15
|
+
const removeOverride_1 = __importDefault(require("./account/removeOverride"));
|
|
16
|
+
const yargsUtils_1 = require("../lib/yargsUtils");
|
|
12
17
|
const command = ['account', 'accounts'];
|
|
13
|
-
const describe = i18n('commands.account.describe');
|
|
18
|
+
const describe = (0, lang_1.i18n)('commands.account.describe');
|
|
14
19
|
function accountBuilder(yargs) {
|
|
15
20
|
yargs
|
|
16
|
-
.command(
|
|
17
|
-
.command(
|
|
18
|
-
.command(
|
|
19
|
-
.command(
|
|
20
|
-
.command(
|
|
21
|
-
.command(
|
|
22
|
-
.command(
|
|
23
|
-
.command(
|
|
24
|
-
.command(
|
|
21
|
+
.command(auth_1.default)
|
|
22
|
+
.command(list_1.default)
|
|
23
|
+
.command(rename_1.default)
|
|
24
|
+
.command(use_1.default)
|
|
25
|
+
.command(info_1.default)
|
|
26
|
+
.command(remove_1.default)
|
|
27
|
+
.command(clean_1.default)
|
|
28
|
+
.command(createOverride_1.default)
|
|
29
|
+
.command(removeOverride_1.default)
|
|
25
30
|
.demandCommand(1, '');
|
|
26
31
|
return yargs;
|
|
27
32
|
}
|
|
28
|
-
const builder = makeYargsBuilder(accountBuilder, command, describe);
|
|
33
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(accountBuilder, command, describe);
|
|
29
34
|
const accountCommand = {
|
|
30
35
|
command,
|
|
31
36
|
describe,
|
|
32
37
|
builder,
|
|
33
38
|
handler: () => { },
|
|
34
39
|
};
|
|
35
|
-
|
|
40
|
+
exports.default = accountCommand;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const yargs_1 = __importDefault(require("yargs"));
|
|
7
|
+
const commonOpts_1 = require("../../../lib/commonOpts");
|
|
8
|
+
const install_1 = __importDefault(require("../install"));
|
|
9
|
+
vi.mock('../../../lib/commonOpts');
|
|
10
|
+
describe('commands/app/install', () => {
|
|
11
|
+
const yargsMock = yargs_1.default;
|
|
12
|
+
describe('command', () => {
|
|
13
|
+
it('should have the correct command structure', () => {
|
|
14
|
+
expect(install_1.default.command).toEqual('install <test-account-id>');
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
describe('describe', () => {
|
|
18
|
+
it('should provide a description', () => {
|
|
19
|
+
expect(install_1.default.describe).not.toBeDefined();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
describe('builder', () => {
|
|
23
|
+
it('should support the correct options', () => {
|
|
24
|
+
install_1.default.builder(yargsMock);
|
|
25
|
+
expect(commonOpts_1.addGlobalOptions).toHaveBeenCalledTimes(1);
|
|
26
|
+
expect(commonOpts_1.addGlobalOptions).toHaveBeenCalledWith(yargsMock);
|
|
27
|
+
expect(commonOpts_1.addAccountOptions).toHaveBeenCalledTimes(1);
|
|
28
|
+
expect(commonOpts_1.addAccountOptions).toHaveBeenCalledWith(yargsMock);
|
|
29
|
+
expect(commonOpts_1.addConfigOptions).toHaveBeenCalledTimes(1);
|
|
30
|
+
expect(commonOpts_1.addConfigOptions).toHaveBeenCalledWith(yargsMock);
|
|
31
|
+
expect(commonOpts_1.addUseEnvironmentOptions).toHaveBeenCalledTimes(1);
|
|
32
|
+
expect(commonOpts_1.addUseEnvironmentOptions).toHaveBeenCalledWith(yargsMock);
|
|
33
|
+
expect(commonOpts_1.addJSONOutputOptions).toHaveBeenCalledTimes(1);
|
|
34
|
+
expect(commonOpts_1.addJSONOutputOptions).toHaveBeenCalledWith(yargsMock);
|
|
35
|
+
expect(yargsMock.positional).toHaveBeenCalledTimes(1);
|
|
36
|
+
expect(yargsMock.positional).toHaveBeenCalledWith('test-account-id', expect.objectContaining({
|
|
37
|
+
type: 'number',
|
|
38
|
+
required: true,
|
|
39
|
+
describe: expect.any(String),
|
|
40
|
+
}));
|
|
41
|
+
expect(yargsMock.option).toHaveBeenCalledTimes(2);
|
|
42
|
+
expect(yargsMock.option).toHaveBeenCalledWith('app-uid', expect.objectContaining({
|
|
43
|
+
type: 'string',
|
|
44
|
+
describe: expect.any(String),
|
|
45
|
+
}));
|
|
46
|
+
expect(yargsMock.option).toHaveBeenCalledWith('project-name', expect.objectContaining({
|
|
47
|
+
type: 'string',
|
|
48
|
+
describe: expect.any(String),
|
|
49
|
+
}));
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const yargs_1 = __importDefault(require("yargs"));
|
|
7
|
+
const projects_1 = require("@hubspot/local-dev-lib/constants/projects");
|
|
8
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
9
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
10
|
+
const migrate_1 = require("../../../lib/app/migrate");
|
|
11
|
+
const migrate_legacy_1 = require("../../../lib/app/migrate_legacy");
|
|
12
|
+
const exitCodes_1 = require("../../../lib/enums/exitCodes");
|
|
13
|
+
const migrate_2 = __importDefault(require("../migrate"));
|
|
9
14
|
vi.mock('@hubspot/local-dev-lib/config');
|
|
10
15
|
vi.mock('@hubspot/local-dev-lib/logger');
|
|
11
16
|
vi.mock('../../../lib/app/migrate');
|
|
12
17
|
vi.mock('../../../lib/app/migrate_legacy');
|
|
13
|
-
const mockYargs =
|
|
14
|
-
const mockedGetAccountConfig = getAccountConfig;
|
|
15
|
-
const mockedMigrateApp2023_2 = migrateApp2023_2;
|
|
16
|
-
const mockedMigrateApp2025_2 = migrateApp2025_2;
|
|
17
|
-
const mockedLogger = logger;
|
|
18
|
+
const mockYargs = yargs_1.default;
|
|
19
|
+
const mockedGetAccountConfig = config_1.getAccountConfig;
|
|
20
|
+
const mockedMigrateApp2023_2 = migrate_legacy_1.migrateApp2023_2;
|
|
21
|
+
const mockedMigrateApp2025_2 = migrate_1.migrateApp2025_2;
|
|
22
|
+
const mockedLogger = logger_1.logger;
|
|
18
23
|
const optionsSpy = vi.spyOn(mockYargs, 'options');
|
|
19
24
|
const exampleSpy = vi.spyOn(mockYargs, 'example');
|
|
20
25
|
const exitSpy = vi
|
|
@@ -36,56 +41,56 @@ describe('commands/app/migrate', () => {
|
|
|
36
41
|
describe('handler', () => {
|
|
37
42
|
it('should exit with error when no account config is found', async () => {
|
|
38
43
|
mockedGetAccountConfig.mockReturnValue(null);
|
|
39
|
-
await
|
|
44
|
+
await migrate_2.default.handler({
|
|
40
45
|
derivedAccountId: mockAccountId,
|
|
41
46
|
});
|
|
42
47
|
expect(mockedLogger.error).toHaveBeenCalled();
|
|
43
|
-
expect(exitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
48
|
+
expect(exitSpy).toHaveBeenCalledWith(exitCodes_1.EXIT_CODES.ERROR);
|
|
44
49
|
});
|
|
45
50
|
it('should call migrateApp2025_2 for platform version 2025.2', async () => {
|
|
46
51
|
const options = {
|
|
47
52
|
derivedAccountId: mockAccountId,
|
|
48
|
-
platformVersion: PLATFORM_VERSIONS.v2025_2,
|
|
53
|
+
platformVersion: projects_1.PLATFORM_VERSIONS.v2025_2,
|
|
49
54
|
};
|
|
50
|
-
await
|
|
55
|
+
await migrate_2.default.handler(options);
|
|
51
56
|
expect(mockedMigrateApp2025_2).toHaveBeenCalledWith(mockAccountId, options);
|
|
52
57
|
expect(mockedMigrateApp2023_2).not.toHaveBeenCalled();
|
|
53
|
-
expect(exitSpy).toHaveBeenCalledWith(EXIT_CODES.SUCCESS);
|
|
58
|
+
expect(exitSpy).toHaveBeenCalledWith(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
54
59
|
});
|
|
55
60
|
it('should call migrateApp2025_2 when unstable is true', async () => {
|
|
56
61
|
const options = {
|
|
57
62
|
derivedAccountId: mockAccountId,
|
|
58
63
|
unstable: true,
|
|
59
64
|
};
|
|
60
|
-
await
|
|
65
|
+
await migrate_2.default.handler(options);
|
|
61
66
|
expect(mockedMigrateApp2025_2).toHaveBeenCalledWith(mockAccountId, options);
|
|
62
67
|
expect(mockedMigrateApp2023_2).not.toHaveBeenCalled();
|
|
63
|
-
expect(exitSpy).toHaveBeenCalledWith(EXIT_CODES.SUCCESS);
|
|
68
|
+
expect(exitSpy).toHaveBeenCalledWith(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
64
69
|
});
|
|
65
70
|
it('should call migrateApp2023_2 for platform version 2023.2', async () => {
|
|
66
71
|
const options = {
|
|
67
72
|
derivedAccountId: mockAccountId,
|
|
68
|
-
platformVersion: PLATFORM_VERSIONS.v2023_2,
|
|
73
|
+
platformVersion: projects_1.PLATFORM_VERSIONS.v2023_2,
|
|
69
74
|
};
|
|
70
|
-
await
|
|
75
|
+
await migrate_2.default.handler(options);
|
|
71
76
|
expect(mockedMigrateApp2023_2).toHaveBeenCalledWith(mockAccountId, options, mockAccountConfig);
|
|
72
77
|
expect(mockedMigrateApp2025_2).not.toHaveBeenCalled();
|
|
73
|
-
expect(exitSpy).toHaveBeenCalledWith(EXIT_CODES.SUCCESS);
|
|
78
|
+
expect(exitSpy).toHaveBeenCalledWith(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
74
79
|
});
|
|
75
80
|
it('should handle errors during migration', async () => {
|
|
76
81
|
const mockError = new Error('Migration failed');
|
|
77
82
|
mockedMigrateApp2023_2.mockRejectedValue(mockError);
|
|
78
|
-
await
|
|
83
|
+
await migrate_2.default.handler({
|
|
79
84
|
derivedAccountId: mockAccountId,
|
|
80
|
-
platformVersion: PLATFORM_VERSIONS.v2023_2,
|
|
85
|
+
platformVersion: projects_1.PLATFORM_VERSIONS.v2023_2,
|
|
81
86
|
});
|
|
82
87
|
expect(mockedLogger.error).toHaveBeenCalled();
|
|
83
|
-
expect(exitSpy).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
88
|
+
expect(exitSpy).toHaveBeenCalledWith(exitCodes_1.EXIT_CODES.ERROR);
|
|
84
89
|
});
|
|
85
90
|
});
|
|
86
91
|
describe('builder', () => {
|
|
87
92
|
it('should add required options', async () => {
|
|
88
|
-
await
|
|
93
|
+
await migrate_2.default.builder(mockYargs);
|
|
89
94
|
expect(optionsSpy).toHaveBeenCalledWith(expect.objectContaining({
|
|
90
95
|
name: expect.objectContaining({
|
|
91
96
|
type: 'string',
|
|
@@ -107,7 +112,7 @@ describe('commands/app/migrate', () => {
|
|
|
107
112
|
}));
|
|
108
113
|
});
|
|
109
114
|
it('should set default platform version to 2025.2', async () => {
|
|
110
|
-
await
|
|
115
|
+
await migrate_2.default.builder(mockYargs);
|
|
111
116
|
expect(optionsSpy).toHaveBeenCalledWith(expect.objectContaining({
|
|
112
117
|
'platform-version': expect.objectContaining({
|
|
113
118
|
default: '2025.2',
|
|
@@ -115,7 +120,7 @@ describe('commands/app/migrate', () => {
|
|
|
115
120
|
}));
|
|
116
121
|
});
|
|
117
122
|
it('should add example command', async () => {
|
|
118
|
-
await
|
|
123
|
+
await migrate_2.default.builder(mockYargs);
|
|
119
124
|
expect(exampleSpy).toHaveBeenCalledWith([
|
|
120
125
|
['$0 app migrate', expect.any(String)],
|
|
121
126
|
]);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, YargsCommandModule, JSONOutputArgs } from '../../types/Yargs';
|
|
2
|
+
type InstallAppArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & JSONOutputArgs & {
|
|
3
|
+
appUid?: string;
|
|
4
|
+
projectName?: string;
|
|
5
|
+
testAccountId: number;
|
|
6
|
+
};
|
|
7
|
+
declare const installAppCommand: YargsCommandModule<unknown, InstallAppArgs>;
|
|
8
|
+
export default installAppCommand;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const developerTestAccounts_1 = require("@hubspot/local-dev-lib/api/developerTestAccounts");
|
|
7
|
+
const usageTracking_1 = require("../../lib/usageTracking");
|
|
8
|
+
const en_1 = require("../../lang/en");
|
|
9
|
+
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
10
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
11
|
+
const constants_1 = require("../../lib/constants");
|
|
12
|
+
const logger_1 = require("../../lib/ui/logger");
|
|
13
|
+
const SpinniesManager_1 = __importDefault(require("../../lib/ui/SpinniesManager"));
|
|
14
|
+
const errorHandlers_1 = require("../../lib/errorHandlers");
|
|
15
|
+
const polling_1 = require("../../lib/polling");
|
|
16
|
+
const config_1 = require("../../lib/projects/config");
|
|
17
|
+
const upload_1 = require("../../lib/projects/upload");
|
|
18
|
+
const structure_1 = require("../../lib/projects/structure");
|
|
19
|
+
const command = 'install <test-account-id>';
|
|
20
|
+
const describe = undefined; // commands.app.subcommands.install.describe;
|
|
21
|
+
async function handler(args) {
|
|
22
|
+
const { derivedAccountId, appUid, projectName, testAccountId, formatOutputAsJson, } = args;
|
|
23
|
+
(0, usageTracking_1.trackCommandUsage)('app-install', {}, derivedAccountId);
|
|
24
|
+
const jsonOutput = {};
|
|
25
|
+
let targetProjectName = projectName;
|
|
26
|
+
let targetAppUid = appUid;
|
|
27
|
+
const { projectConfig, projectDir } = await (0, config_1.getProjectConfig)();
|
|
28
|
+
if (!targetProjectName) {
|
|
29
|
+
(0, config_1.validateProjectConfig)(projectConfig, projectDir);
|
|
30
|
+
targetProjectName = projectConfig?.name;
|
|
31
|
+
}
|
|
32
|
+
if (!targetProjectName) {
|
|
33
|
+
logger_1.uiLogger.error(en_1.commands.app.subcommands.install.errors.mustSpecifyProjectName);
|
|
34
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
35
|
+
}
|
|
36
|
+
let isAppOauth = true;
|
|
37
|
+
if (!targetAppUid) {
|
|
38
|
+
const intermediateRepresentation = await (0, upload_1.handleTranslate)(projectDir, projectConfig, derivedAccountId, true, undefined);
|
|
39
|
+
if (intermediateRepresentation) {
|
|
40
|
+
Object.values(intermediateRepresentation.intermediateNodesIndexedByUid).forEach(node => {
|
|
41
|
+
if ((0, structure_1.isAppIRNode)(node)) {
|
|
42
|
+
targetAppUid = node.uid;
|
|
43
|
+
isAppOauth = node.config.auth.type === constants_1.APP_AUTH_TYPES.OAUTH;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (!targetAppUid) {
|
|
49
|
+
logger_1.uiLogger.error(en_1.commands.app.subcommands.install.errors.noAppUidFound);
|
|
50
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
51
|
+
}
|
|
52
|
+
if (!isAppOauth) {
|
|
53
|
+
logger_1.uiLogger.error(en_1.commands.app.subcommands.install.errors.appMustBeOauth);
|
|
54
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
const { data } = await (0, developerTestAccounts_1.installOauthAppIntoDeveloperTestAccount)(derivedAccountId, testAccountId, targetProjectName, targetAppUid);
|
|
58
|
+
if (data?.authCodes.length > 0) {
|
|
59
|
+
jsonOutput.authCode = data.authCodes[0].authCode;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
(0, errorHandlers_1.logError)(err);
|
|
64
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
65
|
+
}
|
|
66
|
+
SpinniesManager_1.default.init({
|
|
67
|
+
succeedColor: 'white',
|
|
68
|
+
});
|
|
69
|
+
SpinniesManager_1.default.add('installApp', {
|
|
70
|
+
text: en_1.commands.app.subcommands.install.polling.start,
|
|
71
|
+
});
|
|
72
|
+
let appInstallSucceeded = false;
|
|
73
|
+
try {
|
|
74
|
+
await (0, polling_1.poll)(() => (0, developerTestAccounts_1.fetchDeveloperTestAccountOauthAppInstallStatus)(derivedAccountId, targetProjectName, targetAppUid), {
|
|
75
|
+
successStates: ['SUCCESS'],
|
|
76
|
+
errorStates: [],
|
|
77
|
+
});
|
|
78
|
+
appInstallSucceeded = true;
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
SpinniesManager_1.default.fail('installApp');
|
|
82
|
+
(0, errorHandlers_1.logError)(err);
|
|
83
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
84
|
+
}
|
|
85
|
+
if (!appInstallSucceeded) {
|
|
86
|
+
SpinniesManager_1.default.fail('installApp');
|
|
87
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
88
|
+
}
|
|
89
|
+
SpinniesManager_1.default.succeed('installApp', {
|
|
90
|
+
text: en_1.commands.app.subcommands.install.polling.success,
|
|
91
|
+
});
|
|
92
|
+
if (formatOutputAsJson) {
|
|
93
|
+
logger_1.uiLogger.json(jsonOutput);
|
|
94
|
+
}
|
|
95
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
96
|
+
}
|
|
97
|
+
function installAppBuilder(yargs) {
|
|
98
|
+
yargs.positional('test-account-id', {
|
|
99
|
+
describe: en_1.commands.app.subcommands.install.positionals.testAccountId,
|
|
100
|
+
required: true,
|
|
101
|
+
type: 'number',
|
|
102
|
+
});
|
|
103
|
+
yargs.option('app-uid', {
|
|
104
|
+
describe: en_1.commands.app.subcommands.install.options.appUid,
|
|
105
|
+
type: 'string',
|
|
106
|
+
});
|
|
107
|
+
yargs.option('project-name', {
|
|
108
|
+
describe: en_1.commands.app.subcommands.install.options.projectName,
|
|
109
|
+
type: 'string',
|
|
110
|
+
});
|
|
111
|
+
yargs.example('install 1234567890 --app-uid=my-app-uid --project-name=my-project', en_1.commands.app.subcommands.install.example);
|
|
112
|
+
return yargs;
|
|
113
|
+
}
|
|
114
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(installAppBuilder, command, en_1.commands.app.subcommands.install.describe, {
|
|
115
|
+
useGlobalOptions: true,
|
|
116
|
+
useAccountOptions: true,
|
|
117
|
+
useConfigOptions: true,
|
|
118
|
+
useEnvironmentOptions: true,
|
|
119
|
+
useJSONOutputOptions: true,
|
|
120
|
+
});
|
|
121
|
+
const installAppCommand = {
|
|
122
|
+
command,
|
|
123
|
+
describe,
|
|
124
|
+
handler,
|
|
125
|
+
builder,
|
|
126
|
+
};
|
|
127
|
+
exports.default = installAppCommand;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ArgumentsCamelCase } from 'yargs';
|
|
2
|
-
import { YargsCommandModule } from '../../types/Yargs
|
|
3
|
-
import { MigrateAppArgs } from '../../lib/app/migrate
|
|
2
|
+
import { YargsCommandModule } from '../../types/Yargs';
|
|
3
|
+
import { MigrateAppArgs } from '../../lib/app/migrate';
|
|
4
4
|
export declare function handlerGenerator(commandTrackingName: string): (args: ArgumentsCamelCase<MigrateAppArgs>) => Promise<void>;
|
|
5
5
|
declare const migrateCommand: YargsCommandModule<unknown, MigrateAppArgs>;
|
|
6
6
|
export default migrateCommand;
|