@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
package/lang/en.lyaml
CHANGED
|
@@ -681,32 +681,6 @@ en:
|
|
|
681
681
|
examples:
|
|
682
682
|
default: "Create a component within your project"
|
|
683
683
|
withFlags: "Use --name and --type flags to bypass the prompt."
|
|
684
|
-
deploy:
|
|
685
|
-
describe: "Deploy a project build."
|
|
686
|
-
deployBuildIdPrompt: "[--build] Deploy which build?"
|
|
687
|
-
debug:
|
|
688
|
-
deploying: "Deploying project at path: {{ path }}"
|
|
689
|
-
errors:
|
|
690
|
-
deploy: "Deploy error: an unknown error occurred."
|
|
691
|
-
noBuilds: "Deploy error: no builds for this project were found."
|
|
692
|
-
noBuildId: "You must specify a build to deploy"
|
|
693
|
-
projectNotFound: "The project {{ projectName }} does not exist in account {{ accountIdentifier }}. Run {{ command }} to upload your project files to HubSpot."
|
|
694
|
-
buildIdDoesNotExist: "Build {{ buildId }} does not exist for project {{ projectName }}. {{ linkToProject }}"
|
|
695
|
-
buildAlreadyDeployed: "Build {{ buildId }} is already deployed. {{ linkToProject}}"
|
|
696
|
-
viewProjectsBuilds: 'View project builds in HubSpot'
|
|
697
|
-
deployContainsRemovals: "- This deploy would remove the {{#bold}}{{ componentName }}{{/bold}} component. To proceed, run the deploy command with the {{ forceFlag }} flag"
|
|
698
|
-
examples:
|
|
699
|
-
default: "Deploy the latest build of the current project"
|
|
700
|
-
withOptions: "Deploy build 5 of the project my-project"
|
|
701
|
-
options:
|
|
702
|
-
build:
|
|
703
|
-
describe: "Project build ID to be deployed"
|
|
704
|
-
project:
|
|
705
|
-
describe: "Project name"
|
|
706
|
-
profile:
|
|
707
|
-
describe: "The profile to target with this deploy"
|
|
708
|
-
force:
|
|
709
|
-
describe: "Skip warnings and force deploy. Use this carefully as it will bypass warnings for destructive actions."
|
|
710
684
|
listBuilds:
|
|
711
685
|
describe: "List the project's builds."
|
|
712
686
|
continueOrExitPrompt: "Press <enter> to load more, or ctrl+c to exit"
|
|
@@ -1,97 +1,99 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const config_1 = require("@hubspot/local-dev-lib/constants/config");
|
|
4
|
+
const accountTypes_1 = require("../accountTypes");
|
|
3
5
|
const STANDARD_ACCOUNT = {
|
|
4
6
|
name: 'standard-account',
|
|
5
7
|
accountId: 123,
|
|
6
|
-
accountType: HUBSPOT_ACCOUNT_TYPES.STANDARD,
|
|
8
|
+
accountType: config_1.HUBSPOT_ACCOUNT_TYPES.STANDARD,
|
|
7
9
|
env: 'prod',
|
|
8
10
|
};
|
|
9
11
|
const DEVELOPMENT_SANDBOX_ACCOUNT = {
|
|
10
12
|
name: 'development-sandbox-account',
|
|
11
13
|
accountId: 456,
|
|
12
|
-
accountType: HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX,
|
|
14
|
+
accountType: config_1.HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX,
|
|
13
15
|
env: 'prod',
|
|
14
16
|
};
|
|
15
17
|
const STANDARD_SANDBOX_ACCOUNT = {
|
|
16
18
|
name: 'sandbox-account',
|
|
17
19
|
accountId: 456,
|
|
18
|
-
accountType: HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX,
|
|
20
|
+
accountType: config_1.HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX,
|
|
19
21
|
env: 'prod',
|
|
20
22
|
};
|
|
21
23
|
const DEVELOPER_TEST_ACCOUNT = {
|
|
22
24
|
name: 'developer-test-account',
|
|
23
25
|
accountId: 789,
|
|
24
|
-
accountType: HUBSPOT_ACCOUNT_TYPES.DEVELOPER_TEST,
|
|
26
|
+
accountType: config_1.HUBSPOT_ACCOUNT_TYPES.DEVELOPER_TEST,
|
|
25
27
|
env: 'prod',
|
|
26
28
|
};
|
|
27
29
|
const APP_DEVELOPER_ACCOUNT = {
|
|
28
30
|
name: 'app-developer-account',
|
|
29
31
|
accountId: 1011,
|
|
30
|
-
accountType: HUBSPOT_ACCOUNT_TYPES.APP_DEVELOPER,
|
|
32
|
+
accountType: config_1.HUBSPOT_ACCOUNT_TYPES.APP_DEVELOPER,
|
|
31
33
|
env: 'prod',
|
|
32
34
|
};
|
|
33
35
|
describe('lib/accountTypes', () => {
|
|
34
36
|
describe('isStandardAccount()', () => {
|
|
35
37
|
it('should return true if the account is a standard account', () => {
|
|
36
|
-
const result = isStandardAccount(STANDARD_ACCOUNT);
|
|
38
|
+
const result = (0, accountTypes_1.isStandardAccount)(STANDARD_ACCOUNT);
|
|
37
39
|
expect(result).toBe(true);
|
|
38
40
|
});
|
|
39
41
|
it('should return false if the account is not a standard account', () => {
|
|
40
|
-
const result = isStandardAccount(DEVELOPER_TEST_ACCOUNT);
|
|
42
|
+
const result = (0, accountTypes_1.isStandardAccount)(DEVELOPER_TEST_ACCOUNT);
|
|
41
43
|
expect(result).toBe(false);
|
|
42
44
|
});
|
|
43
45
|
});
|
|
44
46
|
describe('isSandbox()', () => {
|
|
45
47
|
it('should return true if the account is a standard sandbox account', () => {
|
|
46
|
-
const result = isSandbox(STANDARD_SANDBOX_ACCOUNT);
|
|
48
|
+
const result = (0, accountTypes_1.isSandbox)(STANDARD_SANDBOX_ACCOUNT);
|
|
47
49
|
expect(result).toBe(true);
|
|
48
50
|
});
|
|
49
51
|
it('should return true if the account is a development sandbox account', () => {
|
|
50
|
-
const result = isSandbox(DEVELOPMENT_SANDBOX_ACCOUNT);
|
|
52
|
+
const result = (0, accountTypes_1.isSandbox)(DEVELOPMENT_SANDBOX_ACCOUNT);
|
|
51
53
|
expect(result).toBe(true);
|
|
52
54
|
});
|
|
53
55
|
it('should return false if the account is not a sandbox account', () => {
|
|
54
|
-
const result = isSandbox(STANDARD_ACCOUNT);
|
|
56
|
+
const result = (0, accountTypes_1.isSandbox)(STANDARD_ACCOUNT);
|
|
55
57
|
expect(result).toBe(false);
|
|
56
58
|
});
|
|
57
59
|
});
|
|
58
60
|
describe('isStandardSandbox()', () => {
|
|
59
61
|
it('should return true if the account is a standard sandbox account', () => {
|
|
60
|
-
const result = isStandardSandbox(STANDARD_SANDBOX_ACCOUNT);
|
|
62
|
+
const result = (0, accountTypes_1.isStandardSandbox)(STANDARD_SANDBOX_ACCOUNT);
|
|
61
63
|
expect(result).toBe(true);
|
|
62
64
|
});
|
|
63
65
|
it('should return false if the account is not a standard sandbox account', () => {
|
|
64
|
-
const result = isStandardSandbox(DEVELOPMENT_SANDBOX_ACCOUNT);
|
|
66
|
+
const result = (0, accountTypes_1.isStandardSandbox)(DEVELOPMENT_SANDBOX_ACCOUNT);
|
|
65
67
|
expect(result).toBe(false);
|
|
66
68
|
});
|
|
67
69
|
});
|
|
68
70
|
describe('isDevelopmentSandbox()', () => {
|
|
69
71
|
it('should return true if the account is a development sandbox account', () => {
|
|
70
|
-
const result = isDevelopmentSandbox(DEVELOPMENT_SANDBOX_ACCOUNT);
|
|
72
|
+
const result = (0, accountTypes_1.isDevelopmentSandbox)(DEVELOPMENT_SANDBOX_ACCOUNT);
|
|
71
73
|
expect(result).toBe(true);
|
|
72
74
|
});
|
|
73
75
|
it('should return false if the account is not a development sandbox account', () => {
|
|
74
|
-
const result = isDevelopmentSandbox(STANDARD_ACCOUNT);
|
|
76
|
+
const result = (0, accountTypes_1.isDevelopmentSandbox)(STANDARD_ACCOUNT);
|
|
75
77
|
expect(result).toBe(false);
|
|
76
78
|
});
|
|
77
79
|
});
|
|
78
80
|
describe('isDeveloperTestAccount()', () => {
|
|
79
81
|
it('should return true if the account is a developer test account', () => {
|
|
80
|
-
const result = isDeveloperTestAccount(DEVELOPER_TEST_ACCOUNT);
|
|
82
|
+
const result = (0, accountTypes_1.isDeveloperTestAccount)(DEVELOPER_TEST_ACCOUNT);
|
|
81
83
|
expect(result).toBe(true);
|
|
82
84
|
});
|
|
83
85
|
it('should return false if the account is not a developer test account', () => {
|
|
84
|
-
const result = isDeveloperTestAccount(STANDARD_ACCOUNT);
|
|
86
|
+
const result = (0, accountTypes_1.isDeveloperTestAccount)(STANDARD_ACCOUNT);
|
|
85
87
|
expect(result).toBe(false);
|
|
86
88
|
});
|
|
87
89
|
});
|
|
88
90
|
describe('isAppDeveloperAccount()', () => {
|
|
89
91
|
it('should return true if the account is an app developer account', () => {
|
|
90
|
-
const result = isAppDeveloperAccount(APP_DEVELOPER_ACCOUNT);
|
|
92
|
+
const result = (0, accountTypes_1.isAppDeveloperAccount)(APP_DEVELOPER_ACCOUNT);
|
|
91
93
|
expect(result).toBe(true);
|
|
92
94
|
});
|
|
93
95
|
it('should return false if the account is not an app developer account', () => {
|
|
94
|
-
const result = isAppDeveloperAccount(STANDARD_ACCOUNT);
|
|
96
|
+
const result = (0, accountTypes_1.isAppDeveloperAccount)(STANDARD_ACCOUNT);
|
|
95
97
|
expect(result).toBe(false);
|
|
96
98
|
});
|
|
97
99
|
});
|
|
@@ -1,11 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const personalAccessKey_1 = require("@hubspot/local-dev-lib/personalAccessKey");
|
|
37
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
38
|
+
const developerTestAccounts_1 = require("@hubspot/local-dev-lib/api/developerTestAccounts");
|
|
39
|
+
const sandboxHubs_1 = require("@hubspot/local-dev-lib/api/sandboxHubs");
|
|
40
|
+
const config_2 = require("@hubspot/local-dev-lib/constants/config");
|
|
41
|
+
const personalAccessKeyPrompt_1 = require("../prompts/personalAccessKeyPrompt");
|
|
42
|
+
const accountNamePrompt_1 = require("../prompts/accountNamePrompt");
|
|
43
|
+
const buildAccount = __importStar(require("../buildAccount"));
|
|
9
44
|
vi.mock('@hubspot/local-dev-lib/personalAccessKey');
|
|
10
45
|
vi.mock('@hubspot/local-dev-lib/config');
|
|
11
46
|
vi.mock('@hubspot/local-dev-lib/api/developerTestAccounts');
|
|
@@ -21,22 +56,24 @@ vi.mock('../ui/SpinniesManager', () => ({
|
|
|
21
56
|
fail: vi.fn(),
|
|
22
57
|
},
|
|
23
58
|
}));
|
|
24
|
-
const mockedPersonalAccessKeyPrompt = personalAccessKeyPrompt;
|
|
25
|
-
const mockedGetAccessToken = getAccessToken;
|
|
26
|
-
const mockedUpdateConfigWithAccessToken = updateConfigWithAccessToken;
|
|
27
|
-
const mockedAccountNameExistsInConfig = accountNameExistsInConfig;
|
|
28
|
-
const mockedUpdateAccountConfig = updateAccountConfig;
|
|
29
|
-
const mockedWriteConfig = writeConfig;
|
|
30
|
-
const mockedCliAccountNamePrompt = cliAccountNamePrompt;
|
|
31
|
-
const mockedGetAccountId = getAccountId;
|
|
32
|
-
const mockedCreateDeveloperTestAccount = createDeveloperTestAccount;
|
|
33
|
-
const
|
|
59
|
+
const mockedPersonalAccessKeyPrompt = personalAccessKeyPrompt_1.personalAccessKeyPrompt;
|
|
60
|
+
const mockedGetAccessToken = personalAccessKey_1.getAccessToken;
|
|
61
|
+
const mockedUpdateConfigWithAccessToken = personalAccessKey_1.updateConfigWithAccessToken;
|
|
62
|
+
const mockedAccountNameExistsInConfig = config_1.accountNameExistsInConfig;
|
|
63
|
+
const mockedUpdateAccountConfig = config_1.updateAccountConfig;
|
|
64
|
+
const mockedWriteConfig = config_1.writeConfig;
|
|
65
|
+
const mockedCliAccountNamePrompt = accountNamePrompt_1.cliAccountNamePrompt;
|
|
66
|
+
const mockedGetAccountId = config_1.getAccountId;
|
|
67
|
+
const mockedCreateDeveloperTestAccount = developerTestAccounts_1.createDeveloperTestAccount;
|
|
68
|
+
const mockedFetchDeveloperTestAccountGateSyncStatus = developerTestAccounts_1.fetchDeveloperTestAccountGateSyncStatus;
|
|
69
|
+
const mockedGenerateDeveloperTestAccountPersonalAccessKey = developerTestAccounts_1.generateDeveloperTestAccountPersonalAccessKey;
|
|
70
|
+
const mockedCreateSandbox = sandboxHubs_1.createSandbox;
|
|
34
71
|
describe('lib/buildAccount', () => {
|
|
35
72
|
describe('saveAccountToConfig()', () => {
|
|
36
73
|
const mockAccountConfig = {
|
|
37
74
|
name: 'Test Account',
|
|
38
75
|
accountId: 123456,
|
|
39
|
-
accountType: HUBSPOT_ACCOUNT_TYPES.APP_DEVELOPER,
|
|
76
|
+
accountType: config_2.HUBSPOT_ACCOUNT_TYPES.APP_DEVELOPER,
|
|
40
77
|
env: 'prod',
|
|
41
78
|
};
|
|
42
79
|
const accessToken = {
|
|
@@ -47,7 +84,7 @@ describe('lib/buildAccount', () => {
|
|
|
47
84
|
enabledFeatures: { 'test-feature': 1 },
|
|
48
85
|
encodedOAuthRefreshToken: 'test-refresh-token',
|
|
49
86
|
hubName: 'test-hub',
|
|
50
|
-
accountType: HUBSPOT_ACCOUNT_TYPES.STANDARD,
|
|
87
|
+
accountType: config_2.HUBSPOT_ACCOUNT_TYPES.STANDARD,
|
|
51
88
|
};
|
|
52
89
|
beforeEach(() => {
|
|
53
90
|
mockedPersonalAccessKeyPrompt.mockResolvedValue({
|
|
@@ -97,11 +134,37 @@ describe('lib/buildAccount', () => {
|
|
|
97
134
|
expect(result).toBe('test-account-with-new-name');
|
|
98
135
|
});
|
|
99
136
|
});
|
|
137
|
+
describe('createDeveloperTestAccountV3()', () => {
|
|
138
|
+
const parentAccountId = 123456;
|
|
139
|
+
const mockDeveoperTestAccountConfig = {
|
|
140
|
+
accountName: 'Developer Test Account',
|
|
141
|
+
description: 'Test Account created by the HubSpot CLI',
|
|
142
|
+
};
|
|
143
|
+
beforeEach(() => {
|
|
144
|
+
mockedCreateDeveloperTestAccount.mockResolvedValue({
|
|
145
|
+
data: { id: 123456 },
|
|
146
|
+
});
|
|
147
|
+
mockedFetchDeveloperTestAccountGateSyncStatus.mockResolvedValue({
|
|
148
|
+
data: { status: 'SUCCESS' },
|
|
149
|
+
});
|
|
150
|
+
mockedGenerateDeveloperTestAccountPersonalAccessKey.mockResolvedValue({
|
|
151
|
+
data: { personalAccessKey: 'test-key' },
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
it('should create a developer test account successfully', async () => {
|
|
155
|
+
const result = await buildAccount.createDeveloperTestAccountV3(parentAccountId, mockDeveoperTestAccountConfig);
|
|
156
|
+
expect(result).toEqual({
|
|
157
|
+
accountName: mockDeveoperTestAccountConfig.accountName,
|
|
158
|
+
accountId: 123456,
|
|
159
|
+
personalAccessKey: 'test-key',
|
|
160
|
+
});
|
|
161
|
+
}, 10000);
|
|
162
|
+
});
|
|
100
163
|
describe('buildDeveloperTestAccount()', () => {
|
|
101
164
|
const mockParentAccountConfig = {
|
|
102
|
-
name: 'Developer
|
|
165
|
+
name: 'Developer Account',
|
|
103
166
|
accountId: 123456,
|
|
104
|
-
accountType: HUBSPOT_ACCOUNT_TYPES.
|
|
167
|
+
accountType: config_2.HUBSPOT_ACCOUNT_TYPES.APP_DEVELOPER,
|
|
105
168
|
env: 'prod',
|
|
106
169
|
};
|
|
107
170
|
const mockDeveloperTestAccount = {
|
|
@@ -140,7 +203,7 @@ describe('lib/buildAccount', () => {
|
|
|
140
203
|
const mockParentAccountConfig = {
|
|
141
204
|
name: 'Developer Test Account',
|
|
142
205
|
accountId: 123456,
|
|
143
|
-
accountType: HUBSPOT_ACCOUNT_TYPES.DEVELOPER_TEST,
|
|
206
|
+
accountType: config_2.HUBSPOT_ACCOUNT_TYPES.DEVELOPER_TEST,
|
|
144
207
|
env: 'prod',
|
|
145
208
|
};
|
|
146
209
|
const mockSandbox = {
|
|
@@ -169,7 +232,7 @@ describe('lib/buildAccount', () => {
|
|
|
169
232
|
vi.clearAllMocks();
|
|
170
233
|
});
|
|
171
234
|
it('should create a standard sandbox successfully', async () => {
|
|
172
|
-
const result = await buildAccount.buildSandbox(mockSandbox.name, mockParentAccountConfig, HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX, mockParentAccountConfig.env, false);
|
|
235
|
+
const result = await buildAccount.buildSandbox(mockSandbox.name, mockParentAccountConfig, config_2.HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX, mockParentAccountConfig.env, false);
|
|
173
236
|
expect(result).toEqual({
|
|
174
237
|
name: mockSandbox.name,
|
|
175
238
|
personalAccessKey: 'test-key',
|
|
@@ -177,7 +240,7 @@ describe('lib/buildAccount', () => {
|
|
|
177
240
|
});
|
|
178
241
|
});
|
|
179
242
|
it('should create a development sandbox successfully', async () => {
|
|
180
|
-
const result = await buildAccount.buildSandbox(mockSandbox.name, mockParentAccountConfig, HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX, mockParentAccountConfig.env);
|
|
243
|
+
const result = await buildAccount.buildSandbox(mockSandbox.name, mockParentAccountConfig, config_2.HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX, mockParentAccountConfig.env);
|
|
181
244
|
expect(result).toEqual({
|
|
182
245
|
name: mockSandbox.name,
|
|
183
246
|
personalAccessKey: 'test-key',
|
|
@@ -186,11 +249,11 @@ describe('lib/buildAccount', () => {
|
|
|
186
249
|
});
|
|
187
250
|
it('should throw error if account ID is not found', async () => {
|
|
188
251
|
mockedGetAccountId.mockReturnValue(null);
|
|
189
|
-
await expect(buildAccount.buildSandbox(mockSandbox.name, mockParentAccountConfig, HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX, mockParentAccountConfig.env)).rejects.toThrow();
|
|
252
|
+
await expect(buildAccount.buildSandbox(mockSandbox.name, mockParentAccountConfig, config_2.HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX, mockParentAccountConfig.env)).rejects.toThrow();
|
|
190
253
|
});
|
|
191
254
|
it('should handle API errors when creating sandbox', async () => {
|
|
192
255
|
mockedCreateSandbox.mockRejectedValue(new Error('test-error'));
|
|
193
|
-
await expect(buildAccount.buildSandbox(mockSandbox.name, mockParentAccountConfig, HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX, mockParentAccountConfig.env, false)).rejects.toThrow();
|
|
256
|
+
await expect(buildAccount.buildSandbox(mockSandbox.name, mockParentAccountConfig, config_2.HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX, mockParentAccountConfig.env, false)).rejects.toThrow();
|
|
194
257
|
});
|
|
195
258
|
});
|
|
196
259
|
});
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const files_1 = require("@hubspot/local-dev-lib/constants/files");
|
|
4
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
5
|
+
const commonOpts_1 = require("../commonOpts");
|
|
6
|
+
const mockedGetAccountConfig = config_1.getAccountConfig;
|
|
7
|
+
const mockedGetAndLoadConfigIfNeeded = config_1.getAndLoadConfigIfNeeded;
|
|
8
|
+
const mockedLoadConfigFromEnvironment = config_1.loadConfigFromEnvironment;
|
|
7
9
|
function buildArguments(args) {
|
|
8
10
|
return {
|
|
9
11
|
_: [],
|
|
@@ -22,7 +24,7 @@ describe('lib/commonOpts', () => {
|
|
|
22
24
|
const devAccountConfig = {
|
|
23
25
|
accountId: accounts.DEV,
|
|
24
26
|
name: 'DEV',
|
|
25
|
-
defaultCmsPublishMode: CMS_PUBLISH_MODE.draft,
|
|
27
|
+
defaultCmsPublishMode: files_1.CMS_PUBLISH_MODE.draft,
|
|
26
28
|
};
|
|
27
29
|
const prodAccountConfig = {
|
|
28
30
|
accountId: accounts.PROD,
|
|
@@ -34,7 +36,7 @@ describe('lib/commonOpts', () => {
|
|
|
34
36
|
};
|
|
35
37
|
const configWithDefaultCmsPublishMode = {
|
|
36
38
|
...config,
|
|
37
|
-
defaultCmsPublishMode: CMS_PUBLISH_MODE.draft,
|
|
39
|
+
defaultCmsPublishMode: files_1.CMS_PUBLISH_MODE.draft,
|
|
38
40
|
};
|
|
39
41
|
afterEach(() => {
|
|
40
42
|
vi.resetAllMocks();
|
|
@@ -44,12 +46,12 @@ describe('lib/commonOpts', () => {
|
|
|
44
46
|
it('should return the cms publish mode specified by the command option if present.', () => {
|
|
45
47
|
mockedGetAndLoadConfigIfNeeded.mockReturnValue(configWithDefaultCmsPublishMode);
|
|
46
48
|
mockedGetAccountConfig.mockReturnValue(devAccountConfig);
|
|
47
|
-
expect(getCmsPublishMode(buildArguments({
|
|
48
|
-
cmsPublishMode: CMS_PUBLISH_MODE.draft,
|
|
49
|
-
}))).toBe(CMS_PUBLISH_MODE.draft);
|
|
50
|
-
expect(getCmsPublishMode(buildArguments({
|
|
51
|
-
cmsPublishMode: CMS_PUBLISH_MODE.publish,
|
|
52
|
-
}))).toBe(CMS_PUBLISH_MODE.publish);
|
|
49
|
+
expect((0, commonOpts_1.getCmsPublishMode)(buildArguments({
|
|
50
|
+
cmsPublishMode: files_1.CMS_PUBLISH_MODE.draft,
|
|
51
|
+
}))).toBe(files_1.CMS_PUBLISH_MODE.draft);
|
|
52
|
+
expect((0, commonOpts_1.getCmsPublishMode)(buildArguments({
|
|
53
|
+
cmsPublishMode: files_1.CMS_PUBLISH_MODE.publish,
|
|
54
|
+
}))).toBe(files_1.CMS_PUBLISH_MODE.publish);
|
|
53
55
|
});
|
|
54
56
|
});
|
|
55
57
|
describe('2. hubspot.config.yml -> config.accounts[x].defaultCmsPublishMode', () => {
|
|
@@ -57,9 +59,9 @@ describe('lib/commonOpts', () => {
|
|
|
57
59
|
mockedGetAndLoadConfigIfNeeded.mockReturnValue(configWithDefaultCmsPublishMode);
|
|
58
60
|
mockedGetAccountConfig.mockReturnValue(devAccountConfig);
|
|
59
61
|
mockedLoadConfigFromEnvironment.mockReturnValue(undefined);
|
|
60
|
-
expect(getCmsPublishMode(buildArguments({
|
|
62
|
+
expect((0, commonOpts_1.getCmsPublishMode)(buildArguments({
|
|
61
63
|
account: accounts.DEV,
|
|
62
|
-
}))).toBe(CMS_PUBLISH_MODE.draft);
|
|
64
|
+
}))).toBe(files_1.CMS_PUBLISH_MODE.draft);
|
|
63
65
|
});
|
|
64
66
|
});
|
|
65
67
|
describe('3. hubspot.config.yml -> config.defaultCmsPublishMode', () => {
|
|
@@ -67,17 +69,17 @@ describe('lib/commonOpts', () => {
|
|
|
67
69
|
mockedGetAndLoadConfigIfNeeded.mockReturnValue(configWithDefaultCmsPublishMode);
|
|
68
70
|
mockedGetAccountConfig.mockReturnValue(prodAccountConfig);
|
|
69
71
|
mockedLoadConfigFromEnvironment.mockReturnValue(undefined);
|
|
70
|
-
expect(getCmsPublishMode(buildArguments({
|
|
72
|
+
expect((0, commonOpts_1.getCmsPublishMode)(buildArguments({
|
|
71
73
|
account: accounts.PROD,
|
|
72
|
-
}))).toBe(CMS_PUBLISH_MODE.draft);
|
|
74
|
+
}))).toBe(files_1.CMS_PUBLISH_MODE.draft);
|
|
73
75
|
});
|
|
74
76
|
});
|
|
75
77
|
describe('4. DEFAULT_CMS_PUBLISH_MODE', () => {
|
|
76
78
|
it('should return the defaultCmsPubishMode specified by the config if present.', () => {
|
|
77
79
|
mockedLoadConfigFromEnvironment.mockReturnValue(undefined);
|
|
78
|
-
expect(getCmsPublishMode(buildArguments({
|
|
80
|
+
expect((0, commonOpts_1.getCmsPublishMode)(buildArguments({
|
|
79
81
|
account: 'xxxxx',
|
|
80
|
-
}))).toBe(DEFAULT_CMS_PUBLISH_MODE);
|
|
82
|
+
}))).toBe(files_1.DEFAULT_CMS_PUBLISH_MODE);
|
|
81
83
|
});
|
|
82
84
|
});
|
|
83
85
|
});
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const util_1 = __importDefault(require("util"));
|
|
7
|
+
const dependencyManagement_1 = require("../dependencyManagement");
|
|
8
|
+
const fs_1 = require("@hubspot/local-dev-lib/fs");
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const config_1 = require("../projects/config");
|
|
11
|
+
const SpinniesManager_1 = __importDefault(require("../ui/SpinniesManager"));
|
|
12
|
+
const fs_2 = __importDefault(require("fs"));
|
|
8
13
|
vi.mock('../projects/config');
|
|
9
14
|
vi.mock('@hubspot/local-dev-lib/logger');
|
|
10
15
|
vi.mock('@hubspot/local-dev-lib/fs');
|
|
@@ -17,14 +22,14 @@ vi.mock('../ui/SpinniesManager', () => ({
|
|
|
17
22
|
fail: vi.fn(),
|
|
18
23
|
},
|
|
19
24
|
}));
|
|
20
|
-
const mockedFs = vi.mocked(
|
|
25
|
+
const mockedFs = vi.mocked(fs_2.default);
|
|
21
26
|
describe('lib/dependencyManagement', () => {
|
|
22
27
|
let execMock;
|
|
23
|
-
const projectDir =
|
|
28
|
+
const projectDir = path_1.default.join('path', 'to', 'project');
|
|
24
29
|
const srcDir = 'src';
|
|
25
|
-
const appDir =
|
|
26
|
-
const appFunctionsDir =
|
|
27
|
-
const extensionsDir =
|
|
30
|
+
const appDir = path_1.default.join(projectDir, srcDir, 'app');
|
|
31
|
+
const appFunctionsDir = path_1.default.join(appDir, 'app.functions');
|
|
32
|
+
const extensionsDir = path_1.default.join(appDir, 'exensions');
|
|
28
33
|
const projectName = 'super cool test project';
|
|
29
34
|
const installLocations = [appFunctionsDir, extensionsDir];
|
|
30
35
|
function mockedPromisify(execMock) {
|
|
@@ -32,11 +37,11 @@ describe('lib/dependencyManagement', () => {
|
|
|
32
37
|
.fn()
|
|
33
38
|
.mockReturnValue(execMock);
|
|
34
39
|
}
|
|
35
|
-
const mockedWalk = walk;
|
|
36
|
-
const mockedGetProjectConfig = getProjectConfig;
|
|
40
|
+
const mockedWalk = fs_1.walk;
|
|
41
|
+
const mockedGetProjectConfig = config_1.getProjectConfig;
|
|
37
42
|
beforeEach(() => {
|
|
38
43
|
execMock = vi.fn();
|
|
39
|
-
|
|
44
|
+
util_1.default.promisify = mockedPromisify(execMock);
|
|
40
45
|
mockedGetProjectConfig.mockResolvedValue({
|
|
41
46
|
projectDir,
|
|
42
47
|
projectConfig: {
|
|
@@ -50,31 +55,31 @@ describe('lib/dependencyManagement', () => {
|
|
|
50
55
|
describe('installPackages()', () => {
|
|
51
56
|
it('should setup a loading spinner', async () => {
|
|
52
57
|
const packages = ['package1', 'package2'];
|
|
53
|
-
await installPackages({ packages, installLocations });
|
|
54
|
-
expect(
|
|
55
|
-
expect(
|
|
56
|
-
expect(
|
|
58
|
+
await (0, dependencyManagement_1.installPackages)({ packages, installLocations });
|
|
59
|
+
expect(SpinniesManager_1.default.init).toHaveBeenCalledTimes(installLocations.length);
|
|
60
|
+
expect(SpinniesManager_1.default.add).toHaveBeenCalledTimes(installLocations.length);
|
|
61
|
+
expect(SpinniesManager_1.default.succeed).toHaveBeenCalledTimes(installLocations.length);
|
|
57
62
|
});
|
|
58
63
|
it('should install the provided packages in all the provided install locations', async () => {
|
|
59
64
|
const packages = ['package1', 'package2'];
|
|
60
|
-
await installPackages({ packages, installLocations });
|
|
65
|
+
await (0, dependencyManagement_1.installPackages)({ packages, installLocations });
|
|
61
66
|
expect(execMock).toHaveBeenCalledTimes(installLocations.length);
|
|
62
|
-
expect(
|
|
63
|
-
expect(
|
|
67
|
+
expect(SpinniesManager_1.default.add).toHaveBeenCalledTimes(installLocations.length);
|
|
68
|
+
expect(SpinniesManager_1.default.succeed).toHaveBeenCalledTimes(installLocations.length);
|
|
64
69
|
for (const location of installLocations) {
|
|
65
70
|
expect(execMock).toHaveBeenCalledWith(`npm install package1 package2`, {
|
|
66
71
|
cwd: location,
|
|
67
72
|
});
|
|
68
|
-
expect(
|
|
73
|
+
expect(SpinniesManager_1.default.add).toHaveBeenCalledWith(`installingDependencies-${location}`, {
|
|
69
74
|
text: `Installing [package1, package2] in ${location}`,
|
|
70
75
|
});
|
|
71
|
-
expect(
|
|
76
|
+
expect(SpinniesManager_1.default.succeed).toHaveBeenCalledWith(`installingDependencies-${location}`, {
|
|
72
77
|
text: `Installed dependencies in ${location}`,
|
|
73
78
|
});
|
|
74
79
|
}
|
|
75
80
|
});
|
|
76
81
|
it('should use the provided install locations', async () => {
|
|
77
|
-
await installPackages({ installLocations });
|
|
82
|
+
await (0, dependencyManagement_1.installPackages)({ installLocations });
|
|
78
83
|
expect(execMock).toHaveBeenCalledTimes(installLocations.length);
|
|
79
84
|
expect(execMock).toHaveBeenCalledWith(`npm install `, {
|
|
80
85
|
cwd: appFunctionsDir,
|
|
@@ -85,8 +90,8 @@ describe('lib/dependencyManagement', () => {
|
|
|
85
90
|
});
|
|
86
91
|
it('should locate the projects package.json files when install locations is not provided', async () => {
|
|
87
92
|
const installLocations = [
|
|
88
|
-
|
|
89
|
-
|
|
93
|
+
path_1.default.join(appFunctionsDir, 'package.json'),
|
|
94
|
+
path_1.default.join(extensionsDir, 'package.json'),
|
|
90
95
|
];
|
|
91
96
|
mockedWalk.mockResolvedValue(installLocations);
|
|
92
97
|
mockedGetProjectConfig.mockResolvedValue({
|
|
@@ -95,7 +100,7 @@ describe('lib/dependencyManagement', () => {
|
|
|
95
100
|
srcDir,
|
|
96
101
|
},
|
|
97
102
|
});
|
|
98
|
-
await installPackages({});
|
|
103
|
+
await (0, dependencyManagement_1.installPackages)({});
|
|
99
104
|
// It's called once per each install location, plus once to check if npm installed
|
|
100
105
|
expect(execMock).toHaveBeenCalledTimes(installLocations.length + 1);
|
|
101
106
|
expect(execMock).toHaveBeenCalledWith(`npm install `, {
|
|
@@ -112,23 +117,23 @@ describe('lib/dependencyManagement', () => {
|
|
|
112
117
|
}
|
|
113
118
|
throw new Error('OH NO');
|
|
114
119
|
});
|
|
115
|
-
|
|
120
|
+
util_1.default.promisify = mockedPromisify(execMock);
|
|
116
121
|
// Mock walk to return the directory paths instead of package.json paths
|
|
117
122
|
mockedWalk.mockResolvedValue([appFunctionsDir, extensionsDir]);
|
|
118
123
|
mockedFs.existsSync.mockImplementation(filePath => {
|
|
119
124
|
const pathStr = filePath.toString();
|
|
120
125
|
if (pathStr === projectDir ||
|
|
121
|
-
pathStr ===
|
|
126
|
+
pathStr === path_1.default.join(projectDir, srcDir)) {
|
|
122
127
|
return true;
|
|
123
128
|
}
|
|
124
129
|
return false;
|
|
125
130
|
});
|
|
126
|
-
await expect(() => installPackages({ installLocations: [appFunctionsDir, extensionsDir] })).rejects.toThrowError(`Installing dependencies for ${appFunctionsDir} failed`);
|
|
127
|
-
expect(
|
|
128
|
-
expect(
|
|
131
|
+
await expect(() => (0, dependencyManagement_1.installPackages)({ installLocations: [appFunctionsDir, extensionsDir] })).rejects.toThrowError(`Installing dependencies for ${appFunctionsDir} failed`);
|
|
132
|
+
expect(SpinniesManager_1.default.fail).toHaveBeenCalledTimes(installLocations.length);
|
|
133
|
+
expect(SpinniesManager_1.default.fail).toHaveBeenCalledWith(`installingDependencies-${appFunctionsDir}`, {
|
|
129
134
|
text: `Installing dependencies for ${appFunctionsDir} failed`,
|
|
130
135
|
});
|
|
131
|
-
expect(
|
|
136
|
+
expect(SpinniesManager_1.default.fail).toHaveBeenCalledWith(`installingDependencies-${extensionsDir}`, {
|
|
132
137
|
text: `Installing dependencies for ${extensionsDir} failed`,
|
|
133
138
|
});
|
|
134
139
|
});
|
|
@@ -136,39 +141,39 @@ describe('lib/dependencyManagement', () => {
|
|
|
136
141
|
describe('getProjectPackageJsonFiles()', () => {
|
|
137
142
|
it('should throw an error when ran outside the boundary of a project', async () => {
|
|
138
143
|
mockedGetProjectConfig.mockResolvedValue({});
|
|
139
|
-
await expect(() => getProjectPackageJsonLocations()).rejects.toThrowError('No project detected. Run this command from a project directory.');
|
|
144
|
+
await expect(() => (0, dependencyManagement_1.getProjectPackageJsonLocations)()).rejects.toThrowError('No project detected. Run this command from a project directory.');
|
|
140
145
|
});
|
|
141
146
|
it('should throw an error if npm is not globally installed', async () => {
|
|
142
147
|
execMock = vi.fn().mockImplementation(() => {
|
|
143
148
|
throw new Error('OH NO');
|
|
144
149
|
});
|
|
145
|
-
|
|
146
|
-
await expect(() => getProjectPackageJsonLocations()).rejects.toThrowError(/This command depends on npm, install/);
|
|
150
|
+
util_1.default.promisify = mockedPromisify(execMock);
|
|
151
|
+
await expect(() => (0, dependencyManagement_1.getProjectPackageJsonLocations)()).rejects.toThrowError(/This command depends on npm, install/);
|
|
147
152
|
});
|
|
148
153
|
it('should throw an error if the project directory does not exist', async () => {
|
|
149
154
|
mockedFs.existsSync.mockReturnValueOnce(false);
|
|
150
|
-
await expect(() => getProjectPackageJsonLocations()).rejects.toThrowError(new RegExp(`No dependencies to install. The project ${projectName} folder might be missing component or subcomponent files.`));
|
|
155
|
+
await expect(() => (0, dependencyManagement_1.getProjectPackageJsonLocations)()).rejects.toThrowError(new RegExp(`No dependencies to install. The project ${projectName} folder might be missing component or subcomponent files.`));
|
|
151
156
|
});
|
|
152
157
|
it('should ignore package.json files in certain directories', async () => {
|
|
153
|
-
const nodeModulesDir =
|
|
154
|
-
const viteDir =
|
|
158
|
+
const nodeModulesDir = path_1.default.join(appDir, 'node_modules');
|
|
159
|
+
const viteDir = path_1.default.join(appDir, '.vite');
|
|
155
160
|
const installLocations = [
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
161
|
+
path_1.default.join(appFunctionsDir, 'package.json'),
|
|
162
|
+
path_1.default.join(extensionsDir, 'package.json'),
|
|
163
|
+
path_1.default.join(viteDir, 'package.json'),
|
|
164
|
+
path_1.default.join(nodeModulesDir, 'package.json'),
|
|
160
165
|
];
|
|
161
166
|
mockedWalk.mockResolvedValue(installLocations);
|
|
162
167
|
mockedFs.existsSync.mockImplementation(filePath => {
|
|
163
168
|
// Return true for project directory and src directory
|
|
164
169
|
const pathStr = filePath.toString();
|
|
165
170
|
if (pathStr === projectDir ||
|
|
166
|
-
pathStr ===
|
|
171
|
+
pathStr === path_1.default.join(projectDir, srcDir)) {
|
|
167
172
|
return true;
|
|
168
173
|
}
|
|
169
174
|
return false;
|
|
170
175
|
});
|
|
171
|
-
const actual = await getProjectPackageJsonLocations();
|
|
176
|
+
const actual = await (0, dependencyManagement_1.getProjectPackageJsonLocations)();
|
|
172
177
|
expect(actual).toEqual([appFunctionsDir, extensionsDir]);
|
|
173
178
|
});
|
|
174
179
|
});
|