@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,19 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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.pollDeployStatus = exports.pollBuildStatus = void 0;
|
|
7
|
+
exports.useV3Api = useV3Api;
|
|
8
|
+
exports.displayWarnLogs = displayWarnLogs;
|
|
9
|
+
exports.pollProjectBuildAndDeploy = pollProjectBuildAndDeploy;
|
|
10
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
+
const projects_1 = require("@hubspot/local-dev-lib/api/projects");
|
|
12
|
+
const constants_1 = require("../constants");
|
|
13
|
+
const SpinniesManager_1 = __importDefault(require("../ui/SpinniesManager"));
|
|
14
|
+
const errorHandlers_1 = require("../errorHandlers");
|
|
15
|
+
const ui_1 = require("../ui");
|
|
16
|
+
const urls_1 = require("./urls");
|
|
17
|
+
const exitCodes_1 = require("../enums/exitCodes");
|
|
18
|
+
const en_1 = require("../../lang/en");
|
|
19
|
+
const logger_1 = require("../ui/logger");
|
|
20
|
+
const constants_2 = require("@hubspot/project-parsing-lib/src/lib/constants");
|
|
21
|
+
const project_parsing_lib_1 = require("@hubspot/project-parsing-lib");
|
|
13
22
|
const SPINNER_STATUS = {
|
|
14
23
|
SPINNING: 'spinning',
|
|
15
24
|
};
|
|
16
|
-
|
|
25
|
+
function useV3Api(platformVersion) {
|
|
17
26
|
if (!platformVersion || typeof platformVersion !== 'string') {
|
|
18
27
|
return false;
|
|
19
28
|
}
|
|
@@ -42,22 +51,22 @@ function getSubtaskType(task) {
|
|
|
42
51
|
return task.deployType;
|
|
43
52
|
}
|
|
44
53
|
function handleTaskStatusError(statusText) {
|
|
45
|
-
uiLogger.error(lib.projectBuildAndDeploy.makePollTaskStatusFunc.errorFetchingTaskStatus(statusText.TYPE_KEY === PROJECT_BUILD_TEXT.TYPE_KEY ? 'build' : 'deploy'));
|
|
46
|
-
process.exit(EXIT_CODES.ERROR);
|
|
54
|
+
logger_1.uiLogger.error(en_1.lib.projectBuildAndDeploy.makePollTaskStatusFunc.errorFetchingTaskStatus(statusText.TYPE_KEY === constants_1.PROJECT_BUILD_TEXT.TYPE_KEY ? 'build' : 'deploy'));
|
|
55
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
47
56
|
}
|
|
48
57
|
function makePollTaskStatusFunc({ statusFn, structureFn, statusText, statusStrings, linkToHubSpot, }) {
|
|
49
58
|
return async function (accountId, taskName, taskId, deployedBuildId, silenceLogs = false) {
|
|
50
59
|
const displayId = deployedBuildId || taskId;
|
|
51
60
|
if (linkToHubSpot && !silenceLogs) {
|
|
52
|
-
uiLogger.log(`\n${linkToHubSpot(accountId, taskName, taskId, deployedBuildId)}\n`);
|
|
61
|
+
logger_1.uiLogger.log(`\n${linkToHubSpot(accountId, taskName, taskId, deployedBuildId)}\n`);
|
|
53
62
|
}
|
|
54
|
-
|
|
63
|
+
SpinniesManager_1.default.init();
|
|
55
64
|
const overallTaskSpinniesKey = `overallTaskStatus-${statusText.STATUS_TEXT}`;
|
|
56
|
-
|
|
65
|
+
SpinniesManager_1.default.add(overallTaskSpinniesKey, {
|
|
57
66
|
text: 'Beginning',
|
|
58
67
|
succeedColor: 'white',
|
|
59
68
|
failColor: 'white',
|
|
60
|
-
failPrefix:
|
|
69
|
+
failPrefix: chalk_1.default.bold('!'),
|
|
61
70
|
});
|
|
62
71
|
const [{ data: initialTaskStatus }, { data: { topLevelComponentsWithChildren: taskStructure }, },] = await Promise.all([
|
|
63
72
|
statusFn(accountId, taskName, taskId),
|
|
@@ -68,7 +77,7 @@ function makePollTaskStatusFunc({ statusFn, structureFn, statusText, statusStrin
|
|
|
68
77
|
const tasksById = subtasks
|
|
69
78
|
.filter(subtask => {
|
|
70
79
|
// TODO: Remove this filtering logic when visible=false for SERVERLESS_PACKAGE
|
|
71
|
-
const shouldBeVisible = getSubtaskType(subtask) !== mapToInternalType(AppFunctionsPackageKey);
|
|
80
|
+
const shouldBeVisible = getSubtaskType(subtask) !== (0, project_parsing_lib_1.mapToInternalType)(constants_2.AppFunctionsPackageKey);
|
|
72
81
|
if (!shouldBeVisible) {
|
|
73
82
|
hiddenComponentBuildIds.push(subtask.id);
|
|
74
83
|
}
|
|
@@ -96,21 +105,21 @@ function makePollTaskStatusFunc({ statusFn, structureFn, statusText, statusStrin
|
|
|
96
105
|
const componentCountText = silenceLogs
|
|
97
106
|
? ''
|
|
98
107
|
: numComponents === 1
|
|
99
|
-
? lib.projectBuildAndDeploy.makePollTaskStatusFunc
|
|
108
|
+
? en_1.lib.projectBuildAndDeploy.makePollTaskStatusFunc
|
|
100
109
|
.componentCountSingular
|
|
101
|
-
: lib.projectBuildAndDeploy.makePollTaskStatusFunc.componentCount(numComponents);
|
|
102
|
-
|
|
110
|
+
: en_1.lib.projectBuildAndDeploy.makePollTaskStatusFunc.componentCount(numComponents);
|
|
111
|
+
SpinniesManager_1.default.update(overallTaskSpinniesKey, {
|
|
103
112
|
text: `${statusStrings.INITIALIZE(taskName, displayId)}\n${componentCountText}`,
|
|
104
113
|
});
|
|
105
114
|
if (!silenceLogs) {
|
|
106
115
|
function addTaskSpinner(subtask, indent, newline) {
|
|
107
116
|
const taskName = getSubtaskName(subtask);
|
|
108
117
|
const taskType = getSubtaskType(subtask);
|
|
109
|
-
const formattedTaskType = PROJECT_TASK_TYPES[taskType]
|
|
110
|
-
? `[${PROJECT_TASK_TYPES[taskType]}]`
|
|
118
|
+
const formattedTaskType = constants_1.PROJECT_TASK_TYPES[taskType]
|
|
119
|
+
? `[${constants_1.PROJECT_TASK_TYPES[taskType]}]`
|
|
111
120
|
: '';
|
|
112
|
-
const text = `${indent <= 2 ? statusText.STATUS_TEXT : ''} ${
|
|
113
|
-
|
|
121
|
+
const text = `${indent <= 2 ? statusText.STATUS_TEXT : ''} ${chalk_1.default.bold(taskName)} ${formattedTaskType} ...${newline ? '\n' : ''}`;
|
|
122
|
+
SpinniesManager_1.default.add(subtask.id, {
|
|
114
123
|
text,
|
|
115
124
|
indent,
|
|
116
125
|
succeedColor: 'white',
|
|
@@ -130,8 +139,8 @@ function makePollTaskStatusFunc({ statusFn, structureFn, statusText, statusStrin
|
|
|
130
139
|
taskStatus = data;
|
|
131
140
|
}
|
|
132
141
|
catch (e) {
|
|
133
|
-
uiLogger.debug(e);
|
|
134
|
-
logError(e, new ApiErrorContext({
|
|
142
|
+
logger_1.uiLogger.debug(e);
|
|
143
|
+
(0, errorHandlers_1.logError)(e, new errorHandlers_1.ApiErrorContext({
|
|
135
144
|
accountId,
|
|
136
145
|
projectName: taskName,
|
|
137
146
|
}));
|
|
@@ -142,10 +151,10 @@ function makePollTaskStatusFunc({ statusFn, structureFn, statusText, statusStrin
|
|
|
142
151
|
handleTaskStatusError(statusText);
|
|
143
152
|
}
|
|
144
153
|
const { status } = taskStatus;
|
|
145
|
-
if (
|
|
154
|
+
if (SpinniesManager_1.default.hasActiveSpinners()) {
|
|
146
155
|
subtasks.forEach(subtask => {
|
|
147
156
|
const { id, status } = subtask;
|
|
148
|
-
const spinner =
|
|
157
|
+
const spinner = SpinniesManager_1.default.pick(id);
|
|
149
158
|
if (!spinner || spinner.status !== SPINNER_STATUS.SPINNING) {
|
|
150
159
|
return;
|
|
151
160
|
}
|
|
@@ -153,54 +162,54 @@ function makePollTaskStatusFunc({ statusFn, structureFn, statusText, statusStrin
|
|
|
153
162
|
if (status === statusText.STATES.SUCCESS ||
|
|
154
163
|
status === statusText.STATES.FAILURE) {
|
|
155
164
|
const taskStatusText = subtask.status === statusText.STATES.SUCCESS
|
|
156
|
-
? lib.projectBuildAndDeploy.makePollTaskStatusFunc
|
|
165
|
+
? en_1.lib.projectBuildAndDeploy.makePollTaskStatusFunc
|
|
157
166
|
.successStatusText
|
|
158
|
-
: lib.projectBuildAndDeploy.makePollTaskStatusFunc
|
|
167
|
+
: en_1.lib.projectBuildAndDeploy.makePollTaskStatusFunc
|
|
159
168
|
.failedStatusText;
|
|
160
169
|
const hasNewline = spinner?.text?.includes('\n') || Boolean(topLevelTask);
|
|
161
170
|
const updatedText = `${spinner?.text?.replace('\n', '')} ${taskStatusText}${hasNewline ? '\n' : ''}`;
|
|
162
171
|
if (status === statusText.STATES.SUCCESS) {
|
|
163
|
-
|
|
172
|
+
SpinniesManager_1.default.succeed(id, { text: updatedText });
|
|
164
173
|
}
|
|
165
174
|
else {
|
|
166
|
-
|
|
175
|
+
SpinniesManager_1.default.fail(id, { text: updatedText });
|
|
167
176
|
}
|
|
168
177
|
if (topLevelTask) {
|
|
169
|
-
topLevelTask.subtasks.forEach(currentSubtask =>
|
|
178
|
+
topLevelTask.subtasks.forEach(currentSubtask => SpinniesManager_1.default.remove(currentSubtask.id));
|
|
170
179
|
}
|
|
171
180
|
}
|
|
172
181
|
});
|
|
173
182
|
if (status === statusText.STATES.SUCCESS) {
|
|
174
|
-
|
|
183
|
+
SpinniesManager_1.default.succeed(overallTaskSpinniesKey, {
|
|
175
184
|
text: statusStrings.SUCCESS(taskName, displayId),
|
|
176
185
|
});
|
|
177
186
|
clearInterval(pollInterval);
|
|
178
187
|
resolve(taskStatus);
|
|
179
188
|
}
|
|
180
189
|
else if (status === statusText.STATES.FAILURE) {
|
|
181
|
-
|
|
190
|
+
SpinniesManager_1.default.fail(overallTaskSpinniesKey, {
|
|
182
191
|
text: statusStrings.FAIL(taskName, displayId),
|
|
183
192
|
});
|
|
184
193
|
if (!silenceLogs) {
|
|
185
194
|
const failedSubtasks = subtasks.filter(subtask => subtask.status === 'FAILURE');
|
|
186
|
-
uiLine();
|
|
187
|
-
uiLogger.log(`${statusStrings.SUBTASK_FAIL(failedSubtasks.length === 1
|
|
195
|
+
(0, ui_1.uiLine)();
|
|
196
|
+
logger_1.uiLogger.log(`${statusStrings.SUBTASK_FAIL(failedSubtasks.length === 1
|
|
188
197
|
? getSubtaskName(failedSubtasks[0])
|
|
189
198
|
: failedSubtasks.length + ' components', displayId)}\n`);
|
|
190
|
-
uiLogger.log(lib.projectBuildAndDeploy.makePollTaskStatusFunc.errorSummary);
|
|
191
|
-
uiLine();
|
|
199
|
+
logger_1.uiLogger.log(en_1.lib.projectBuildAndDeploy.makePollTaskStatusFunc.errorSummary);
|
|
200
|
+
(0, ui_1.uiLine)();
|
|
192
201
|
const displayErrors = failedSubtasks.filter(subtask => subtask?.standardError?.subCategory !==
|
|
193
|
-
PROJECT_ERROR_TYPES.SUBBUILD_FAILED &&
|
|
202
|
+
constants_1.PROJECT_ERROR_TYPES.SUBBUILD_FAILED &&
|
|
194
203
|
subtask?.standardError?.subCategory !==
|
|
195
|
-
PROJECT_ERROR_TYPES.SUBDEPLOY_FAILED);
|
|
204
|
+
constants_1.PROJECT_ERROR_TYPES.SUBDEPLOY_FAILED);
|
|
196
205
|
displayErrors.forEach(subTask => {
|
|
197
|
-
uiLogger.log(`\n--- ${
|
|
198
|
-
uiLogger.error(subTask.errorMessage);
|
|
206
|
+
logger_1.uiLogger.log(`\n--- ${chalk_1.default.bold(getSubtaskName(subTask))} failed with the following error ---`);
|
|
207
|
+
logger_1.uiLogger.error(subTask.errorMessage);
|
|
199
208
|
// Log nested errors
|
|
200
209
|
if (subTask.standardError && subTask.standardError.errors) {
|
|
201
|
-
uiLogger.log('');
|
|
210
|
+
logger_1.uiLogger.log('');
|
|
202
211
|
subTask.standardError.errors.forEach(error => {
|
|
203
|
-
uiLogger.log(error.message);
|
|
212
|
+
logger_1.uiLogger.log(error.message);
|
|
204
213
|
});
|
|
205
214
|
}
|
|
206
215
|
});
|
|
@@ -213,25 +222,25 @@ function makePollTaskStatusFunc({ statusFn, structureFn, statusText, statusStrin
|
|
|
213
222
|
resolve(taskStatus);
|
|
214
223
|
}
|
|
215
224
|
}
|
|
216
|
-
}, DEFAULT_POLLING_DELAY);
|
|
225
|
+
}, constants_1.DEFAULT_POLLING_DELAY);
|
|
217
226
|
});
|
|
218
227
|
};
|
|
219
228
|
}
|
|
220
229
|
function pollBuildAutodeployStatus(accountId, taskName, buildId) {
|
|
221
230
|
return new Promise((resolve, reject) => {
|
|
222
|
-
let maxIntervals = (15 * 1000) / DEFAULT_POLLING_DELAY; // Num of intervals in ~15s
|
|
231
|
+
let maxIntervals = (15 * 1000) / constants_1.DEFAULT_POLLING_DELAY; // Num of intervals in ~15s
|
|
223
232
|
const pollInterval = setInterval(async () => {
|
|
224
233
|
let build;
|
|
225
234
|
try {
|
|
226
|
-
const response = await getBuildStatus(accountId, taskName, buildId);
|
|
235
|
+
const response = await (0, projects_1.getBuildStatus)(accountId, taskName, buildId);
|
|
227
236
|
build = response.data;
|
|
228
237
|
}
|
|
229
238
|
catch (e) {
|
|
230
|
-
uiLogger.debug(e);
|
|
231
|
-
return reject(new Error(lib.projectBuildAndDeploy.pollBuildAutodeployStatusError(buildId)));
|
|
239
|
+
logger_1.uiLogger.debug(e);
|
|
240
|
+
return reject(new Error(en_1.lib.projectBuildAndDeploy.pollBuildAutodeployStatusError(buildId)));
|
|
232
241
|
}
|
|
233
242
|
if (!build || !build.status) {
|
|
234
|
-
return reject(new Error(lib.projectBuildAndDeploy.pollBuildAutodeployStatusError(buildId)));
|
|
243
|
+
return reject(new Error(en_1.lib.projectBuildAndDeploy.pollBuildAutodeployStatusError(buildId)));
|
|
235
244
|
}
|
|
236
245
|
if (build.deployStatusTaskLocator || maxIntervals <= 0) {
|
|
237
246
|
clearInterval(pollInterval);
|
|
@@ -240,67 +249,67 @@ function pollBuildAutodeployStatus(accountId, taskName, buildId) {
|
|
|
240
249
|
else {
|
|
241
250
|
maxIntervals -= 1;
|
|
242
251
|
}
|
|
243
|
-
}, DEFAULT_POLLING_DELAY);
|
|
252
|
+
}, constants_1.DEFAULT_POLLING_DELAY);
|
|
244
253
|
});
|
|
245
254
|
}
|
|
246
|
-
|
|
247
|
-
linkToHubSpot: (accountId, taskName, taskId) => uiLink(`View build #${taskId} in HubSpot`, getProjectBuildDetailUrl(taskName, taskId, accountId)),
|
|
248
|
-
statusFn: getBuildStatus,
|
|
249
|
-
structureFn: getBuildStructure,
|
|
250
|
-
statusText: PROJECT_BUILD_TEXT,
|
|
255
|
+
exports.pollBuildStatus = makePollTaskStatusFunc({
|
|
256
|
+
linkToHubSpot: (accountId, taskName, taskId) => (0, ui_1.uiLink)(`View build #${taskId} in HubSpot`, (0, urls_1.getProjectBuildDetailUrl)(taskName, taskId, accountId)),
|
|
257
|
+
statusFn: projects_1.getBuildStatus,
|
|
258
|
+
structureFn: projects_1.getBuildStructure,
|
|
259
|
+
statusText: constants_1.PROJECT_BUILD_TEXT,
|
|
251
260
|
statusStrings: {
|
|
252
|
-
INITIALIZE: (name, buildId) => `Building ${
|
|
253
|
-
SUCCESS: (name, buildId) => `Built ${
|
|
254
|
-
FAIL: (name, buildId) => `Failed to build ${
|
|
255
|
-
SUBTASK_FAIL: (buildId, name) => `Build #${buildId} failed because there was a problem\nbuilding ${
|
|
261
|
+
INITIALIZE: (name, buildId) => `Building ${chalk_1.default.bold(name)} #${buildId}`,
|
|
262
|
+
SUCCESS: (name, buildId) => `Built ${chalk_1.default.bold(name)} #${buildId}`,
|
|
263
|
+
FAIL: (name, buildId) => `Failed to build ${chalk_1.default.bold(name)} #${buildId}`,
|
|
264
|
+
SUBTASK_FAIL: (buildId, name) => `Build #${buildId} failed because there was a problem\nbuilding ${chalk_1.default.bold(name)}`,
|
|
256
265
|
},
|
|
257
266
|
});
|
|
258
|
-
|
|
259
|
-
linkToHubSpot: (accountId, taskName, taskId, deployedBuildId) => uiLink(`View deploy of build #${deployedBuildId} in HubSpot`, getProjectDeployDetailUrl(taskName, taskId, accountId)),
|
|
260
|
-
statusFn: getDeployStatus,
|
|
261
|
-
structureFn: getDeployStructure,
|
|
262
|
-
statusText: PROJECT_DEPLOY_TEXT,
|
|
267
|
+
exports.pollDeployStatus = makePollTaskStatusFunc({
|
|
268
|
+
linkToHubSpot: (accountId, taskName, taskId, deployedBuildId) => (0, ui_1.uiLink)(`View deploy of build #${deployedBuildId} in HubSpot`, (0, urls_1.getProjectDeployDetailUrl)(taskName, taskId, accountId)),
|
|
269
|
+
statusFn: projects_1.getDeployStatus,
|
|
270
|
+
structureFn: projects_1.getDeployStructure,
|
|
271
|
+
statusText: constants_1.PROJECT_DEPLOY_TEXT,
|
|
263
272
|
statusStrings: {
|
|
264
|
-
INITIALIZE: (name, buildId) => `Deploying build #${buildId} in ${
|
|
265
|
-
SUCCESS: (name, buildId) => `Deployed build #${buildId} in ${
|
|
266
|
-
FAIL: (name, buildId) => `Failed to deploy build #${buildId} in ${
|
|
267
|
-
SUBTASK_FAIL: (deployedBuildId, name) => `Deploy for build #${deployedBuildId} failed because there was a\nproblem deploying ${
|
|
273
|
+
INITIALIZE: (name, buildId) => `Deploying build #${buildId} in ${chalk_1.default.bold(name)}`,
|
|
274
|
+
SUCCESS: (name, buildId) => `Deployed build #${buildId} in ${chalk_1.default.bold(name)}`,
|
|
275
|
+
FAIL: (name, buildId) => `Failed to deploy build #${buildId} in ${chalk_1.default.bold(name)}`,
|
|
276
|
+
SUBTASK_FAIL: (deployedBuildId, name) => `Deploy for build #${deployedBuildId} failed because there was a\nproblem deploying ${chalk_1.default.bold(name)}`,
|
|
268
277
|
},
|
|
269
278
|
});
|
|
270
|
-
|
|
279
|
+
async function displayWarnLogs(accountId, projectName, taskId, isDeploy = false) {
|
|
271
280
|
let result;
|
|
272
281
|
if (isDeploy) {
|
|
273
282
|
try {
|
|
274
|
-
const { data } = await fetchDeployWarnLogs(accountId, projectName, taskId);
|
|
283
|
+
const { data } = await (0, projects_1.fetchDeployWarnLogs)(accountId, projectName, taskId);
|
|
275
284
|
result = data;
|
|
276
285
|
}
|
|
277
286
|
catch (e) {
|
|
278
|
-
logError(e);
|
|
287
|
+
(0, errorHandlers_1.logError)(e);
|
|
279
288
|
}
|
|
280
289
|
}
|
|
281
290
|
else {
|
|
282
291
|
try {
|
|
283
|
-
const { data } = await fetchBuildWarnLogs(accountId, projectName, taskId);
|
|
292
|
+
const { data } = await (0, projects_1.fetchBuildWarnLogs)(accountId, projectName, taskId);
|
|
284
293
|
result = data;
|
|
285
294
|
}
|
|
286
295
|
catch (e) {
|
|
287
|
-
logError(e);
|
|
296
|
+
(0, errorHandlers_1.logError)(e);
|
|
288
297
|
}
|
|
289
298
|
}
|
|
290
299
|
if (result && result.logs) {
|
|
291
300
|
const logLength = result.logs.length;
|
|
292
301
|
result.logs.forEach((log, i) => {
|
|
293
|
-
uiLogger.warn(log.message);
|
|
302
|
+
logger_1.uiLogger.warn(log.message);
|
|
294
303
|
if (i < logLength - 1) {
|
|
295
|
-
uiLogger.log('');
|
|
304
|
+
logger_1.uiLogger.log('');
|
|
296
305
|
}
|
|
297
306
|
});
|
|
298
307
|
}
|
|
299
308
|
}
|
|
300
|
-
|
|
301
|
-
let buildStatus = await pollBuildStatus(accountId, projectConfig.name, buildId, null, silenceLogs);
|
|
309
|
+
async function pollProjectBuildAndDeploy(accountId, projectConfig, tempFile, buildId, silenceLogs = false) {
|
|
310
|
+
let buildStatus = await (0, exports.pollBuildStatus)(accountId, projectConfig.name, buildId, null, silenceLogs);
|
|
302
311
|
if (!silenceLogs) {
|
|
303
|
-
uiLine();
|
|
312
|
+
(0, ui_1.uiLine)();
|
|
304
313
|
}
|
|
305
314
|
const result = {
|
|
306
315
|
succeeded: true,
|
|
@@ -314,7 +323,7 @@ export async function pollProjectBuildAndDeploy(accountId, projectConfig, tempFi
|
|
|
314
323
|
}
|
|
315
324
|
else if (buildStatus.isAutoDeployEnabled) {
|
|
316
325
|
if (!silenceLogs) {
|
|
317
|
-
uiLogger.log(lib.projectBuildAndDeploy.pollProjectBuildAndDeploy.buildSucceededAutomaticallyDeploying(buildId, uiAccountDescription(accountId)));
|
|
326
|
+
logger_1.uiLogger.log(en_1.lib.projectBuildAndDeploy.pollProjectBuildAndDeploy.buildSucceededAutomaticallyDeploying(buildId, (0, ui_1.uiAccountDescription)(accountId)));
|
|
318
327
|
await displayWarnLogs(accountId, projectConfig.name, buildId);
|
|
319
328
|
}
|
|
320
329
|
// autoDeployId of 0 indicates a skipped deploy
|
|
@@ -324,24 +333,24 @@ export async function pollProjectBuildAndDeploy(accountId, projectConfig, tempFi
|
|
|
324
333
|
buildStatus = await pollBuildAutodeployStatus(accountId, projectConfig.name, buildId);
|
|
325
334
|
}
|
|
326
335
|
if (getIsDeploying()) {
|
|
327
|
-
const deployStatus = await pollDeployStatus(accountId, projectConfig.name, Number(buildStatus.deployStatusTaskLocator.id), buildId, silenceLogs);
|
|
336
|
+
const deployStatus = await (0, exports.pollDeployStatus)(accountId, projectConfig.name, Number(buildStatus.deployStatusTaskLocator.id), buildId, silenceLogs);
|
|
328
337
|
result.deployResult = deployStatus;
|
|
329
338
|
if (deployStatus.status === 'FAILURE') {
|
|
330
339
|
result.succeeded = false;
|
|
331
340
|
}
|
|
332
341
|
}
|
|
333
342
|
else if (!silenceLogs) {
|
|
334
|
-
uiLogger.log(lib.projectBuildAndDeploy.pollProjectBuildAndDeploy.unableToFindAutodeployStatus(buildId, uiLink(lib.projectBuildAndDeploy.pollProjectBuildAndDeploy.viewDeploys, getProjectActivityUrl(projectConfig.name, accountId))));
|
|
343
|
+
logger_1.uiLogger.log(en_1.lib.projectBuildAndDeploy.pollProjectBuildAndDeploy.unableToFindAutodeployStatus(buildId, (0, ui_1.uiLink)(en_1.lib.projectBuildAndDeploy.pollProjectBuildAndDeploy.viewDeploys, (0, urls_1.getProjectActivityUrl)(projectConfig.name, accountId))));
|
|
335
344
|
}
|
|
336
345
|
}
|
|
337
346
|
try {
|
|
338
347
|
if (tempFile) {
|
|
339
348
|
tempFile.removeCallback();
|
|
340
|
-
uiLogger.debug(lib.projectBuildAndDeploy.pollProjectBuildAndDeploy.cleanedUpTempFile(tempFile.name));
|
|
349
|
+
logger_1.uiLogger.debug(en_1.lib.projectBuildAndDeploy.pollProjectBuildAndDeploy.cleanedUpTempFile(tempFile.name));
|
|
341
350
|
}
|
|
342
351
|
}
|
|
343
352
|
catch (e) {
|
|
344
|
-
logError(e);
|
|
353
|
+
(0, errorHandlers_1.logError)(e);
|
|
345
354
|
}
|
|
346
355
|
if (result && result.deployResult) {
|
|
347
356
|
await displayWarnLogs(accountId, projectConfig.name, result.deployResult.deployId, true);
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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.handleComponentCollision = handleComponentCollision;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const project_parsing_lib_1 = require("@hubspot/project-parsing-lib");
|
|
4
10
|
// Handles a collision between component source files
|
|
5
|
-
|
|
11
|
+
function handleComponentCollision({ dest, src, collisions }) {
|
|
6
12
|
const hsMetaFiles = [];
|
|
7
13
|
const packageJsonFiles = [];
|
|
8
14
|
const sourceFiles = [];
|
|
9
15
|
collisions.forEach(collision => {
|
|
10
|
-
if (collision.endsWith(metafileExtension)) {
|
|
16
|
+
if (collision.endsWith(project_parsing_lib_1.metafileExtension)) {
|
|
11
17
|
hsMetaFiles.push(collision);
|
|
12
18
|
}
|
|
13
|
-
else if (
|
|
19
|
+
else if (path_1.default.parse(collision).base === 'package.json') {
|
|
14
20
|
packageJsonFiles.push(collision);
|
|
15
21
|
}
|
|
16
22
|
else {
|
|
@@ -18,18 +24,18 @@ export function handleComponentCollision({ dest, src, collisions }) {
|
|
|
18
24
|
}
|
|
19
25
|
});
|
|
20
26
|
const sourceFilenameMapping = sourceFiles.reduce((acc, filename) => {
|
|
21
|
-
const { name, ext, dir } =
|
|
27
|
+
const { name, ext, dir } = path_1.default.parse(filename);
|
|
22
28
|
return {
|
|
23
29
|
...acc,
|
|
24
|
-
[filename]:
|
|
30
|
+
[filename]: path_1.default.join(dir, `${name}-${Date.now()}${ext}`),
|
|
25
31
|
};
|
|
26
32
|
}, {});
|
|
27
|
-
const metafileExtensionPrefix =
|
|
33
|
+
const metafileExtensionPrefix = path_1.default.parse(project_parsing_lib_1.metafileExtension).name;
|
|
28
34
|
const metaFilenameMapping = hsMetaFiles.reduce((acc, filename) => {
|
|
29
|
-
const { name, dir } =
|
|
35
|
+
const { name, dir } = path_1.default.parse(filename);
|
|
30
36
|
return {
|
|
31
37
|
...acc,
|
|
32
|
-
[filename]:
|
|
38
|
+
[filename]: path_1.default.join(dir, `${name.replace(metafileExtensionPrefix, '')}-${Date.now()}${project_parsing_lib_1.metafileExtension}`),
|
|
33
39
|
};
|
|
34
40
|
}, {});
|
|
35
41
|
// Update the metafiles that might contain references to the old filenames
|
|
@@ -44,25 +50,25 @@ export function handleComponentCollision({ dest, src, collisions }) {
|
|
|
44
50
|
});
|
|
45
51
|
// Copy the renamed files into their new destination location
|
|
46
52
|
Object.entries(sourceFilenameMapping).forEach(([key, value]) => {
|
|
47
|
-
|
|
53
|
+
fs_1.default.copyFileSync(path_1.default.join(src, key), path_1.default.join(dest, value));
|
|
48
54
|
});
|
|
49
55
|
if (packageJsonFiles.length) {
|
|
50
56
|
handlePackageJsonCollisions(dest, src, packageJsonFiles);
|
|
51
57
|
}
|
|
52
58
|
}
|
|
53
59
|
function updateMetaFile({ dest, src, file, sourceFilenameMapping, metaFilenameMapping, }) {
|
|
54
|
-
let text =
|
|
60
|
+
let text = fs_1.default.readFileSync(path_1.default.join(src, file), 'utf-8');
|
|
55
61
|
Object.entries(sourceFilenameMapping).forEach(([key, value]) => {
|
|
56
|
-
const { base: oldFileName } =
|
|
57
|
-
const { base: newFileName } =
|
|
62
|
+
const { base: oldFileName } = path_1.default.parse(key);
|
|
63
|
+
const { base: newFileName } = path_1.default.parse(value);
|
|
58
64
|
text = text.replace(oldFileName, newFileName);
|
|
59
65
|
});
|
|
60
|
-
|
|
66
|
+
fs_1.default.writeFileSync(path_1.default.join(dest, metaFilenameMapping[file]), text);
|
|
61
67
|
}
|
|
62
68
|
function handlePackageJsonCollisions(dest, src, packageJsonFiles) {
|
|
63
69
|
packageJsonFiles.forEach(file => {
|
|
64
|
-
const existingPackageJsonContents = JSON.parse(
|
|
65
|
-
const newPackageJsonContents = JSON.parse(
|
|
70
|
+
const existingPackageJsonContents = JSON.parse(fs_1.default.readFileSync(path_1.default.join(dest, file), 'utf-8'));
|
|
71
|
+
const newPackageJsonContents = JSON.parse(fs_1.default.readFileSync(path_1.default.join(src, file), 'utf-8'));
|
|
66
72
|
existingPackageJsonContents.dependencies = {
|
|
67
73
|
...newPackageJsonContents.dependencies,
|
|
68
74
|
...existingPackageJsonContents.dependencies,
|
|
@@ -71,6 +77,6 @@ function handlePackageJsonCollisions(dest, src, packageJsonFiles) {
|
|
|
71
77
|
...newPackageJsonContents.devDependencies,
|
|
72
78
|
...existingPackageJsonContents.devDependencies,
|
|
73
79
|
};
|
|
74
|
-
|
|
80
|
+
fs_1.default.writeFileSync(path_1.default.join(dest, file), JSON.stringify(existingPackageJsonContents, null, 2));
|
|
75
81
|
});
|
|
76
82
|
}
|
package/lib/projects/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProjectConfig } from '../../types/Projects
|
|
1
|
+
import { ProjectConfig } from '../../types/Projects';
|
|
2
2
|
export declare function writeProjectConfig(configPath: string, config: ProjectConfig): boolean;
|
|
3
3
|
export declare function getIsInProject(dir?: string): boolean;
|
|
4
4
|
export interface LoadedProjectConfig {
|
package/lib/projects/config.js
CHANGED
|
@@ -1,70 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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.writeProjectConfig = writeProjectConfig;
|
|
7
|
+
exports.getIsInProject = getIsInProject;
|
|
8
|
+
exports.getProjectConfig = getProjectConfig;
|
|
9
|
+
exports.validateProjectConfig = validateProjectConfig;
|
|
10
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
11
|
+
const path_1 = __importDefault(require("path"));
|
|
12
|
+
const findup_sync_1 = __importDefault(require("findup-sync"));
|
|
13
|
+
const path_2 = require("@hubspot/local-dev-lib/path");
|
|
14
|
+
const constants_1 = require("../constants");
|
|
15
|
+
const en_1 = require("../../lang/en");
|
|
16
|
+
const exitCodes_1 = require("../enums/exitCodes");
|
|
17
|
+
const logger_1 = require("../ui/logger");
|
|
18
|
+
function writeProjectConfig(configPath, config) {
|
|
10
19
|
try {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
uiLogger.debug(`Wrote project config at ${configPath}`);
|
|
20
|
+
fs_extra_1.default.ensureFileSync(configPath);
|
|
21
|
+
fs_extra_1.default.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
22
|
+
logger_1.uiLogger.debug(`Wrote project config at ${configPath}`);
|
|
14
23
|
}
|
|
15
24
|
catch (e) {
|
|
16
|
-
uiLogger.debug(e);
|
|
25
|
+
logger_1.uiLogger.debug(e);
|
|
17
26
|
return false;
|
|
18
27
|
}
|
|
19
28
|
return true;
|
|
20
29
|
}
|
|
21
|
-
|
|
30
|
+
function getIsInProject(dir) {
|
|
22
31
|
const configPath = getProjectConfigPath(dir);
|
|
23
32
|
return !!configPath;
|
|
24
33
|
}
|
|
25
34
|
function getProjectConfigPath(dir) {
|
|
26
|
-
const projectDir = dir ? getAbsoluteFilePath(dir) : getCwd();
|
|
27
|
-
const configPath =
|
|
35
|
+
const projectDir = dir ? (0, path_2.getAbsoluteFilePath)(dir) : (0, path_2.getCwd)();
|
|
36
|
+
const configPath = (0, findup_sync_1.default)(constants_1.PROJECT_CONFIG_FILE, {
|
|
28
37
|
cwd: projectDir,
|
|
29
38
|
nocase: true,
|
|
30
39
|
});
|
|
31
40
|
return configPath;
|
|
32
41
|
}
|
|
33
|
-
|
|
42
|
+
async function getProjectConfig(dir) {
|
|
34
43
|
const configPath = getProjectConfigPath(dir);
|
|
35
44
|
if (!configPath) {
|
|
36
45
|
return { projectConfig: null, projectDir: null };
|
|
37
46
|
}
|
|
38
47
|
try {
|
|
39
|
-
const config =
|
|
48
|
+
const config = fs_extra_1.default.readFileSync(configPath);
|
|
40
49
|
const projectConfig = JSON.parse(config.toString());
|
|
41
50
|
return {
|
|
42
|
-
projectDir:
|
|
51
|
+
projectDir: path_1.default.dirname(configPath),
|
|
43
52
|
projectConfig,
|
|
44
53
|
};
|
|
45
54
|
}
|
|
46
55
|
catch (e) {
|
|
47
|
-
uiLogger.error(lib.projects.getProjectConfig.error);
|
|
56
|
+
logger_1.uiLogger.error(en_1.lib.projects.getProjectConfig.error);
|
|
48
57
|
return { projectConfig: null, projectDir: null };
|
|
49
58
|
}
|
|
50
59
|
}
|
|
51
|
-
|
|
60
|
+
function validateProjectConfig(projectConfig, projectDir) {
|
|
52
61
|
if (!projectConfig || !projectDir) {
|
|
53
|
-
uiLogger.error(lib.projects.validateProjectConfig.configNotFound);
|
|
54
|
-
return process.exit(EXIT_CODES.ERROR);
|
|
62
|
+
logger_1.uiLogger.error(en_1.lib.projects.validateProjectConfig.configNotFound);
|
|
63
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
55
64
|
}
|
|
56
65
|
if (!projectConfig.name || !projectConfig.srcDir) {
|
|
57
|
-
uiLogger.error(lib.projects.validateProjectConfig.configMissingFields);
|
|
58
|
-
return process.exit(EXIT_CODES.ERROR);
|
|
66
|
+
logger_1.uiLogger.error(en_1.lib.projects.validateProjectConfig.configMissingFields);
|
|
67
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
59
68
|
}
|
|
60
|
-
const resolvedPath =
|
|
69
|
+
const resolvedPath = path_1.default.resolve(projectDir, projectConfig.srcDir);
|
|
61
70
|
if (!resolvedPath.startsWith(projectDir)) {
|
|
62
|
-
const projectConfigFile =
|
|
63
|
-
uiLogger.error(lib.projects.validateProjectConfig.srcOutsideProjectDir(projectConfigFile, projectConfig.srcDir));
|
|
64
|
-
return process.exit(EXIT_CODES.ERROR);
|
|
71
|
+
const projectConfigFile = path_1.default.relative('.', path_1.default.join(projectDir, constants_1.PROJECT_CONFIG_FILE));
|
|
72
|
+
logger_1.uiLogger.error(en_1.lib.projects.validateProjectConfig.srcOutsideProjectDir(projectConfigFile, projectConfig.srcDir));
|
|
73
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
65
74
|
}
|
|
66
|
-
if (!
|
|
67
|
-
uiLogger.error(lib.projects.validateProjectConfig.srcDirNotFound(projectConfig.srcDir, projectDir));
|
|
68
|
-
return process.exit(EXIT_CODES.ERROR);
|
|
75
|
+
if (!fs_extra_1.default.existsSync(resolvedPath)) {
|
|
76
|
+
logger_1.uiLogger.error(en_1.lib.projects.validateProjectConfig.srcDirNotFound(projectConfig.srcDir, projectDir));
|
|
77
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
69
78
|
}
|
|
70
79
|
}
|