@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,7 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 fs_1 = __importDefault(require("fs"));
|
|
7
|
+
const components_1 = require("../components");
|
|
3
8
|
vi.mock('fs');
|
|
4
|
-
const mockedFs = vi.mocked(
|
|
9
|
+
const mockedFs = vi.mocked(fs_1.default);
|
|
5
10
|
describe('lib/projects/components', () => {
|
|
6
11
|
describe('handleComponentCollision()', () => {
|
|
7
12
|
const mockCollision = {
|
|
@@ -23,7 +28,7 @@ describe('lib/projects/components', () => {
|
|
|
23
28
|
collisions: ['component.js', 'utils.ts'],
|
|
24
29
|
};
|
|
25
30
|
mockedFs.copyFileSync.mockImplementation(() => { });
|
|
26
|
-
handleComponentCollision(collision);
|
|
31
|
+
(0, components_1.handleComponentCollision)(collision);
|
|
27
32
|
expect(mockedFs.copyFileSync).toHaveBeenCalledTimes(2);
|
|
28
33
|
expect(mockedFs.copyFileSync).toHaveBeenCalledWith('/src/path/component.js', '/dest/path/component-1234567890.js');
|
|
29
34
|
expect(mockedFs.copyFileSync).toHaveBeenCalledWith('/src/path/utils.ts', '/dest/path/utils-1234567890.ts');
|
|
@@ -45,7 +50,7 @@ describe('lib/projects/components', () => {
|
|
|
45
50
|
value: '.module.meta.json',
|
|
46
51
|
writable: false,
|
|
47
52
|
});
|
|
48
|
-
handleComponentCollision(collision);
|
|
53
|
+
(0, components_1.handleComponentCollision)(collision);
|
|
49
54
|
expect(mockedFs.readFileSync).toHaveBeenCalledWith('/src/path/component.module.meta.json', 'utf-8');
|
|
50
55
|
expect(mockedFs.writeFileSync).toHaveBeenCalledWith('/dest/path/component-1234567890.module.meta.json', expect.stringContaining('source-1234567890.js'));
|
|
51
56
|
expect(mockedFs.copyFileSync).toHaveBeenCalledWith('/src/path/source.js', '/dest/path/source-1234567890.js');
|
|
@@ -82,7 +87,7 @@ describe('lib/projects/components', () => {
|
|
|
82
87
|
mockedFs.writeFileSync.mockImplementation(() => { });
|
|
83
88
|
// Mock console.log to avoid output during tests
|
|
84
89
|
const consoleSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
|
|
85
|
-
handleComponentCollision(collision);
|
|
90
|
+
(0, components_1.handleComponentCollision)(collision);
|
|
86
91
|
const expectedMergedPackageJson = {
|
|
87
92
|
name: 'existing-package',
|
|
88
93
|
dependencies: {
|
|
@@ -126,7 +131,7 @@ describe('lib/projects/components', () => {
|
|
|
126
131
|
writable: false,
|
|
127
132
|
});
|
|
128
133
|
const consoleSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
|
|
129
|
-
handleComponentCollision(collision);
|
|
134
|
+
(0, components_1.handleComponentCollision)(collision);
|
|
130
135
|
// Verify source files are copied with new names
|
|
131
136
|
expect(mockedFs.copyFileSync).toHaveBeenCalledWith('/src/path/component.js', '/dest/path/component-1234567890.js');
|
|
132
137
|
expect(mockedFs.copyFileSync).toHaveBeenCalledWith('/src/path/utils.ts', '/dest/path/utils-1234567890.ts');
|
|
@@ -141,7 +146,7 @@ describe('lib/projects/components', () => {
|
|
|
141
146
|
...mockCollision,
|
|
142
147
|
collisions: [],
|
|
143
148
|
};
|
|
144
|
-
handleComponentCollision(collision);
|
|
149
|
+
(0, components_1.handleComponentCollision)(collision);
|
|
145
150
|
expect(mockedFs.copyFileSync).not.toHaveBeenCalled();
|
|
146
151
|
expect(mockedFs.readFileSync).not.toHaveBeenCalled();
|
|
147
152
|
expect(mockedFs.writeFileSync).not.toHaveBeenCalled();
|
|
@@ -169,7 +174,7 @@ describe('lib/projects/components', () => {
|
|
|
169
174
|
mockedFs.copyFileSync.mockImplementation(() => { });
|
|
170
175
|
// Mock console.log for package.json handling
|
|
171
176
|
const consoleSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
|
|
172
|
-
handleComponentCollision(collision);
|
|
177
|
+
(0, components_1.handleComponentCollision)(collision);
|
|
173
178
|
// Should copy 2 source files
|
|
174
179
|
expect(mockedFs.copyFileSync).toHaveBeenCalledTimes(2);
|
|
175
180
|
// Should handle 2 metafiles
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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 fs_1 = __importDefault(require("fs"));
|
|
7
|
+
const os_1 = __importDefault(require("os"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const exitCodes_1 = require("../../enums/exitCodes");
|
|
10
|
+
const config_1 = require("../../projects/config");
|
|
11
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
7
12
|
vi.mock('@hubspot/local-dev-lib/logger');
|
|
8
13
|
describe('lib/projects', () => {
|
|
9
14
|
describe('validateProjectConfig()', () => {
|
|
10
15
|
let projectDir;
|
|
11
16
|
let exitMock;
|
|
12
17
|
beforeAll(() => {
|
|
13
|
-
projectDir =
|
|
14
|
-
|
|
18
|
+
projectDir = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), 'projects-'));
|
|
19
|
+
fs_1.default.mkdirSync(path_1.default.join(projectDir, 'src'));
|
|
15
20
|
});
|
|
16
21
|
beforeEach(() => {
|
|
17
22
|
// @ts-expect-error - Mocking process.exit
|
|
@@ -24,60 +29,60 @@ describe('lib/projects', () => {
|
|
|
24
29
|
});
|
|
25
30
|
it('rejects undefined configuration', () => {
|
|
26
31
|
// @ts-ignore Testing invalid input
|
|
27
|
-
validateProjectConfig(null, projectDir);
|
|
28
|
-
expect(exitMock).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
29
|
-
expect(logger.error).toHaveBeenCalledWith(expect.stringMatching(/.*Unable to locate a project configuration file. Try running again from a project directory, or run*/));
|
|
32
|
+
(0, config_1.validateProjectConfig)(null, projectDir);
|
|
33
|
+
expect(exitMock).toHaveBeenCalledWith(exitCodes_1.EXIT_CODES.ERROR);
|
|
34
|
+
expect(logger_1.logger.error).toHaveBeenCalledWith(expect.stringMatching(/.*Unable to locate a project configuration file. Try running again from a project directory, or run*/));
|
|
30
35
|
});
|
|
31
36
|
it('rejects configuration with missing name', () => {
|
|
32
37
|
// @ts-ignore Testing invalid input
|
|
33
|
-
validateProjectConfig({ srcDir: '.' }, projectDir);
|
|
34
|
-
expect(exitMock).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
35
|
-
expect(logger.error).toHaveBeenCalledWith(expect.stringMatching(/.*missing required fields*/));
|
|
38
|
+
(0, config_1.validateProjectConfig)({ srcDir: '.' }, projectDir);
|
|
39
|
+
expect(exitMock).toHaveBeenCalledWith(exitCodes_1.EXIT_CODES.ERROR);
|
|
40
|
+
expect(logger_1.logger.error).toHaveBeenCalledWith(expect.stringMatching(/.*missing required fields*/));
|
|
36
41
|
});
|
|
37
42
|
it('rejects configuration with missing srcDir', () => {
|
|
38
43
|
// @ts-ignore Testing invalid input
|
|
39
|
-
validateProjectConfig({ name: 'hello' }, projectDir);
|
|
40
|
-
expect(exitMock).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
41
|
-
expect(logger.error).toHaveBeenCalledWith(expect.stringMatching(/.*missing required fields.*/));
|
|
44
|
+
(0, config_1.validateProjectConfig)({ name: 'hello' }, projectDir);
|
|
45
|
+
expect(exitMock).toHaveBeenCalledWith(exitCodes_1.EXIT_CODES.ERROR);
|
|
46
|
+
expect(logger_1.logger.error).toHaveBeenCalledWith(expect.stringMatching(/.*missing required fields.*/));
|
|
42
47
|
});
|
|
43
48
|
describe('rejects configuration with srcDir outside project directory', () => {
|
|
44
49
|
it('for parent directory', () => {
|
|
45
|
-
validateProjectConfig({ name: 'hello', srcDir: '..', platformVersion: '' }, projectDir);
|
|
46
|
-
expect(exitMock).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
47
|
-
expect(logger.error).toHaveBeenCalledWith(expect.stringContaining('srcDir: ".."'));
|
|
50
|
+
(0, config_1.validateProjectConfig)({ name: 'hello', srcDir: '..', platformVersion: '' }, projectDir);
|
|
51
|
+
expect(exitMock).toHaveBeenCalledWith(exitCodes_1.EXIT_CODES.ERROR);
|
|
52
|
+
expect(logger_1.logger.error).toHaveBeenCalledWith(expect.stringContaining('srcDir: ".."'));
|
|
48
53
|
});
|
|
49
54
|
it('for root directory', () => {
|
|
50
|
-
validateProjectConfig({ name: 'hello', srcDir: '/', platformVersion: '' }, projectDir);
|
|
51
|
-
expect(exitMock).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
52
|
-
expect(logger.error).toHaveBeenCalledWith(expect.stringContaining('srcDir: "/"'));
|
|
55
|
+
(0, config_1.validateProjectConfig)({ name: 'hello', srcDir: '/', platformVersion: '' }, projectDir);
|
|
56
|
+
expect(exitMock).toHaveBeenCalledWith(exitCodes_1.EXIT_CODES.ERROR);
|
|
57
|
+
expect(logger_1.logger.error).toHaveBeenCalledWith(expect.stringContaining('srcDir: "/"'));
|
|
53
58
|
});
|
|
54
59
|
it('for complicated directory', () => {
|
|
55
60
|
const srcDir = './src/././../src/../../src';
|
|
56
|
-
validateProjectConfig({ name: 'hello', srcDir, platformVersion: '' }, projectDir);
|
|
57
|
-
expect(exitMock).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
58
|
-
expect(logger.error).toHaveBeenCalledWith(expect.stringContaining(`srcDir: "${srcDir}"`));
|
|
61
|
+
(0, config_1.validateProjectConfig)({ name: 'hello', srcDir, platformVersion: '' }, projectDir);
|
|
62
|
+
expect(exitMock).toHaveBeenCalledWith(exitCodes_1.EXIT_CODES.ERROR);
|
|
63
|
+
expect(logger_1.logger.error).toHaveBeenCalledWith(expect.stringContaining(`srcDir: "${srcDir}"`));
|
|
59
64
|
});
|
|
60
65
|
});
|
|
61
66
|
it('rejects configuration with srcDir that does not exist', () => {
|
|
62
|
-
validateProjectConfig({ name: 'hello', srcDir: 'foo', platformVersion: '' }, projectDir);
|
|
63
|
-
expect(exitMock).toHaveBeenCalledWith(EXIT_CODES.ERROR);
|
|
64
|
-
expect(logger.error).toHaveBeenCalledWith(expect.stringMatching(/.*could not be found in.*/));
|
|
67
|
+
(0, config_1.validateProjectConfig)({ name: 'hello', srcDir: 'foo', platformVersion: '' }, projectDir);
|
|
68
|
+
expect(exitMock).toHaveBeenCalledWith(exitCodes_1.EXIT_CODES.ERROR);
|
|
69
|
+
expect(logger_1.logger.error).toHaveBeenCalledWith(expect.stringMatching(/.*could not be found in.*/));
|
|
65
70
|
});
|
|
66
71
|
describe('accepts configuration with valid srcDir', () => {
|
|
67
72
|
it('for current directory', () => {
|
|
68
|
-
validateProjectConfig({ name: 'hello', srcDir: '.', platformVersion: '' }, projectDir);
|
|
73
|
+
(0, config_1.validateProjectConfig)({ name: 'hello', srcDir: '.', platformVersion: '' }, projectDir);
|
|
69
74
|
expect(exitMock).not.toHaveBeenCalled();
|
|
70
|
-
expect(logger.error).not.toHaveBeenCalled();
|
|
75
|
+
expect(logger_1.logger.error).not.toHaveBeenCalled();
|
|
71
76
|
});
|
|
72
77
|
it('for relative directory', () => {
|
|
73
|
-
validateProjectConfig({ name: 'hello', srcDir: './src', platformVersion: '' }, projectDir);
|
|
78
|
+
(0, config_1.validateProjectConfig)({ name: 'hello', srcDir: './src', platformVersion: '' }, projectDir);
|
|
74
79
|
expect(exitMock).not.toHaveBeenCalled();
|
|
75
|
-
expect(logger.error).not.toHaveBeenCalled();
|
|
80
|
+
expect(logger_1.logger.error).not.toHaveBeenCalled();
|
|
76
81
|
});
|
|
77
82
|
it('for implied relative directory', () => {
|
|
78
|
-
validateProjectConfig({ name: 'hello', srcDir: 'src', platformVersion: '' }, projectDir);
|
|
83
|
+
(0, config_1.validateProjectConfig)({ name: 'hello', srcDir: 'src', platformVersion: '' }, projectDir);
|
|
79
84
|
expect(exitMock).not.toHaveBeenCalled();
|
|
80
|
-
expect(logger.error).not.toHaveBeenCalled();
|
|
85
|
+
expect(logger_1.logger.error).not.toHaveBeenCalled();
|
|
81
86
|
});
|
|
82
87
|
});
|
|
83
88
|
});
|
|
@@ -1,12 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
const fs_1 = __importDefault(require("fs"));
|
|
40
|
+
const HSfs = __importStar(require("@hubspot/local-dev-lib/fs"));
|
|
41
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
42
|
+
const structure_1 = require("../structure");
|
|
43
|
+
const Projects_1 = require("../../../types/Projects");
|
|
6
44
|
vi.mock('fs');
|
|
7
45
|
vi.mock('@hubspot/local-dev-lib/fs');
|
|
8
46
|
vi.mock('@hubspot/local-dev-lib/logger');
|
|
9
|
-
const mockedReadFileSync =
|
|
47
|
+
const mockedReadFileSync = fs_1.default.readFileSync;
|
|
10
48
|
const mockedWalk = HSfs.walk;
|
|
11
49
|
const getMockPrivateAppConfig = (cards = []) => ({
|
|
12
50
|
name: 'test-app',
|
|
@@ -23,43 +61,43 @@ const getMockPrivateAppConfig = (cards = []) => ({
|
|
|
23
61
|
describe('lib/projects/structure', () => {
|
|
24
62
|
describe('getComponentTypeFromConfigFile()', () => {
|
|
25
63
|
it('returns correct type for public app config', () => {
|
|
26
|
-
expect(getComponentTypeFromConfigFile('public-app.json')).toBe(ComponentTypes.PublicApp);
|
|
64
|
+
expect((0, structure_1.getComponentTypeFromConfigFile)('public-app.json')).toBe(Projects_1.ComponentTypes.PublicApp);
|
|
27
65
|
});
|
|
28
66
|
it('returns correct type for private app config', () => {
|
|
29
|
-
expect(getComponentTypeFromConfigFile('app.json')).toBe(ComponentTypes.PrivateApp);
|
|
67
|
+
expect((0, structure_1.getComponentTypeFromConfigFile)('app.json')).toBe(Projects_1.ComponentTypes.PrivateApp);
|
|
30
68
|
});
|
|
31
69
|
it('returns correct type for theme config', () => {
|
|
32
|
-
expect(getComponentTypeFromConfigFile('theme.json')).toBe(ComponentTypes.HublTheme);
|
|
70
|
+
expect((0, structure_1.getComponentTypeFromConfigFile)('theme.json')).toBe(Projects_1.ComponentTypes.HublTheme);
|
|
33
71
|
});
|
|
34
72
|
it('returns null for unknown config file', () => {
|
|
35
|
-
expect(getComponentTypeFromConfigFile('unknown.json')).toBeNull();
|
|
73
|
+
expect((0, structure_1.getComponentTypeFromConfigFile)('unknown.json')).toBeNull();
|
|
36
74
|
});
|
|
37
75
|
});
|
|
38
76
|
describe('loadConfigFile()', () => {
|
|
39
77
|
it('returns parsed JSON when file exists', () => {
|
|
40
78
|
const mockConfig = { name: 'test-app' };
|
|
41
79
|
mockedReadFileSync.mockReturnValue(JSON.stringify(mockConfig));
|
|
42
|
-
expect(loadConfigFile('test/path/app.json')).toEqual(mockConfig);
|
|
80
|
+
expect((0, structure_1.loadConfigFile)('test/path/app.json')).toEqual(mockConfig);
|
|
43
81
|
});
|
|
44
82
|
it('returns null when file read fails', () => {
|
|
45
83
|
mockedReadFileSync.mockImplementation(() => {
|
|
46
84
|
throw new Error('File not found');
|
|
47
85
|
});
|
|
48
|
-
expect(loadConfigFile('nonexistent/path/app.json')).toBeNull();
|
|
49
|
-
expect(logger.debug).toHaveBeenCalled();
|
|
86
|
+
expect((0, structure_1.loadConfigFile)('nonexistent/path/app.json')).toBeNull();
|
|
87
|
+
expect(logger_1.logger.debug).toHaveBeenCalled();
|
|
50
88
|
});
|
|
51
89
|
});
|
|
52
90
|
describe('getAppCardConfigs()', () => {
|
|
53
91
|
const mockAppPath = '/test/path';
|
|
54
92
|
it('returns empty array when no cards exist', () => {
|
|
55
93
|
const appConfig = getMockPrivateAppConfig();
|
|
56
|
-
expect(getAppCardConfigs(appConfig, mockAppPath)).toEqual([]);
|
|
94
|
+
expect((0, structure_1.getAppCardConfigs)(appConfig, mockAppPath)).toEqual([]);
|
|
57
95
|
});
|
|
58
96
|
it('returns array of card configs when valid cards exist', () => {
|
|
59
97
|
const mockCardConfig = { type: 'crm-card' };
|
|
60
98
|
mockedReadFileSync.mockReturnValue(JSON.stringify(mockCardConfig));
|
|
61
99
|
const appConfig = getMockPrivateAppConfig([{ file: 'card.json' }]);
|
|
62
|
-
expect(getAppCardConfigs(appConfig, mockAppPath)).toEqual([
|
|
100
|
+
expect((0, structure_1.getAppCardConfigs)(appConfig, mockAppPath)).toEqual([
|
|
63
101
|
mockCardConfig,
|
|
64
102
|
]);
|
|
65
103
|
});
|
|
@@ -70,11 +108,11 @@ describe('lib/projects/structure', () => {
|
|
|
70
108
|
const cardConfig = { type: 'crm-card' };
|
|
71
109
|
const appConfig = getMockPrivateAppConfig([{ file: 'card.json' }]);
|
|
72
110
|
mockedReadFileSync.mockReturnValue(JSON.stringify(cardConfig));
|
|
73
|
-
expect(getIsLegacyApp(appConfig, mockAppPath)).toBe(true);
|
|
111
|
+
expect((0, structure_1.getIsLegacyApp)(appConfig, mockAppPath)).toBe(true);
|
|
74
112
|
});
|
|
75
113
|
it('returns false when the app has no cards', () => {
|
|
76
114
|
const appConfig = getMockPrivateAppConfig();
|
|
77
|
-
expect(getIsLegacyApp(appConfig, mockAppPath)).toBe(false);
|
|
115
|
+
expect((0, structure_1.getIsLegacyApp)(appConfig, mockAppPath)).toBe(false);
|
|
78
116
|
});
|
|
79
117
|
it('returns false for non-legacy app', () => {
|
|
80
118
|
const cardConfig = {
|
|
@@ -82,20 +120,20 @@ describe('lib/projects/structure', () => {
|
|
|
82
120
|
};
|
|
83
121
|
const appConfig = getMockPrivateAppConfig([{ file: 'card.json' }]);
|
|
84
122
|
mockedReadFileSync.mockReturnValue(JSON.stringify(cardConfig));
|
|
85
|
-
expect(getIsLegacyApp(appConfig, mockAppPath)).toBe(false);
|
|
123
|
+
expect((0, structure_1.getIsLegacyApp)(appConfig, mockAppPath)).toBe(false);
|
|
86
124
|
});
|
|
87
125
|
});
|
|
88
126
|
describe('findProjectComponents()', () => {
|
|
89
127
|
it('returns an empty array of components when no components are found', async () => {
|
|
90
128
|
mockedWalk.mockReturnValue([]);
|
|
91
|
-
const components = await findProjectComponents('');
|
|
129
|
+
const components = await (0, structure_1.findProjectComponents)('');
|
|
92
130
|
expect(components).toEqual([]);
|
|
93
131
|
});
|
|
94
132
|
it('returns an array of components when components are found', async () => {
|
|
95
133
|
const cardConfig = { type: 'crm-card' };
|
|
96
134
|
const appConfig = getMockPrivateAppConfig();
|
|
97
135
|
const component = {
|
|
98
|
-
type: ComponentTypes.PrivateApp,
|
|
136
|
+
type: Projects_1.ComponentTypes.PrivateApp,
|
|
99
137
|
config: appConfig,
|
|
100
138
|
runnable: true,
|
|
101
139
|
path: '',
|
|
@@ -104,108 +142,108 @@ describe('lib/projects/structure', () => {
|
|
|
104
142
|
mockedReadFileSync
|
|
105
143
|
.mockReturnValueOnce(JSON.stringify(appConfig))
|
|
106
144
|
.mockReturnValueOnce(JSON.stringify(cardConfig));
|
|
107
|
-
const components = await findProjectComponents('');
|
|
145
|
+
const components = await (0, structure_1.findProjectComponents)('');
|
|
108
146
|
expect(components).toEqual([component]);
|
|
109
147
|
});
|
|
110
148
|
});
|
|
111
149
|
describe('getProjectComponentTypes()', () => {
|
|
112
150
|
it('returns the correct component types', () => {
|
|
113
151
|
const component = {
|
|
114
|
-
type: ComponentTypes.PrivateApp,
|
|
152
|
+
type: Projects_1.ComponentTypes.PrivateApp,
|
|
115
153
|
config: getMockPrivateAppConfig(),
|
|
116
154
|
runnable: true,
|
|
117
155
|
path: 'test/path',
|
|
118
156
|
};
|
|
119
157
|
const components = [component];
|
|
120
|
-
expect(getProjectComponentTypes(components)).toEqual({
|
|
121
|
-
[ComponentTypes.PrivateApp]: true,
|
|
158
|
+
expect((0, structure_1.getProjectComponentTypes)(components)).toEqual({
|
|
159
|
+
[Projects_1.ComponentTypes.PrivateApp]: true,
|
|
122
160
|
});
|
|
123
161
|
});
|
|
124
162
|
it('returns the correct component types for multiple components', () => {
|
|
125
163
|
const component1 = {
|
|
126
|
-
type: ComponentTypes.PrivateApp,
|
|
164
|
+
type: Projects_1.ComponentTypes.PrivateApp,
|
|
127
165
|
config: getMockPrivateAppConfig(),
|
|
128
166
|
runnable: true,
|
|
129
167
|
path: 'test/path',
|
|
130
168
|
};
|
|
131
169
|
const component2 = {
|
|
132
|
-
type: ComponentTypes.PublicApp,
|
|
170
|
+
type: Projects_1.ComponentTypes.PublicApp,
|
|
133
171
|
// Config doesn't matter for this test so we can use a private app config
|
|
134
172
|
config: getMockPrivateAppConfig(),
|
|
135
173
|
runnable: true,
|
|
136
174
|
path: 'test/path',
|
|
137
175
|
};
|
|
138
176
|
const components = [component1, component2];
|
|
139
|
-
expect(getProjectComponentTypes(components)).toEqual({
|
|
140
|
-
[ComponentTypes.PrivateApp]: true,
|
|
141
|
-
[ComponentTypes.PublicApp]: true,
|
|
177
|
+
expect((0, structure_1.getProjectComponentTypes)(components)).toEqual({
|
|
178
|
+
[Projects_1.ComponentTypes.PrivateApp]: true,
|
|
179
|
+
[Projects_1.ComponentTypes.PublicApp]: true,
|
|
142
180
|
});
|
|
143
181
|
});
|
|
144
182
|
it('returns an empty object when no components are provided', () => {
|
|
145
183
|
const components = [];
|
|
146
|
-
expect(getProjectComponentTypes(components)).toEqual({});
|
|
184
|
+
expect((0, structure_1.getProjectComponentTypes)(components)).toEqual({});
|
|
147
185
|
});
|
|
148
186
|
});
|
|
149
187
|
describe('getComponentUid()', () => {
|
|
150
188
|
it('returns uid from the component config', () => {
|
|
151
189
|
const component = {
|
|
152
|
-
type: ComponentTypes.PrivateApp,
|
|
190
|
+
type: Projects_1.ComponentTypes.PrivateApp,
|
|
153
191
|
config: getMockPrivateAppConfig(),
|
|
154
192
|
runnable: true,
|
|
155
193
|
path: 'test/path',
|
|
156
194
|
};
|
|
157
|
-
expect(getComponentUid(component)).toBe(component.config.uid);
|
|
195
|
+
expect((0, structure_1.getComponentUid)(component)).toBe(component.config.uid);
|
|
158
196
|
});
|
|
159
197
|
it('returns null for null input', () => {
|
|
160
|
-
expect(getComponentUid(null)).toBeNull();
|
|
198
|
+
expect((0, structure_1.getComponentUid)(null)).toBeNull();
|
|
161
199
|
});
|
|
162
200
|
});
|
|
163
201
|
describe('componentIsApp()', () => {
|
|
164
202
|
it('returns true for public app component', () => {
|
|
165
203
|
const component = {
|
|
166
|
-
type: ComponentTypes.PublicApp,
|
|
204
|
+
type: Projects_1.ComponentTypes.PublicApp,
|
|
167
205
|
// Config doesn't matter for this test so we can use a private app config
|
|
168
206
|
config: getMockPrivateAppConfig(),
|
|
169
207
|
runnable: true,
|
|
170
208
|
path: 'test/path',
|
|
171
209
|
};
|
|
172
|
-
expect(componentIsApp(component)).toBe(true);
|
|
210
|
+
expect((0, structure_1.componentIsApp)(component)).toBe(true);
|
|
173
211
|
});
|
|
174
212
|
it('returns true for private app component', () => {
|
|
175
213
|
const component = {
|
|
176
|
-
type: ComponentTypes.PrivateApp,
|
|
214
|
+
type: Projects_1.ComponentTypes.PrivateApp,
|
|
177
215
|
config: getMockPrivateAppConfig(),
|
|
178
216
|
runnable: true,
|
|
179
217
|
path: 'test/path',
|
|
180
218
|
};
|
|
181
|
-
expect(componentIsApp(component)).toBe(true);
|
|
219
|
+
expect((0, structure_1.componentIsApp)(component)).toBe(true);
|
|
182
220
|
});
|
|
183
221
|
it('returns false for null input', () => {
|
|
184
|
-
expect(componentIsApp(null)).toBe(false);
|
|
222
|
+
expect((0, structure_1.componentIsApp)(null)).toBe(false);
|
|
185
223
|
});
|
|
186
224
|
});
|
|
187
225
|
describe('componentIsPublicApp()', () => {
|
|
188
226
|
it('returns true for public app component', () => {
|
|
189
227
|
const component = {
|
|
190
|
-
type: ComponentTypes.PublicApp,
|
|
228
|
+
type: Projects_1.ComponentTypes.PublicApp,
|
|
191
229
|
// Config doesn't matter for this test so we can use a private app config
|
|
192
230
|
config: getMockPrivateAppConfig(),
|
|
193
231
|
runnable: true,
|
|
194
232
|
path: 'test/path',
|
|
195
233
|
};
|
|
196
|
-
expect(componentIsPublicApp(component)).toBe(true);
|
|
234
|
+
expect((0, structure_1.componentIsPublicApp)(component)).toBe(true);
|
|
197
235
|
});
|
|
198
236
|
it('returns false for private app component', () => {
|
|
199
237
|
const component = {
|
|
200
|
-
type: ComponentTypes.PrivateApp,
|
|
238
|
+
type: Projects_1.ComponentTypes.PrivateApp,
|
|
201
239
|
config: getMockPrivateAppConfig(),
|
|
202
240
|
runnable: true,
|
|
203
241
|
path: 'test/path',
|
|
204
242
|
};
|
|
205
|
-
expect(componentIsPublicApp(component)).toBe(false);
|
|
243
|
+
expect((0, structure_1.componentIsPublicApp)(component)).toBe(false);
|
|
206
244
|
});
|
|
207
245
|
it('returns false for null input', () => {
|
|
208
|
-
expect(componentIsPublicApp(null)).toBe(false);
|
|
246
|
+
expect((0, structure_1.componentIsPublicApp)(null)).toBe(false);
|
|
209
247
|
});
|
|
210
248
|
});
|
|
211
249
|
});
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const legacyAddComponent_1 = require("../legacyAddComponent");
|
|
4
|
+
const structure_1 = require("../../structure");
|
|
5
|
+
const legacy_1 = require("../../create/legacy");
|
|
6
|
+
const projectAddPrompt_1 = require("../../../prompts/projectAddPrompt");
|
|
7
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
8
|
+
const github_1 = require("@hubspot/local-dev-lib/github");
|
|
9
|
+
const Projects_1 = require("../../../../types/Projects");
|
|
10
|
+
const en_1 = require("../../../../lang/en");
|
|
9
11
|
vi.mock('../../structure');
|
|
10
12
|
vi.mock('../../create/legacy');
|
|
11
13
|
vi.mock('../../../prompts/projectAddPrompt');
|
|
12
14
|
vi.mock('@hubspot/local-dev-lib/logger');
|
|
13
15
|
vi.mock('@hubspot/local-dev-lib/github');
|
|
14
|
-
const mockedFindProjectComponents = vi.mocked(findProjectComponents);
|
|
15
|
-
const mockedGetProjectComponentListFromRepo = vi.mocked(getProjectComponentListFromRepo);
|
|
16
|
-
const mockedProjectAddPrompt = vi.mocked(projectAddPrompt);
|
|
17
|
-
const mockedLogger = vi.mocked(logger);
|
|
18
|
-
const mockedCloneGithubRepo = vi.mocked(cloneGithubRepo);
|
|
16
|
+
const mockedFindProjectComponents = vi.mocked(structure_1.findProjectComponents);
|
|
17
|
+
const mockedGetProjectComponentListFromRepo = vi.mocked(legacy_1.getProjectComponentListFromRepo);
|
|
18
|
+
const mockedProjectAddPrompt = vi.mocked(projectAddPrompt_1.projectAddPrompt);
|
|
19
|
+
const mockedLogger = vi.mocked(logger_1.logger);
|
|
20
|
+
const mockedCloneGithubRepo = vi.mocked(github_1.cloneGithubRepo);
|
|
19
21
|
describe('lib/projects/add/legacyAddComponent', () => {
|
|
20
22
|
const mockProjectConfig = {
|
|
21
23
|
name: 'test-project',
|
|
@@ -31,7 +33,7 @@ describe('lib/projects/add/legacyAddComponent', () => {
|
|
|
31
33
|
it('successfully adds a component to a project without public apps', async () => {
|
|
32
34
|
const mockComponents = [
|
|
33
35
|
{
|
|
34
|
-
type: ComponentTypes.PrivateApp,
|
|
36
|
+
type: Projects_1.ComponentTypes.PrivateApp,
|
|
35
37
|
config: {
|
|
36
38
|
name: 'private-app',
|
|
37
39
|
description: '',
|
|
@@ -58,7 +60,7 @@ describe('lib/projects/add/legacyAddComponent', () => {
|
|
|
58
60
|
mockedGetProjectComponentListFromRepo.mockResolvedValue(mockComponentList);
|
|
59
61
|
mockedProjectAddPrompt.mockResolvedValue(mockPromptResponse);
|
|
60
62
|
mockedCloneGithubRepo.mockResolvedValue(true);
|
|
61
|
-
await legacyAddComponent(mockArgs, projectDir, mockProjectConfig);
|
|
63
|
+
await (0, legacyAddComponent_1.legacyAddComponent)(mockArgs, projectDir, mockProjectConfig);
|
|
62
64
|
expect(mockedFindProjectComponents).toHaveBeenCalledWith(projectDir);
|
|
63
65
|
expect(mockedGetProjectComponentListFromRepo).toHaveBeenCalledWith('v1');
|
|
64
66
|
expect(mockedProjectAddPrompt).toHaveBeenCalledWith(mockComponentList, mockArgs);
|
|
@@ -67,13 +69,13 @@ describe('lib/projects/add/legacyAddComponent', () => {
|
|
|
67
69
|
branch: 'main',
|
|
68
70
|
hideLogs: true,
|
|
69
71
|
}));
|
|
70
|
-
expect(mockedLogger.log).toHaveBeenCalledWith(commands.project.add.creatingComponent('test-project'));
|
|
71
|
-
expect(mockedLogger.success).toHaveBeenCalledWith(commands.project.add.success('new-component'));
|
|
72
|
+
expect(mockedLogger.log).toHaveBeenCalledWith(en_1.commands.project.add.creatingComponent('test-project'));
|
|
73
|
+
expect(mockedLogger.success).toHaveBeenCalledWith(en_1.commands.project.add.success('new-component'));
|
|
72
74
|
});
|
|
73
75
|
it('throws an error when project contains a public app', async () => {
|
|
74
76
|
const mockComponents = [
|
|
75
77
|
{
|
|
76
|
-
type: ComponentTypes.PublicApp,
|
|
78
|
+
type: Projects_1.ComponentTypes.PublicApp,
|
|
77
79
|
config: {
|
|
78
80
|
name: 'public-app',
|
|
79
81
|
uid: '',
|
|
@@ -97,7 +99,7 @@ describe('lib/projects/add/legacyAddComponent', () => {
|
|
|
97
99
|
},
|
|
98
100
|
];
|
|
99
101
|
mockedFindProjectComponents.mockResolvedValue(mockComponents);
|
|
100
|
-
await expect(legacyAddComponent(mockArgs, projectDir, mockProjectConfig)).rejects.toThrow(commands.project.add.error.projectContainsPublicApp);
|
|
102
|
+
await expect((0, legacyAddComponent_1.legacyAddComponent)(mockArgs, projectDir, mockProjectConfig)).rejects.toThrow(en_1.commands.project.add.error.projectContainsPublicApp);
|
|
101
103
|
expect(mockedGetProjectComponentListFromRepo).not.toHaveBeenCalled();
|
|
102
104
|
expect(mockedProjectAddPrompt).not.toHaveBeenCalled();
|
|
103
105
|
expect(mockedCloneGithubRepo).not.toHaveBeenCalled();
|
|
@@ -118,7 +120,7 @@ describe('lib/projects/add/legacyAddComponent', () => {
|
|
|
118
120
|
mockedGetProjectComponentListFromRepo.mockResolvedValue(mockComponentList);
|
|
119
121
|
mockedProjectAddPrompt.mockResolvedValue(mockPromptResponse);
|
|
120
122
|
mockedCloneGithubRepo.mockResolvedValue(true);
|
|
121
|
-
await legacyAddComponent(mockArgs, projectDir, mockProjectConfig);
|
|
123
|
+
await (0, legacyAddComponent_1.legacyAddComponent)(mockArgs, projectDir, mockProjectConfig);
|
|
122
124
|
expect(mockedGetProjectComponentListFromRepo).toHaveBeenCalledWith('v1');
|
|
123
125
|
expect(mockedProjectAddPrompt).toHaveBeenCalledWith(mockComponentList, mockArgs);
|
|
124
126
|
expect(mockedCloneGithubRepo).toHaveBeenCalled();
|
|
@@ -126,7 +128,7 @@ describe('lib/projects/add/legacyAddComponent', () => {
|
|
|
126
128
|
it('throws an error when component list is empty', async () => {
|
|
127
129
|
const mockComponents = [
|
|
128
130
|
{
|
|
129
|
-
type: ComponentTypes.PrivateApp,
|
|
131
|
+
type: Projects_1.ComponentTypes.PrivateApp,
|
|
130
132
|
config: {
|
|
131
133
|
name: 'private-app',
|
|
132
134
|
description: '',
|
|
@@ -140,14 +142,14 @@ describe('lib/projects/add/legacyAddComponent', () => {
|
|
|
140
142
|
];
|
|
141
143
|
mockedFindProjectComponents.mockResolvedValue(mockComponents);
|
|
142
144
|
mockedGetProjectComponentListFromRepo.mockResolvedValue([]);
|
|
143
|
-
await expect(legacyAddComponent(mockArgs, projectDir, mockProjectConfig)).rejects.toThrow(commands.project.add.error.failedToFetchComponentList);
|
|
145
|
+
await expect((0, legacyAddComponent_1.legacyAddComponent)(mockArgs, projectDir, mockProjectConfig)).rejects.toThrow(en_1.commands.project.add.error.failedToFetchComponentList);
|
|
144
146
|
expect(mockedProjectAddPrompt).not.toHaveBeenCalled();
|
|
145
147
|
expect(mockedCloneGithubRepo).not.toHaveBeenCalled();
|
|
146
148
|
});
|
|
147
149
|
it('throws an error when component list is null', async () => {
|
|
148
150
|
const mockComponents = [
|
|
149
151
|
{
|
|
150
|
-
type: ComponentTypes.PrivateApp,
|
|
152
|
+
type: Projects_1.ComponentTypes.PrivateApp,
|
|
151
153
|
config: {
|
|
152
154
|
name: 'private-app',
|
|
153
155
|
description: '',
|
|
@@ -162,14 +164,14 @@ describe('lib/projects/add/legacyAddComponent', () => {
|
|
|
162
164
|
mockedFindProjectComponents.mockResolvedValue(mockComponents);
|
|
163
165
|
// @ts-expect-error Breaking stuff on purpose
|
|
164
166
|
mockedGetProjectComponentListFromRepo.mockResolvedValue(null);
|
|
165
|
-
await expect(legacyAddComponent(mockArgs, projectDir, mockProjectConfig)).rejects.toThrow(commands.project.add.error.failedToFetchComponentList);
|
|
167
|
+
await expect((0, legacyAddComponent_1.legacyAddComponent)(mockArgs, projectDir, mockProjectConfig)).rejects.toThrow(en_1.commands.project.add.error.failedToFetchComponentList);
|
|
166
168
|
expect(mockedProjectAddPrompt).not.toHaveBeenCalled();
|
|
167
169
|
expect(mockedCloneGithubRepo).not.toHaveBeenCalled();
|
|
168
170
|
});
|
|
169
171
|
it('throws an error when cloning fails', async () => {
|
|
170
172
|
const mockComponents = [
|
|
171
173
|
{
|
|
172
|
-
type: ComponentTypes.PrivateApp,
|
|
174
|
+
type: Projects_1.ComponentTypes.PrivateApp,
|
|
173
175
|
config: {
|
|
174
176
|
name: 'private-app',
|
|
175
177
|
description: '',
|
|
@@ -196,7 +198,7 @@ describe('lib/projects/add/legacyAddComponent', () => {
|
|
|
196
198
|
mockedGetProjectComponentListFromRepo.mockResolvedValue(mockComponentList);
|
|
197
199
|
mockedProjectAddPrompt.mockResolvedValue(mockPromptResponse);
|
|
198
200
|
mockedCloneGithubRepo.mockRejectedValue(new Error('Clone failed'));
|
|
199
|
-
await expect(legacyAddComponent(mockArgs, projectDir, mockProjectConfig)).rejects.toThrow(commands.project.add.error.failedToDownloadComponent);
|
|
201
|
+
await expect((0, legacyAddComponent_1.legacyAddComponent)(mockArgs, projectDir, mockProjectConfig)).rejects.toThrow(en_1.commands.project.add.error.failedToDownloadComponent);
|
|
200
202
|
expect(mockedCloneGithubRepo).toHaveBeenCalled();
|
|
201
203
|
expect(mockedLogger.success).not.toHaveBeenCalled();
|
|
202
204
|
});
|