@hubspot/cli 8.3.0 → 8.4.0-beta.0
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/bin/cli.js +2 -0
- package/commands/account/auth.js +12 -22
- package/commands/account/clean.js +5 -6
- package/commands/account/createOverride.js +7 -7
- package/commands/account/info.js +2 -1
- package/commands/account/list.js +3 -5
- package/commands/account/remove.js +2 -3
- package/commands/account/removeOverride.js +8 -10
- package/commands/account/rename.js +5 -6
- package/commands/account/use.js +8 -19
- package/commands/api.d.ts +10 -0
- package/commands/api.js +164 -0
- package/commands/app/migrate.js +8 -8
- package/commands/app/secret/add.js +6 -7
- package/commands/app/secret/delete.js +9 -10
- package/commands/app/secret/list.js +6 -7
- package/commands/app/secret/update.js +8 -9
- package/commands/auth.js +12 -12
- package/commands/cms/app/create.js +9 -5
- package/commands/cms/convertFields.js +8 -8
- package/commands/cms/delete.js +2 -3
- package/commands/cms/fetch.js +7 -7
- package/commands/cms/function/create.js +9 -5
- package/commands/cms/function/deploy.js +2 -3
- package/commands/cms/function/list.js +11 -7
- package/commands/cms/function/logs.js +17 -23
- package/commands/cms/function/server.js +2 -3
- package/commands/cms/getReactModule.js +7 -8
- package/commands/cms/lighthouseScore.js +25 -24
- package/commands/cms/lint.js +4 -5
- package/commands/cms/list.js +5 -6
- package/commands/cms/module/create.js +9 -5
- package/commands/cms/module/marketplace-validate.js +7 -8
- package/commands/cms/mv.js +2 -3
- package/commands/cms/template/create.js +10 -6
- package/commands/cms/theme/create.js +5 -5
- package/commands/cms/theme/generate-selectors.js +5 -4
- package/commands/cms/theme/marketplace-validate.js +8 -9
- package/commands/cms/theme/preview.js +16 -8
- package/commands/cms/upload.js +15 -12
- package/commands/cms/watch.js +5 -5
- package/commands/cms/webpack/create.js +5 -5
- package/commands/completion.js +3 -5
- package/commands/config/migrate.js +6 -7
- package/commands/config/set.js +5 -6
- package/commands/customObject/create.js +4 -5
- package/commands/customObject/createSchema.js +4 -5
- package/commands/customObject/deleteSchema.js +4 -5
- package/commands/customObject/fetchAllSchemas.js +2 -3
- package/commands/customObject/fetchSchema.js +2 -3
- package/commands/customObject/listSchemas.js +2 -3
- package/commands/customObject/updateSchema.js +4 -5
- package/commands/doctor.js +8 -8
- package/commands/feedback.js +6 -4
- package/commands/filemanager/fetch.js +5 -6
- package/commands/filemanager/upload.js +5 -5
- package/commands/getStarted.js +14 -16
- package/commands/hubdb/clear.js +5 -6
- package/commands/hubdb/create.js +4 -5
- package/commands/hubdb/delete.js +8 -9
- package/commands/hubdb/fetch.js +5 -6
- package/commands/hubdb/list.js +16 -14
- package/commands/init.js +14 -17
- package/commands/mcp/setup.js +5 -6
- package/commands/mcp/start.js +2 -3
- package/commands/open.js +4 -5
- package/commands/project/add.js +10 -5
- package/commands/project/create.js +10 -10
- package/commands/project/delete.d.ts +7 -0
- package/commands/project/delete.js +74 -0
- package/commands/project/deploy.js +36 -34
- package/commands/project/dev/deprecatedFlow.js +42 -15
- package/commands/project/dev/index.d.ts +3 -3
- package/commands/project/dev/index.js +24 -30
- package/commands/project/dev/unifiedFlow.js +37 -14
- package/commands/project/download.js +10 -11
- package/commands/project/info.d.ts +4 -0
- package/commands/project/info.js +67 -0
- package/commands/project/installDeps.js +9 -6
- package/commands/project/lint.js +11 -8
- package/commands/project/list.js +14 -14
- package/commands/project/listBuilds.js +8 -6
- package/commands/project/logs.js +5 -6
- package/commands/project/migrate.js +8 -8
- package/commands/project/open.js +5 -6
- package/commands/project/profile/add.js +12 -8
- package/commands/project/profile/delete.js +15 -11
- package/commands/project/updateDeps.js +9 -6
- package/commands/project/upload.js +31 -17
- package/commands/project/validate.js +11 -11
- package/commands/project/watch.js +20 -20
- package/commands/project.js +4 -0
- package/commands/sandbox/create.js +15 -15
- package/commands/sandbox/delete.js +13 -14
- package/commands/secret/addSecret.js +6 -7
- package/commands/secret/deleteSecret.js +5 -6
- package/commands/secret/listSecret.js +2 -3
- package/commands/secret/updateSecret.js +4 -5
- package/commands/testAccount/create.d.ts +1 -1
- package/commands/testAccount/create.js +20 -16
- package/commands/testAccount/createConfig.js +7 -8
- package/commands/testAccount/delete.js +27 -18
- package/commands/testAccount/importData.js +6 -7
- package/commands/upgrade.js +9 -10
- package/lang/en.d.ts +114 -5
- package/lang/en.js +111 -5
- package/lib/accountAuth.js +2 -2
- package/lib/buildAccount.js +3 -3
- package/lib/doctor/Diagnosis.js +5 -5
- package/lib/errorHandlers/index.js +4 -3
- package/lib/errorHandlers/suppressError.js +4 -0
- package/lib/errors/PromptExitError.d.ts +4 -2
- package/lib/errors/PromptExitError.js +3 -0
- package/lib/process.d.ts +1 -1
- package/lib/process.js +10 -3
- package/lib/projects/delete.d.ts +13 -0
- package/lib/projects/delete.js +193 -0
- package/lib/projects/localDev/AppDevModeInterface.js +11 -11
- package/lib/projects/localDev/DevServerManager_DEPRECATED.d.ts +3 -1
- package/lib/projects/localDev/DevServerManager_DEPRECATED.js +2 -2
- package/lib/projects/localDev/DevSessionManager.d.ts +6 -3
- package/lib/projects/localDev/DevSessionManager.js +31 -19
- package/lib/projects/localDev/LocalDevManager_DEPRECATED.d.ts +3 -0
- package/lib/projects/localDev/LocalDevManager_DEPRECATED.js +16 -12
- package/lib/projects/localDev/LocalDevProcess.js +6 -5
- package/lib/projects/localDev/LocalDevState.d.ts +3 -2
- package/lib/projects/localDev/LocalDevState.js +3 -1
- package/lib/projects/localDev/helpers/account.d.ts +4 -3
- package/lib/projects/localDev/helpers/account.js +16 -19
- package/lib/projects/localDev/helpers/process.d.ts +1 -1
- package/lib/projects/localDev/helpers/process.js +4 -10
- package/lib/projects/localDev/helpers/project.d.ts +4 -3
- package/lib/projects/localDev/helpers/project.js +31 -15
- package/lib/projects/projectInfo.d.ts +5 -0
- package/lib/projects/projectInfo.js +82 -0
- package/lib/projects/projectProfiles.d.ts +1 -2
- package/lib/projects/projectProfiles.js +5 -17
- package/lib/prompts/createApiSamplePrompt.js +4 -0
- package/lib/prompts/projectProfilePrompt.d.ts +2 -0
- package/lib/prompts/projectProfilePrompt.js +46 -0
- package/lib/prompts/promptUtils.js +3 -2
- package/lib/prompts/selectHubDBTablePrompt.js +2 -2
- package/lib/prompts/selectPublicAppForMigrationPrompt.js +2 -2
- package/lib/theme/cmsDevServerProcess.d.ts +2 -0
- package/lib/theme/cmsDevServerProcess.js +7 -6
- package/lib/ui/SpinniesManager.d.ts +1 -0
- package/lib/ui/SpinniesManager.js +20 -6
- package/lib/ui/spinniesUtils.d.ts +0 -1
- package/lib/ui/spinniesUtils.js +6 -16
- package/lib/usageTracking.d.ts +3 -4
- package/lib/yargs/makeYargsBuilder.d.ts +13 -0
- package/lib/yargs/makeYargsBuilder.js +33 -0
- package/lib/yargs/makeYargsHandlerWithUsageTracking.d.ts +3 -0
- package/lib/yargs/makeYargsHandlerWithUsageTracking.js +95 -0
- package/lib/yargs/strictEnforceBoolean.d.ts +1 -0
- package/lib/yargs/strictEnforceBoolean.js +13 -0
- package/lib/yargsUtils.d.ts +3 -16
- package/lib/yargsUtils.js +3 -48
- package/package.json +9 -4
- package/types/LocalDev.d.ts +5 -0
- package/types/Projects.d.ts +19 -0
- package/types/Yargs.d.ts +18 -1
- package/api/__tests__/migrate.test.d.ts +0 -1
- package/api/__tests__/migrate.test.js +0 -199
- package/commands/__tests__/account.test.d.ts +0 -1
- package/commands/__tests__/account.test.js +0 -69
- package/commands/__tests__/auth.test.d.ts +0 -1
- package/commands/__tests__/auth.test.js +0 -43
- package/commands/__tests__/cms.test.d.ts +0 -1
- package/commands/__tests__/cms.test.js +0 -87
- package/commands/__tests__/config.test.d.ts +0 -1
- package/commands/__tests__/config.test.js +0 -44
- package/commands/__tests__/customObject.test.d.ts +0 -1
- package/commands/__tests__/customObject.test.js +0 -68
- package/commands/__tests__/doctor.test.d.ts +0 -1
- package/commands/__tests__/doctor.test.js +0 -132
- package/commands/__tests__/feedback.test.d.ts +0 -1
- package/commands/__tests__/feedback.test.js +0 -24
- package/commands/__tests__/filemanager.test.d.ts +0 -1
- package/commands/__tests__/filemanager.test.js +0 -45
- package/commands/__tests__/getStarted.test.d.ts +0 -1
- package/commands/__tests__/getStarted.test.js +0 -173
- package/commands/__tests__/hubdb.test.d.ts +0 -1
- package/commands/__tests__/hubdb.test.js +0 -50
- package/commands/__tests__/init.test.d.ts +0 -1
- package/commands/__tests__/init.test.js +0 -42
- package/commands/__tests__/mcp.test.d.ts +0 -1
- package/commands/__tests__/mcp.test.js +0 -46
- package/commands/__tests__/open.test.d.ts +0 -1
- package/commands/__tests__/open.test.js +0 -58
- package/commands/__tests__/project.test.d.ts +0 -1
- package/commands/__tests__/project.test.js +0 -125
- package/commands/__tests__/sandbox.test.d.ts +0 -1
- package/commands/__tests__/sandbox.test.js +0 -44
- package/commands/__tests__/secret.test.d.ts +0 -1
- package/commands/__tests__/secret.test.js +0 -49
- package/commands/__tests__/testAccount.test.d.ts +0 -1
- package/commands/__tests__/testAccount.test.js +0 -57
- package/commands/__tests__/upgrade.test.d.ts +0 -1
- package/commands/__tests__/upgrade.test.js +0 -309
- package/commands/account/__tests__/auth.test.d.ts +0 -1
- package/commands/account/__tests__/auth.test.js +0 -206
- package/commands/account/__tests__/clean.test.d.ts +0 -1
- package/commands/account/__tests__/clean.test.js +0 -28
- package/commands/account/__tests__/createOverride.test.d.ts +0 -1
- package/commands/account/__tests__/createOverride.test.js +0 -32
- package/commands/account/__tests__/info.test.d.ts +0 -1
- package/commands/account/__tests__/info.test.js +0 -28
- package/commands/account/__tests__/list.test.d.ts +0 -1
- package/commands/account/__tests__/list.test.js +0 -153
- package/commands/account/__tests__/remove.test.d.ts +0 -1
- package/commands/account/__tests__/remove.test.js +0 -36
- package/commands/account/__tests__/removeOverride.d.ts +0 -1
- package/commands/account/__tests__/removeOverride.js +0 -25
- package/commands/account/__tests__/rename.test.d.ts +0 -1
- package/commands/account/__tests__/rename.test.js +0 -82
- package/commands/account/__tests__/use.test.d.ts +0 -1
- package/commands/account/__tests__/use.test.js +0 -170
- package/commands/app/__tests__/migrate.test.d.ts +0 -1
- package/commands/app/__tests__/migrate.test.js +0 -111
- package/commands/app/secret/__tests__/add.test.d.ts +0 -1
- package/commands/app/secret/__tests__/add.test.js +0 -140
- package/commands/app/secret/__tests__/delete.test.d.ts +0 -1
- package/commands/app/secret/__tests__/delete.test.js +0 -28
- package/commands/app/secret/__tests__/list.test.d.ts +0 -1
- package/commands/app/secret/__tests__/list.test.js +0 -25
- package/commands/app/secret/__tests__/update.test.d.ts +0 -1
- package/commands/app/secret/__tests__/update.test.js +0 -28
- package/commands/cms/__tests__/delete.test.d.ts +0 -1
- package/commands/cms/__tests__/delete.test.js +0 -39
- package/commands/cms/__tests__/fetch.test.d.ts +0 -1
- package/commands/cms/__tests__/fetch.test.js +0 -156
- package/commands/cms/__tests__/function.test.d.ts +0 -1
- package/commands/cms/__tests__/function.test.js +0 -50
- package/commands/cms/__tests__/lint.test.d.ts +0 -1
- package/commands/cms/__tests__/lint.test.js +0 -33
- package/commands/cms/__tests__/list.test.d.ts +0 -1
- package/commands/cms/__tests__/list.test.js +0 -42
- package/commands/cms/__tests__/module.test.d.ts +0 -1
- package/commands/cms/__tests__/module.test.js +0 -45
- package/commands/cms/__tests__/mv.test.d.ts +0 -1
- package/commands/cms/__tests__/mv.test.js +0 -46
- package/commands/cms/__tests__/theme.test.d.ts +0 -1
- package/commands/cms/__tests__/theme.test.js +0 -54
- package/commands/cms/__tests__/upload.test.d.ts +0 -1
- package/commands/cms/__tests__/upload.test.js +0 -312
- package/commands/cms/__tests__/watch.test.d.ts +0 -1
- package/commands/cms/__tests__/watch.test.js +0 -204
- package/commands/cms/function/__tests__/logs.test.d.ts +0 -1
- package/commands/cms/function/__tests__/logs.test.js +0 -70
- package/commands/cms/theme/__tests__/generate-selectors.test.d.ts +0 -1
- package/commands/cms/theme/__tests__/generate-selectors.test.js +0 -28
- package/commands/cms/theme/__tests__/marketplace-validate.test.d.ts +0 -1
- package/commands/cms/theme/__tests__/marketplace-validate.test.js +0 -36
- package/commands/cms/theme/__tests__/preview.test.d.ts +0 -1
- package/commands/cms/theme/__tests__/preview.test.js +0 -54
- package/commands/customObject/__tests__/create.test.d.ts +0 -1
- package/commands/customObject/__tests__/create.test.js +0 -40
- package/commands/customObject/__tests__/createSchema.test.d.ts +0 -1
- package/commands/customObject/__tests__/createSchema.test.js +0 -28
- package/commands/customObject/__tests__/deleteSchema.test.d.ts +0 -1
- package/commands/customObject/__tests__/deleteSchema.test.js +0 -42
- package/commands/customObject/__tests__/fetch-all-schemas.test.d.ts +0 -1
- package/commands/customObject/__tests__/fetch-all-schemas.test.js +0 -41
- package/commands/customObject/__tests__/fetchSchema.test.d.ts +0 -1
- package/commands/customObject/__tests__/fetchSchema.test.js +0 -45
- package/commands/customObject/__tests__/listSchemas.test.d.ts +0 -1
- package/commands/customObject/__tests__/listSchemas.test.js +0 -29
- package/commands/customObject/__tests__/updateSchema.test.d.ts +0 -1
- package/commands/customObject/__tests__/updateSchema.test.js +0 -40
- package/commands/filemanager/__tests__/fetch.test.d.ts +0 -1
- package/commands/filemanager/__tests__/fetch.test.js +0 -32
- package/commands/filemanager/__tests__/upload.test.d.ts +0 -1
- package/commands/filemanager/__tests__/upload.test.js +0 -191
- package/commands/hubdb/__tests__/clear.test.d.ts +0 -1
- package/commands/hubdb/__tests__/clear.test.js +0 -28
- package/commands/hubdb/__tests__/create.test.d.ts +0 -1
- package/commands/hubdb/__tests__/create.test.js +0 -28
- package/commands/hubdb/__tests__/delete.test.d.ts +0 -1
- package/commands/hubdb/__tests__/delete.test.js +0 -28
- package/commands/hubdb/__tests__/fetch.test.d.ts +0 -1
- package/commands/hubdb/__tests__/fetch.test.js +0 -28
- package/commands/hubdb/__tests__/list.test.d.ts +0 -1
- package/commands/hubdb/__tests__/list.test.js +0 -88
- package/commands/mcp/__tests__/setup.test.d.ts +0 -1
- package/commands/mcp/__tests__/setup.test.js +0 -26
- package/commands/mcp/__tests__/start.test.d.ts +0 -1
- package/commands/mcp/__tests__/start.test.js +0 -144
- package/commands/project/__tests__/add.test.d.ts +0 -1
- package/commands/project/__tests__/add.test.js +0 -107
- package/commands/project/__tests__/create.test.d.ts +0 -1
- package/commands/project/__tests__/create.test.js +0 -97
- package/commands/project/__tests__/deploy.test.d.ts +0 -1
- package/commands/project/__tests__/deploy.test.js +0 -307
- package/commands/project/__tests__/dev.test.d.ts +0 -1
- package/commands/project/__tests__/dev.test.js +0 -273
- package/commands/project/__tests__/devUnifiedFlow.test.d.ts +0 -1
- package/commands/project/__tests__/devUnifiedFlow.test.js +0 -434
- package/commands/project/__tests__/download.test.d.ts +0 -1
- package/commands/project/__tests__/download.test.js +0 -39
- package/commands/project/__tests__/installDeps.test.d.ts +0 -1
- package/commands/project/__tests__/installDeps.test.js +0 -140
- package/commands/project/__tests__/lint.test.d.ts +0 -1
- package/commands/project/__tests__/lint.test.js +0 -704
- package/commands/project/__tests__/list.test.d.ts +0 -1
- package/commands/project/__tests__/list.test.js +0 -31
- package/commands/project/__tests__/listBuilds.test.d.ts +0 -1
- package/commands/project/__tests__/listBuilds.test.js +0 -38
- package/commands/project/__tests__/logs.test.d.ts +0 -1
- package/commands/project/__tests__/logs.test.js +0 -202
- package/commands/project/__tests__/migrate.test.d.ts +0 -1
- package/commands/project/__tests__/migrate.test.js +0 -106
- package/commands/project/__tests__/open.test.d.ts +0 -1
- package/commands/project/__tests__/open.test.js +0 -39
- package/commands/project/__tests__/profile.test.d.ts +0 -1
- package/commands/project/__tests__/profile.test.js +0 -42
- package/commands/project/__tests__/updateDeps.test.d.ts +0 -1
- package/commands/project/__tests__/updateDeps.test.js +0 -140
- package/commands/project/__tests__/upload.test.d.ts +0 -1
- package/commands/project/__tests__/upload.test.js +0 -234
- package/commands/project/__tests__/validate.test.d.ts +0 -1
- package/commands/project/__tests__/validate.test.js +0 -381
- package/commands/project/__tests__/watch.test.d.ts +0 -1
- package/commands/project/__tests__/watch.test.js +0 -35
- package/commands/sandbox/__tests__/create.test.d.ts +0 -1
- package/commands/sandbox/__tests__/create.test.js +0 -198
- package/commands/sandbox/__tests__/delete.test.d.ts +0 -1
- package/commands/sandbox/__tests__/delete.test.js +0 -31
- package/commands/secret/__tests__/addSecret.test.d.ts +0 -1
- package/commands/secret/__tests__/addSecret.test.js +0 -162
- package/commands/secret/__tests__/deleteSecret.test.d.ts +0 -1
- package/commands/secret/__tests__/deleteSecret.test.js +0 -41
- package/commands/secret/__tests__/listSecret.test.d.ts +0 -1
- package/commands/secret/__tests__/listSecret.test.js +0 -29
- package/commands/secret/__tests__/updateSecret.test.d.ts +0 -1
- package/commands/secret/__tests__/updateSecret.test.js +0 -29
- package/commands/testAccount/__tests__/create.test.d.ts +0 -1
- package/commands/testAccount/__tests__/create.test.js +0 -106
- package/commands/testAccount/__tests__/createConfig.test.d.ts +0 -1
- package/commands/testAccount/__tests__/createConfig.test.js +0 -32
- package/commands/testAccount/__tests__/delete.test.d.ts +0 -1
- package/commands/testAccount/__tests__/delete.test.js +0 -29
- package/commands/testAccount/__tests__/importData.test.d.ts +0 -1
- package/commands/testAccount/__tests__/importData.test.js +0 -92
- package/lib/__tests__/CLIWebSocketServer.test.d.ts +0 -1
- package/lib/__tests__/CLIWebSocketServer.test.js +0 -252
- package/lib/__tests__/accountAuth.test.d.ts +0 -1
- package/lib/__tests__/accountAuth.test.js +0 -258
- package/lib/__tests__/accountTypes.test.d.ts +0 -1
- package/lib/__tests__/accountTypes.test.js +0 -98
- package/lib/__tests__/buildAccount.test.d.ts +0 -1
- package/lib/__tests__/buildAccount.test.js +0 -211
- package/lib/__tests__/cliUpgradeUtils.test.d.ts +0 -1
- package/lib/__tests__/cliUpgradeUtils.test.js +0 -131
- package/lib/__tests__/commandSuggestion.test.d.ts +0 -1
- package/lib/__tests__/commandSuggestion.test.js +0 -121
- package/lib/__tests__/commonOpts.test.d.ts +0 -1
- package/lib/__tests__/commonOpts.test.js +0 -80
- package/lib/__tests__/dependencyManagement.test.d.ts +0 -1
- package/lib/__tests__/dependencyManagement.test.js +0 -1067
- package/lib/__tests__/developerTestAccounts.test.d.ts +0 -1
- package/lib/__tests__/developerTestAccounts.test.js +0 -156
- package/lib/__tests__/hasFeature.test.d.ts +0 -1
- package/lib/__tests__/hasFeature.test.js +0 -167
- package/lib/__tests__/http.test.d.ts +0 -1
- package/lib/__tests__/http.test.js +0 -40
- package/lib/__tests__/importData.test.d.ts +0 -1
- package/lib/__tests__/importData.test.js +0 -98
- package/lib/__tests__/npmCli.test.d.ts +0 -1
- package/lib/__tests__/npmCli.test.js +0 -84
- package/lib/__tests__/oauth.test.d.ts +0 -1
- package/lib/__tests__/oauth.test.js +0 -109
- package/lib/__tests__/parsing.test.d.ts +0 -1
- package/lib/__tests__/parsing.test.js +0 -34
- package/lib/__tests__/polling.test.d.ts +0 -1
- package/lib/__tests__/polling.test.js +0 -76
- package/lib/__tests__/process.test.d.ts +0 -1
- package/lib/__tests__/process.test.js +0 -89
- package/lib/__tests__/sandboxes.test.d.ts +0 -1
- package/lib/__tests__/sandboxes.test.js +0 -128
- package/lib/__tests__/serverlessLogs.test.d.ts +0 -1
- package/lib/__tests__/serverlessLogs.test.js +0 -163
- package/lib/__tests__/usageTracking.test.d.ts +0 -1
- package/lib/__tests__/usageTracking.test.js +0 -197
- package/lib/__tests__/validation.test.d.ts +0 -1
- package/lib/__tests__/validation.test.js +0 -143
- package/lib/__tests__/yargsUtils.test.d.ts +0 -1
- package/lib/__tests__/yargsUtils.test.js +0 -124
- package/lib/app/__tests__/migrate.test.d.ts +0 -1
- package/lib/app/__tests__/migrate.test.js +0 -638
- package/lib/doctor/__tests__/Diagnosis.test.d.ts +0 -1
- package/lib/doctor/__tests__/Diagnosis.test.js +0 -84
- package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.d.ts +0 -1
- package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.js +0 -177
- package/lib/doctor/__tests__/Doctor.test.d.ts +0 -1
- package/lib/doctor/__tests__/Doctor.test.js +0 -560
- package/lib/errorHandlers/__tests__/index.test.d.ts +0 -1
- package/lib/errorHandlers/__tests__/index.test.js +0 -278
- package/lib/mcp/__tests__/setup.test.d.ts +0 -1
- package/lib/mcp/__tests__/setup.test.js +0 -523
- package/lib/middleware/__tests__/commandTargetingUtils.test.d.ts +0 -1
- package/lib/middleware/__tests__/commandTargetingUtils.test.js +0 -99
- package/lib/middleware/__tests__/configMiddleware.test.d.ts +0 -1
- package/lib/middleware/__tests__/configMiddleware.test.js +0 -118
- package/lib/middleware/__tests__/gitMiddleware.test.d.ts +0 -1
- package/lib/middleware/__tests__/gitMiddleware.test.js +0 -43
- package/lib/middleware/__tests__/requestMiddleware.test.d.ts +0 -1
- package/lib/middleware/__tests__/requestMiddleware.test.js +0 -15
- package/lib/middleware/__tests__/usageTrackingMiddleware.test.d.ts +0 -1
- package/lib/middleware/__tests__/usageTrackingMiddleware.test.js +0 -44
- package/lib/middleware/__tests__/yargsChecksMiddleware.test.d.ts +0 -1
- package/lib/middleware/__tests__/yargsChecksMiddleware.test.js +0 -39
- package/lib/projects/__tests__/AppDevModeInterface.test.d.ts +0 -1
- package/lib/projects/__tests__/AppDevModeInterface.test.js +0 -541
- package/lib/projects/__tests__/DevServerManager.test.d.ts +0 -1
- package/lib/projects/__tests__/DevServerManager.test.js +0 -185
- package/lib/projects/__tests__/DevSessionManager.test.d.ts +0 -1
- package/lib/projects/__tests__/DevSessionManager.test.js +0 -250
- package/lib/projects/__tests__/LocalDevProcess.test.d.ts +0 -1
- package/lib/projects/__tests__/LocalDevProcess.test.js +0 -481
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.d.ts +0 -1
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +0 -231
- package/lib/projects/__tests__/ProjectLogsManager.test.d.ts +0 -1
- package/lib/projects/__tests__/ProjectLogsManager.test.js +0 -302
- package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.d.ts +0 -1
- package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.js +0 -160
- package/lib/projects/__tests__/components.test.d.ts +0 -1
- package/lib/projects/__tests__/components.test.js +0 -440
- package/lib/projects/__tests__/deploy.test.d.ts +0 -1
- package/lib/projects/__tests__/deploy.test.js +0 -231
- package/lib/projects/__tests__/localDevProjectHelpers.test.d.ts +0 -1
- package/lib/projects/__tests__/localDevProjectHelpers.test.js +0 -120
- package/lib/projects/__tests__/platformVersion.test.d.ts +0 -1
- package/lib/projects/__tests__/platformVersion.test.js +0 -63
- package/lib/projects/__tests__/pollProjectBuildAndDeploy.test.d.ts +0 -1
- package/lib/projects/__tests__/pollProjectBuildAndDeploy.test.js +0 -328
- package/lib/projects/__tests__/projectProfiles.test.d.ts +0 -1
- package/lib/projects/__tests__/projectProfiles.test.js +0 -441
- package/lib/projects/__tests__/projects.test.d.ts +0 -1
- package/lib/projects/__tests__/projects.test.js +0 -58
- package/lib/projects/__tests__/structure.test.d.ts +0 -1
- package/lib/projects/__tests__/structure.test.js +0 -210
- package/lib/projects/__tests__/uieLinting.test.d.ts +0 -1
- package/lib/projects/__tests__/uieLinting.test.js +0 -631
- package/lib/projects/__tests__/upload.test.d.ts +0 -1
- package/lib/projects/__tests__/upload.test.js +0 -183
- package/lib/projects/add/__tests__/legacyAddComponent.test.d.ts +0 -1
- package/lib/projects/add/__tests__/legacyAddComponent.test.js +0 -245
- package/lib/projects/add/__tests__/v2AddComponent.test.d.ts +0 -1
- package/lib/projects/add/__tests__/v2AddComponent.test.js +0 -343
- package/lib/projects/create/__tests__/legacy.test.d.ts +0 -1
- package/lib/projects/create/__tests__/legacy.test.js +0 -72
- package/lib/projects/create/__tests__/v2.test.d.ts +0 -1
- package/lib/projects/create/__tests__/v2.test.js +0 -257
- package/lib/prompts/__tests__/createDeveloperTestAccountConfigPrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/createDeveloperTestAccountConfigPrompt.test.js +0 -157
- package/lib/prompts/__tests__/createFunctionPrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/createFunctionPrompt.test.js +0 -129
- package/lib/prompts/__tests__/createModulePrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/createModulePrompt.test.js +0 -187
- package/lib/prompts/__tests__/createTemplatePrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/createTemplatePrompt.test.js +0 -102
- package/lib/prompts/__tests__/downloadProjectPrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/downloadProjectPrompt.test.js +0 -31
- package/lib/prompts/__tests__/projectAddPrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/projectAddPrompt.test.js +0 -143
- package/lib/prompts/__tests__/projectsLogsPrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/projectsLogsPrompt.test.js +0 -37
- package/lib/prompts/__tests__/selectProjectTemplatePrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/selectProjectTemplatePrompt.test.js +0 -160
- package/lib/theme/__tests__/migrate.test.d.ts +0 -1
- package/lib/theme/__tests__/migrate.test.js +0 -247
- package/lib/ui/__tests__/SpinniesManager.test.d.ts +0 -1
- package/lib/ui/__tests__/SpinniesManager.test.js +0 -488
- package/lib/ui/__tests__/removeAnsiCodes.test.d.ts +0 -1
- package/lib/ui/__tests__/removeAnsiCodes.test.js +0 -84
- package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.js +0 -254
- package/mcp-server/tools/cms/__tests__/HsCreateModuleTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsCreateModuleTool.test.js +0 -227
- package/mcp-server/tools/cms/__tests__/HsCreateTemplateTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsCreateTemplateTool.test.js +0 -208
- package/mcp-server/tools/cms/__tests__/HsFunctionLogsTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsFunctionLogsTool.test.js +0 -186
- package/mcp-server/tools/cms/__tests__/HsListFunctionsTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsListFunctionsTool.test.js +0 -124
- package/mcp-server/tools/cms/__tests__/HsListTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsListTool.test.js +0 -124
- package/mcp-server/tools/project/__tests__/AddFeatureToProjectTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/AddFeatureToProjectTool.test.js +0 -157
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +0 -131
- package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.js +0 -461
- package/mcp-server/tools/project/__tests__/DeployProjectTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/DeployProjectTool.test.js +0 -125
- package/mcp-server/tools/project/__tests__/DocFetchTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/DocFetchTool.test.js +0 -125
- package/mcp-server/tools/project/__tests__/DocsSearchTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/DocsSearchTool.test.js +0 -210
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.js +0 -146
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.js +0 -124
- package/mcp-server/tools/project/__tests__/GetBuildLogsTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GetBuildLogsTool.test.js +0 -307
- package/mcp-server/tools/project/__tests__/GetBuildStatusTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GetBuildStatusTool.test.js +0 -242
- package/mcp-server/tools/project/__tests__/GetConfigValuesTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GetConfigValuesTool.test.js +0 -209
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.js +0 -158
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.js +0 -187
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.js +0 -118
- package/mcp-server/utils/__tests__/command.test.d.ts +0 -1
- package/mcp-server/utils/__tests__/command.test.js +0 -275
- package/mcp-server/utils/__tests__/content.test.d.ts +0 -1
- package/mcp-server/utils/__tests__/content.test.js +0 -164
- package/mcp-server/utils/__tests__/feedbackTracking.test.d.ts +0 -1
- package/mcp-server/utils/__tests__/feedbackTracking.test.js +0 -69
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { Separator } from '@inquirer/prompts';
|
|
2
|
-
import { projectAddPromptV2 } from '../projectAddPrompt.js';
|
|
3
|
-
import { promptUser } from '../promptUtils.js';
|
|
4
|
-
vi.mock('../promptUtils');
|
|
5
|
-
const mockedPromptUser = vi.mocked(promptUser);
|
|
6
|
-
describe('lib/prompts/projectAddPrompt', () => {
|
|
7
|
-
const mockComponentTemplate = {
|
|
8
|
-
label: 'Test Module',
|
|
9
|
-
path: 'test-module',
|
|
10
|
-
type: 'module',
|
|
11
|
-
supportedAuthTypes: ['oauth'],
|
|
12
|
-
supportedDistributions: ['private'],
|
|
13
|
-
};
|
|
14
|
-
const mockComponentTemplateWithCliSelector = {
|
|
15
|
-
label: 'Workflow Action Tool',
|
|
16
|
-
path: 'workflow-action-tool',
|
|
17
|
-
type: 'workflow-action',
|
|
18
|
-
cliSelector: 'workflow-action-tool',
|
|
19
|
-
supportedAuthTypes: ['oauth'],
|
|
20
|
-
supportedDistributions: ['private'],
|
|
21
|
-
};
|
|
22
|
-
describe('projectAddPromptV2()', () => {
|
|
23
|
-
beforeEach(() => {
|
|
24
|
-
// Mock returns empty result, logic will use selectedComponents when selectedFeatures provided
|
|
25
|
-
mockedPromptUser.mockResolvedValue({});
|
|
26
|
-
});
|
|
27
|
-
it('should select component based on cliSelector when provided', async () => {
|
|
28
|
-
const templateChoice = {
|
|
29
|
-
name: 'Workflow Action Tool',
|
|
30
|
-
value: mockComponentTemplateWithCliSelector,
|
|
31
|
-
};
|
|
32
|
-
const components = [templateChoice];
|
|
33
|
-
const selectedFeatures = ['workflow-action-tool'];
|
|
34
|
-
const result = await projectAddPromptV2(components, selectedFeatures);
|
|
35
|
-
expect(result.componentTemplate).toEqual([
|
|
36
|
-
mockComponentTemplateWithCliSelector,
|
|
37
|
-
]);
|
|
38
|
-
expect(mockedPromptUser).toHaveBeenCalledWith([
|
|
39
|
-
expect.objectContaining({
|
|
40
|
-
name: 'componentTemplate',
|
|
41
|
-
when: false, // selectedFeatures provided, so skip prompt
|
|
42
|
-
}),
|
|
43
|
-
]);
|
|
44
|
-
});
|
|
45
|
-
it('should select component based on type when cliSelector not provided', async () => {
|
|
46
|
-
const templateChoice = {
|
|
47
|
-
name: 'Test Module',
|
|
48
|
-
value: mockComponentTemplate,
|
|
49
|
-
};
|
|
50
|
-
const components = [templateChoice];
|
|
51
|
-
const selectedFeatures = ['module'];
|
|
52
|
-
const result = await projectAddPromptV2(components, selectedFeatures);
|
|
53
|
-
expect(result.componentTemplate).toEqual([mockComponentTemplate]);
|
|
54
|
-
expect(mockedPromptUser).toHaveBeenCalledWith([
|
|
55
|
-
expect.objectContaining({
|
|
56
|
-
name: 'componentTemplate',
|
|
57
|
-
when: false, // selectedFeatures provided and selectedComponents found
|
|
58
|
-
}),
|
|
59
|
-
]);
|
|
60
|
-
});
|
|
61
|
-
it('should prefer cliSelector over type when both are available', async () => {
|
|
62
|
-
const templateChoice = {
|
|
63
|
-
name: 'Workflow Action Tool',
|
|
64
|
-
value: mockComponentTemplateWithCliSelector,
|
|
65
|
-
};
|
|
66
|
-
const components = [templateChoice];
|
|
67
|
-
const selectedFeatures = ['workflow-action-tool']; // matches cliSelector
|
|
68
|
-
const result = await projectAddPromptV2(components, selectedFeatures);
|
|
69
|
-
expect(result.componentTemplate).toEqual([
|
|
70
|
-
mockComponentTemplateWithCliSelector,
|
|
71
|
-
]);
|
|
72
|
-
});
|
|
73
|
-
it('should not select component when neither cliSelector nor type matches', async () => {
|
|
74
|
-
const templateChoice = {
|
|
75
|
-
name: 'Test Module',
|
|
76
|
-
value: mockComponentTemplate,
|
|
77
|
-
};
|
|
78
|
-
const components = [templateChoice];
|
|
79
|
-
const selectedFeatures = ['non-matching-feature'];
|
|
80
|
-
mockedPromptUser.mockResolvedValue({ componentTemplate: [] });
|
|
81
|
-
const result = await projectAddPromptV2(components, selectedFeatures);
|
|
82
|
-
expect(result.componentTemplate).toEqual([]);
|
|
83
|
-
});
|
|
84
|
-
it('should throw error when selected feature component is disabled', async () => {
|
|
85
|
-
const disabledTemplateChoice = {
|
|
86
|
-
name: 'Disabled Component',
|
|
87
|
-
value: mockComponentTemplateWithCliSelector,
|
|
88
|
-
disabled: 'Component is disabled for testing',
|
|
89
|
-
};
|
|
90
|
-
const components = [disabledTemplateChoice];
|
|
91
|
-
const selectedFeatures = ['workflow-action-tool'];
|
|
92
|
-
await expect(projectAddPromptV2(components, selectedFeatures)).rejects.toThrow(/Cannot.*feature.*workflow-action/);
|
|
93
|
-
});
|
|
94
|
-
it('should handle multiple components with mixed cliSelector availability', async () => {
|
|
95
|
-
const choice1 = {
|
|
96
|
-
name: 'Test Module',
|
|
97
|
-
value: mockComponentTemplate,
|
|
98
|
-
};
|
|
99
|
-
const choice2 = {
|
|
100
|
-
name: 'Workflow Action Tool',
|
|
101
|
-
value: mockComponentTemplateWithCliSelector,
|
|
102
|
-
};
|
|
103
|
-
const components = [choice1, choice2];
|
|
104
|
-
const selectedFeatures = ['module', 'workflow-action-tool'];
|
|
105
|
-
const result = await projectAddPromptV2(components, selectedFeatures);
|
|
106
|
-
expect(result.componentTemplate).toEqual([
|
|
107
|
-
mockComponentTemplate,
|
|
108
|
-
mockComponentTemplateWithCliSelector,
|
|
109
|
-
]);
|
|
110
|
-
});
|
|
111
|
-
it('should skip Separator instances when processing components', async () => {
|
|
112
|
-
const separator = new Separator();
|
|
113
|
-
const templateChoice = {
|
|
114
|
-
name: 'Test Module',
|
|
115
|
-
value: mockComponentTemplate,
|
|
116
|
-
};
|
|
117
|
-
const components = [separator, templateChoice];
|
|
118
|
-
const selectedFeatures = ['module'];
|
|
119
|
-
const result = await projectAddPromptV2(components, selectedFeatures);
|
|
120
|
-
expect(result.componentTemplate).toEqual([mockComponentTemplate]);
|
|
121
|
-
});
|
|
122
|
-
it('should prompt user when no selectedFeatures provided', async () => {
|
|
123
|
-
const templateChoice = {
|
|
124
|
-
name: 'Test Module',
|
|
125
|
-
value: mockComponentTemplate,
|
|
126
|
-
};
|
|
127
|
-
const components = [templateChoice];
|
|
128
|
-
const selectedFeatures = undefined;
|
|
129
|
-
mockedPromptUser.mockResolvedValue({
|
|
130
|
-
componentTemplate: [mockComponentTemplate],
|
|
131
|
-
});
|
|
132
|
-
const result = await projectAddPromptV2(components, selectedFeatures);
|
|
133
|
-
expect(mockedPromptUser).toHaveBeenCalledWith([
|
|
134
|
-
expect.objectContaining({
|
|
135
|
-
name: 'componentTemplate',
|
|
136
|
-
type: 'checkbox',
|
|
137
|
-
choices: components,
|
|
138
|
-
}),
|
|
139
|
-
]);
|
|
140
|
-
expect(result.componentTemplate).toEqual([mockComponentTemplate]);
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { projectLogsPrompt } from '../projectsLogsPrompt.js';
|
|
2
|
-
import { promptUser } from '../promptUtils.js';
|
|
3
|
-
import chalk from 'chalk';
|
|
4
|
-
vi.mock('../promptUtils');
|
|
5
|
-
describe('lib/prompts/projectsLogsPrompt', () => {
|
|
6
|
-
it('should return undefined functionName when functionChoices is undefined', async () => {
|
|
7
|
-
const actual = await projectLogsPrompt({ functionChoices: undefined });
|
|
8
|
-
expect(actual).toEqual({});
|
|
9
|
-
expect(promptUser).not.toHaveBeenCalled();
|
|
10
|
-
});
|
|
11
|
-
it('should return the functionName without prompting when there is only one functionChoice', async () => {
|
|
12
|
-
const functionChoice = 'this-is-the-only-function';
|
|
13
|
-
const { functionName } = await projectLogsPrompt({
|
|
14
|
-
functionChoices: [functionChoice],
|
|
15
|
-
});
|
|
16
|
-
expect(functionName).toEqual(functionChoice);
|
|
17
|
-
expect(promptUser).not.toHaveBeenCalled();
|
|
18
|
-
});
|
|
19
|
-
it('should prompt the user if there is more than one choice', async () => {
|
|
20
|
-
const functionChoices = ['choice 1', 'choice 2'];
|
|
21
|
-
const projectName = 'my cool project';
|
|
22
|
-
await projectLogsPrompt({
|
|
23
|
-
functionChoices,
|
|
24
|
-
projectName,
|
|
25
|
-
});
|
|
26
|
-
expect(promptUser).toHaveBeenCalledTimes(1);
|
|
27
|
-
expect(promptUser).toHaveBeenLastCalledWith(expect.arrayContaining([
|
|
28
|
-
expect.objectContaining({
|
|
29
|
-
name: 'functionName',
|
|
30
|
-
type: 'list',
|
|
31
|
-
message: `[--function] Select function in ${chalk.bold(projectName)} project`,
|
|
32
|
-
when: expect.any(Function),
|
|
33
|
-
choices: functionChoices,
|
|
34
|
-
}),
|
|
35
|
-
]));
|
|
36
|
-
});
|
|
37
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { Separator } from '@inquirer/prompts';
|
|
2
|
-
import { selectProjectTemplatePrompt } from '../selectProjectTemplatePrompt.js';
|
|
3
|
-
import { promptUser } from '../promptUtils.js';
|
|
4
|
-
vi.mock('../promptUtils');
|
|
5
|
-
const mockedPromptUser = vi.mocked(promptUser);
|
|
6
|
-
describe('lib/prompts/selectProjectTemplatePrompt', () => {
|
|
7
|
-
const mockComponentTemplate = {
|
|
8
|
-
label: 'Test Module',
|
|
9
|
-
path: 'test-module',
|
|
10
|
-
type: 'module',
|
|
11
|
-
supportedAuthTypes: ['oauth'],
|
|
12
|
-
supportedDistributions: ['private'],
|
|
13
|
-
};
|
|
14
|
-
const mockComponentTemplateWithCliSelector = {
|
|
15
|
-
label: 'Workflow Action Tool',
|
|
16
|
-
path: 'workflow-action-tool',
|
|
17
|
-
type: 'workflow-action',
|
|
18
|
-
cliSelector: 'workflow-action-tool',
|
|
19
|
-
supportedAuthTypes: ['oauth'],
|
|
20
|
-
supportedDistributions: ['private'],
|
|
21
|
-
};
|
|
22
|
-
beforeEach(() => {
|
|
23
|
-
mockedPromptUser.mockResolvedValue({});
|
|
24
|
-
});
|
|
25
|
-
describe('selectProjectTemplatePrompt with component templates', () => {
|
|
26
|
-
it('should select component based on cliSelector when provided', async () => {
|
|
27
|
-
const templateChoice = {
|
|
28
|
-
name: 'Workflow Action Tool',
|
|
29
|
-
value: mockComponentTemplateWithCliSelector,
|
|
30
|
-
};
|
|
31
|
-
const componentTemplates = [templateChoice];
|
|
32
|
-
const promptOptions = {
|
|
33
|
-
features: ['workflow-action-tool'],
|
|
34
|
-
};
|
|
35
|
-
const result = await selectProjectTemplatePrompt(promptOptions, undefined, componentTemplates);
|
|
36
|
-
expect(result.componentTemplates).toEqual([
|
|
37
|
-
mockComponentTemplateWithCliSelector,
|
|
38
|
-
]);
|
|
39
|
-
expect(mockedPromptUser).toHaveBeenCalledWith([
|
|
40
|
-
expect.objectContaining({ name: 'projectTemplate' }),
|
|
41
|
-
expect.objectContaining({ name: 'componentTemplates' }),
|
|
42
|
-
]);
|
|
43
|
-
});
|
|
44
|
-
it('should select component based on type when cliSelector not provided', async () => {
|
|
45
|
-
const templateChoice = {
|
|
46
|
-
name: 'Test Module',
|
|
47
|
-
value: mockComponentTemplate,
|
|
48
|
-
};
|
|
49
|
-
const componentTemplates = [templateChoice];
|
|
50
|
-
const promptOptions = {
|
|
51
|
-
features: ['module'],
|
|
52
|
-
};
|
|
53
|
-
const result = await selectProjectTemplatePrompt(promptOptions, undefined, componentTemplates);
|
|
54
|
-
expect(result.componentTemplates).toEqual([mockComponentTemplate]);
|
|
55
|
-
});
|
|
56
|
-
it('should prefer cliSelector over type when both are available', async () => {
|
|
57
|
-
const templateChoice = {
|
|
58
|
-
name: 'Workflow Action Tool',
|
|
59
|
-
value: mockComponentTemplateWithCliSelector,
|
|
60
|
-
};
|
|
61
|
-
const componentTemplates = [templateChoice];
|
|
62
|
-
const promptOptions = {
|
|
63
|
-
features: ['workflow-action-tool'], // matches cliSelector, not type
|
|
64
|
-
};
|
|
65
|
-
const result = await selectProjectTemplatePrompt(promptOptions, undefined, componentTemplates);
|
|
66
|
-
expect(result.componentTemplates).toEqual([
|
|
67
|
-
mockComponentTemplateWithCliSelector,
|
|
68
|
-
]);
|
|
69
|
-
});
|
|
70
|
-
it('should not select component when neither cliSelector nor type matches', async () => {
|
|
71
|
-
const templateChoice = {
|
|
72
|
-
name: 'Test Module',
|
|
73
|
-
value: mockComponentTemplate,
|
|
74
|
-
};
|
|
75
|
-
const componentTemplates = [templateChoice];
|
|
76
|
-
const promptOptions = {
|
|
77
|
-
features: ['non-matching-feature'],
|
|
78
|
-
};
|
|
79
|
-
const result = await selectProjectTemplatePrompt(promptOptions, undefined, componentTemplates);
|
|
80
|
-
expect(result.componentTemplates).toEqual([]);
|
|
81
|
-
});
|
|
82
|
-
it('should throw error when selected feature component is disabled', async () => {
|
|
83
|
-
const disabledTemplateChoice = {
|
|
84
|
-
name: 'Disabled Component',
|
|
85
|
-
value: mockComponentTemplateWithCliSelector,
|
|
86
|
-
disabled: 'Component is disabled for testing',
|
|
87
|
-
};
|
|
88
|
-
const componentTemplates = [disabledTemplateChoice];
|
|
89
|
-
const promptOptions = {
|
|
90
|
-
features: ['workflow-action-tool'],
|
|
91
|
-
};
|
|
92
|
-
await expect(selectProjectTemplatePrompt(promptOptions, undefined, componentTemplates)).rejects.toThrow(/Cannot create project with template.*workflow-action/);
|
|
93
|
-
});
|
|
94
|
-
it('should handle multiple components with mixed cliSelector availability', async () => {
|
|
95
|
-
const choice1 = {
|
|
96
|
-
name: 'Test Module',
|
|
97
|
-
value: mockComponentTemplate,
|
|
98
|
-
};
|
|
99
|
-
const choice2 = {
|
|
100
|
-
name: 'Workflow Action Tool',
|
|
101
|
-
value: mockComponentTemplateWithCliSelector,
|
|
102
|
-
};
|
|
103
|
-
const componentTemplates = [choice1, choice2];
|
|
104
|
-
const promptOptions = {
|
|
105
|
-
features: ['module', 'workflow-action-tool'],
|
|
106
|
-
};
|
|
107
|
-
const result = await selectProjectTemplatePrompt(promptOptions, undefined, componentTemplates);
|
|
108
|
-
expect(result.componentTemplates).toEqual([
|
|
109
|
-
mockComponentTemplate,
|
|
110
|
-
mockComponentTemplateWithCliSelector,
|
|
111
|
-
]);
|
|
112
|
-
});
|
|
113
|
-
it('should skip Separator instances when processing components', async () => {
|
|
114
|
-
const separator = new Separator();
|
|
115
|
-
const templateChoice = {
|
|
116
|
-
name: 'Test Module',
|
|
117
|
-
value: mockComponentTemplate,
|
|
118
|
-
};
|
|
119
|
-
const componentTemplates = [separator, templateChoice];
|
|
120
|
-
const promptOptions = {
|
|
121
|
-
features: ['module'],
|
|
122
|
-
};
|
|
123
|
-
const result = await selectProjectTemplatePrompt(promptOptions, undefined, componentTemplates);
|
|
124
|
-
expect(result.componentTemplates).toEqual([mockComponentTemplate]);
|
|
125
|
-
});
|
|
126
|
-
it('should prompt user when no features provided', async () => {
|
|
127
|
-
const templateChoice = {
|
|
128
|
-
name: 'Test Module',
|
|
129
|
-
value: mockComponentTemplate,
|
|
130
|
-
};
|
|
131
|
-
const componentTemplates = [templateChoice];
|
|
132
|
-
const promptOptions = {};
|
|
133
|
-
mockedPromptUser.mockResolvedValue({
|
|
134
|
-
componentTemplates: [mockComponentTemplate],
|
|
135
|
-
});
|
|
136
|
-
const result = await selectProjectTemplatePrompt(promptOptions, undefined, componentTemplates);
|
|
137
|
-
expect(mockedPromptUser).toHaveBeenCalledWith([
|
|
138
|
-
expect.objectContaining({ name: 'projectTemplate' }),
|
|
139
|
-
expect.objectContaining({
|
|
140
|
-
name: 'componentTemplates',
|
|
141
|
-
type: 'checkbox',
|
|
142
|
-
choices: componentTemplates,
|
|
143
|
-
}),
|
|
144
|
-
]);
|
|
145
|
-
expect(result.componentTemplates).toEqual([mockComponentTemplate]);
|
|
146
|
-
});
|
|
147
|
-
it('should handle empty componentTemplates selection', async () => {
|
|
148
|
-
const templateChoice = {
|
|
149
|
-
name: 'Test Module',
|
|
150
|
-
value: mockComponentTemplate,
|
|
151
|
-
};
|
|
152
|
-
const componentTemplates = [templateChoice];
|
|
153
|
-
const promptOptions = {
|
|
154
|
-
features: ['non-matching-feature'],
|
|
155
|
-
};
|
|
156
|
-
const result = await selectProjectTemplatePrompt(promptOptions, undefined, componentTemplates);
|
|
157
|
-
expect(result.componentTemplates).toEqual([]);
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
import { getProjectThemeDetails, migrateThemes, } from '@hubspot/project-parsing-lib/themes';
|
|
2
|
-
import { getConfigAccountById } from '@hubspot/local-dev-lib/config';
|
|
3
|
-
import { confirmPrompt } from '../../prompts/promptUtils.js';
|
|
4
|
-
import { writeProjectConfig, } from '../../projects/config.js';
|
|
5
|
-
import { ensureProjectExists } from '../../projects/ensureProjectExists.js';
|
|
6
|
-
import { fetchMigrationApps } from '../../app/migrate.js';
|
|
7
|
-
import { getHasMigratableThemes, validateMigrationAppsAndThemes, handleThemesMigration, migrateThemesV2, } from '../migrate.js';
|
|
8
|
-
import { lib } from '../../../lang/en.js';
|
|
9
|
-
vi.mock('@hubspot/project-parsing-lib/themes');
|
|
10
|
-
vi.mock('../../prompts/promptUtils');
|
|
11
|
-
vi.mock('../../projects/config');
|
|
12
|
-
vi.mock('../../projects/ensureProjectExists');
|
|
13
|
-
vi.mock('../../app/migrate');
|
|
14
|
-
vi.mock('@hubspot/local-dev-lib/config');
|
|
15
|
-
vi.mock('../../ui/SpinniesManager', () => ({
|
|
16
|
-
default: {
|
|
17
|
-
init: vi.fn(),
|
|
18
|
-
add: vi.fn(),
|
|
19
|
-
succeed: vi.fn(),
|
|
20
|
-
fail: vi.fn(),
|
|
21
|
-
remove: vi.fn(),
|
|
22
|
-
},
|
|
23
|
-
}));
|
|
24
|
-
const mockedGetProjectThemeDetails = getProjectThemeDetails;
|
|
25
|
-
const mockedMigrateThemes = migrateThemes;
|
|
26
|
-
const mockedConfirmPrompt = confirmPrompt;
|
|
27
|
-
const mockedWriteProjectConfig = writeProjectConfig;
|
|
28
|
-
const mockedEnsureProjectExists = ensureProjectExists;
|
|
29
|
-
const mockedFetchMigrationApps = fetchMigrationApps;
|
|
30
|
-
const mockedGetConfigAccountById = getConfigAccountById;
|
|
31
|
-
const ACCOUNT_ID = 123;
|
|
32
|
-
const PROJECT_NAME = 'Test Project';
|
|
33
|
-
const PLATFORM_VERSION = '2025.2';
|
|
34
|
-
const MOCK_PROJECT_DIR = '/mock/project/dir';
|
|
35
|
-
const createLoadedProjectConfig = (name) => ({
|
|
36
|
-
projectConfig: { name, srcDir: 'src', platformVersion: '2024.1' },
|
|
37
|
-
projectDir: MOCK_PROJECT_DIR,
|
|
38
|
-
});
|
|
39
|
-
describe('lib/theme/migrate', () => {
|
|
40
|
-
beforeEach(() => {
|
|
41
|
-
// Mock account config for the test account ID
|
|
42
|
-
mockedGetConfigAccountById.mockReturnValue({
|
|
43
|
-
accountId: ACCOUNT_ID,
|
|
44
|
-
name: 'Test Account',
|
|
45
|
-
authType: 'personalaccesskey',
|
|
46
|
-
auth: {
|
|
47
|
-
tokenInfo: {
|
|
48
|
-
accessToken: 'test-token',
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
env: 'prod',
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
describe('getHasMigratableThemes', () => {
|
|
55
|
-
it('should return false when no projectConfig is provided', async () => {
|
|
56
|
-
const result = await getHasMigratableThemes();
|
|
57
|
-
expect(result).toEqual({
|
|
58
|
-
hasMigratableThemes: false,
|
|
59
|
-
migratableThemesCount: 0,
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
it('should return false when projectConfig is missing required properties', async () => {
|
|
63
|
-
const invalidProjectConfig = {
|
|
64
|
-
projectConfig: { name: undefined, srcDir: 'src' },
|
|
65
|
-
projectDir: undefined,
|
|
66
|
-
};
|
|
67
|
-
const result = await getHasMigratableThemes(invalidProjectConfig);
|
|
68
|
-
expect(result).toEqual({
|
|
69
|
-
hasMigratableThemes: false,
|
|
70
|
-
migratableThemesCount: 0,
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
it('should return true when there are legacy themes', async () => {
|
|
74
|
-
mockedGetProjectThemeDetails.mockResolvedValue({
|
|
75
|
-
legacyThemeDetails: [
|
|
76
|
-
{
|
|
77
|
-
configFilepath: 'src/theme.json',
|
|
78
|
-
themePath: 'src/theme',
|
|
79
|
-
themeConfig: {
|
|
80
|
-
secret_names: ['my-secret'],
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
legacyReactThemeDetails: [],
|
|
85
|
-
});
|
|
86
|
-
const projectConfig = createLoadedProjectConfig(PROJECT_NAME);
|
|
87
|
-
const result = await getHasMigratableThemes(projectConfig);
|
|
88
|
-
expect(result).toEqual({
|
|
89
|
-
hasMigratableThemes: true,
|
|
90
|
-
migratableThemesCount: 1,
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
it('should return true when there are legacy React themes', async () => {
|
|
94
|
-
mockedGetProjectThemeDetails.mockResolvedValue({
|
|
95
|
-
legacyThemeDetails: [],
|
|
96
|
-
legacyReactThemeDetails: [
|
|
97
|
-
{
|
|
98
|
-
configFilepath: 'src/react-theme.json',
|
|
99
|
-
themePath: 'src/react-theme',
|
|
100
|
-
themeConfig: {
|
|
101
|
-
secretNames: ['my-secret'],
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
],
|
|
105
|
-
});
|
|
106
|
-
const projectConfig = createLoadedProjectConfig(PROJECT_NAME);
|
|
107
|
-
const result = await getHasMigratableThemes(projectConfig);
|
|
108
|
-
expect(result).toEqual({
|
|
109
|
-
hasMigratableThemes: true,
|
|
110
|
-
migratableThemesCount: 1,
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
it('should return true when there are both legacy and React themes', async () => {
|
|
114
|
-
mockedGetProjectThemeDetails.mockResolvedValue({
|
|
115
|
-
legacyThemeDetails: [
|
|
116
|
-
{
|
|
117
|
-
configFilepath: 'src/theme.json',
|
|
118
|
-
themePath: 'src/theme',
|
|
119
|
-
themeConfig: {
|
|
120
|
-
secret_names: ['my-secret'],
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
legacyReactThemeDetails: [
|
|
125
|
-
{
|
|
126
|
-
configFilepath: 'src/react-theme.json',
|
|
127
|
-
themePath: 'src/react-theme',
|
|
128
|
-
themeConfig: {
|
|
129
|
-
secretNames: ['my-secret'],
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
],
|
|
133
|
-
});
|
|
134
|
-
const projectConfig = createLoadedProjectConfig(PROJECT_NAME);
|
|
135
|
-
const result = await getHasMigratableThemes(projectConfig);
|
|
136
|
-
expect(result).toEqual({
|
|
137
|
-
hasMigratableThemes: true,
|
|
138
|
-
migratableThemesCount: 2,
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
describe('validateMigrationAppsAndThemes', () => {
|
|
143
|
-
it('should throw an error when apps and themes are both present', async () => {
|
|
144
|
-
const projectConfig = createLoadedProjectConfig(PROJECT_NAME);
|
|
145
|
-
await expect(validateMigrationAppsAndThemes(1, projectConfig)).rejects.toThrow(lib.migrate.errors.project.themesAndAppsNotAllowed);
|
|
146
|
-
});
|
|
147
|
-
it('should throw an error when no project config is provided', async () => {
|
|
148
|
-
await expect(validateMigrationAppsAndThemes(0)).rejects.toThrow(lib.migrate.errors.project.noProjectForThemesMigration);
|
|
149
|
-
});
|
|
150
|
-
it('should not throw an error when validation passes', async () => {
|
|
151
|
-
const projectConfig = createLoadedProjectConfig(PROJECT_NAME);
|
|
152
|
-
await expect(validateMigrationAppsAndThemes(0, projectConfig)).resolves.not.toThrow();
|
|
153
|
-
});
|
|
154
|
-
});
|
|
155
|
-
describe('handleThemesMigration', () => {
|
|
156
|
-
const projectConfig = createLoadedProjectConfig(PROJECT_NAME);
|
|
157
|
-
beforeEach(() => {
|
|
158
|
-
mockedMigrateThemes.mockResolvedValue({
|
|
159
|
-
migrated: true,
|
|
160
|
-
failureReason: undefined,
|
|
161
|
-
legacyThemeDetails: [],
|
|
162
|
-
legacyReactThemeDetails: [],
|
|
163
|
-
});
|
|
164
|
-
mockedWriteProjectConfig.mockReturnValue(true);
|
|
165
|
-
});
|
|
166
|
-
it('should throw an error when project config is invalid', async () => {
|
|
167
|
-
const invalidProjectConfig = {
|
|
168
|
-
projectConfig: { name: PROJECT_NAME, srcDir: undefined },
|
|
169
|
-
projectDir: undefined,
|
|
170
|
-
};
|
|
171
|
-
await expect(handleThemesMigration(invalidProjectConfig, PLATFORM_VERSION)).rejects.toThrow(lib.migrate.errors.project.invalidConfig);
|
|
172
|
-
});
|
|
173
|
-
it('should successfully migrate themes and update project config', async () => {
|
|
174
|
-
await handleThemesMigration(projectConfig, PLATFORM_VERSION);
|
|
175
|
-
expect(mockedMigrateThemes).toHaveBeenCalledWith(MOCK_PROJECT_DIR, `${MOCK_PROJECT_DIR}/src`);
|
|
176
|
-
expect(mockedWriteProjectConfig).toHaveBeenCalledWith(`${MOCK_PROJECT_DIR}/hsproject.json`, expect.objectContaining({
|
|
177
|
-
platformVersion: PLATFORM_VERSION,
|
|
178
|
-
}));
|
|
179
|
-
});
|
|
180
|
-
it('should throw an error when theme migration fails', async () => {
|
|
181
|
-
mockedMigrateThemes.mockResolvedValue({
|
|
182
|
-
migrated: false,
|
|
183
|
-
failureReason: 'Migration failed',
|
|
184
|
-
legacyThemeDetails: [],
|
|
185
|
-
legacyReactThemeDetails: [],
|
|
186
|
-
});
|
|
187
|
-
await expect(handleThemesMigration(projectConfig, PLATFORM_VERSION)).rejects.toThrow('Migration failed');
|
|
188
|
-
});
|
|
189
|
-
it('should throw an error when project config write fails', async () => {
|
|
190
|
-
mockedWriteProjectConfig.mockReturnValue(false);
|
|
191
|
-
await expect(handleThemesMigration(projectConfig, PLATFORM_VERSION)).rejects.toThrow(lib.migrate.errors.project.failedToUpdateProjectConfig);
|
|
192
|
-
});
|
|
193
|
-
it('should throw an error when migrateThemes throws an exception', async () => {
|
|
194
|
-
mockedMigrateThemes.mockRejectedValue(new Error('Unexpected error'));
|
|
195
|
-
await expect(handleThemesMigration(projectConfig, PLATFORM_VERSION)).rejects.toThrow(lib.migrate.errors.project.failedToMigrateThemes);
|
|
196
|
-
});
|
|
197
|
-
});
|
|
198
|
-
describe('migrateThemesV2', () => {
|
|
199
|
-
const options = {
|
|
200
|
-
platformVersion: PLATFORM_VERSION,
|
|
201
|
-
};
|
|
202
|
-
const projectConfig = createLoadedProjectConfig(PROJECT_NAME);
|
|
203
|
-
const themeCount = 2;
|
|
204
|
-
beforeEach(() => {
|
|
205
|
-
mockedEnsureProjectExists.mockResolvedValue({ projectExists: true });
|
|
206
|
-
mockedFetchMigrationApps.mockResolvedValue({
|
|
207
|
-
migratableApps: [],
|
|
208
|
-
unmigratableApps: [],
|
|
209
|
-
});
|
|
210
|
-
mockedConfirmPrompt.mockResolvedValue(true);
|
|
211
|
-
mockedMigrateThemes.mockResolvedValue({
|
|
212
|
-
migrated: true,
|
|
213
|
-
failureReason: undefined,
|
|
214
|
-
legacyThemeDetails: [],
|
|
215
|
-
legacyReactThemeDetails: [],
|
|
216
|
-
});
|
|
217
|
-
mockedWriteProjectConfig.mockReturnValue(true);
|
|
218
|
-
});
|
|
219
|
-
it('should throw an error when project config is invalid', async () => {
|
|
220
|
-
const invalidProjectConfig = {
|
|
221
|
-
projectConfig: undefined,
|
|
222
|
-
projectDir: MOCK_PROJECT_DIR,
|
|
223
|
-
};
|
|
224
|
-
await expect(migrateThemesV2(ACCOUNT_ID, options, themeCount, invalidProjectConfig)).rejects.toThrow(lib.migrate.errors.project.invalidConfig);
|
|
225
|
-
});
|
|
226
|
-
it('should throw an error when project does not exist', async () => {
|
|
227
|
-
mockedEnsureProjectExists.mockResolvedValue({ projectExists: false });
|
|
228
|
-
await expect(migrateThemesV2(ACCOUNT_ID, options, themeCount, projectConfig)).rejects.toThrow(lib.migrate.errors.project.doesNotExist(ACCOUNT_ID));
|
|
229
|
-
});
|
|
230
|
-
it('should proceed with migration when user confirms', async () => {
|
|
231
|
-
await migrateThemesV2(ACCOUNT_ID, options, themeCount, projectConfig);
|
|
232
|
-
expect(mockedFetchMigrationApps).toHaveBeenCalledWith(ACCOUNT_ID, PLATFORM_VERSION, { projectConfig });
|
|
233
|
-
expect(mockedConfirmPrompt).toHaveBeenCalledWith(lib.migrate.prompt.proceed, { defaultAnswer: false });
|
|
234
|
-
expect(mockedMigrateThemes).toHaveBeenCalledWith(MOCK_PROJECT_DIR, `${MOCK_PROJECT_DIR}/src`);
|
|
235
|
-
});
|
|
236
|
-
it('should exit without migrating when user cancels', async () => {
|
|
237
|
-
mockedConfirmPrompt.mockResolvedValue(false);
|
|
238
|
-
await migrateThemesV2(ACCOUNT_ID, options, themeCount, projectConfig);
|
|
239
|
-
expect(mockedMigrateThemes).not.toHaveBeenCalled();
|
|
240
|
-
});
|
|
241
|
-
it('should validate migration apps and themes', async () => {
|
|
242
|
-
await migrateThemesV2(ACCOUNT_ID, options, themeCount, projectConfig);
|
|
243
|
-
// The validation is called internally, so we verify it through the error handling
|
|
244
|
-
expect(mockedFetchMigrationApps).toHaveBeenCalled();
|
|
245
|
-
});
|
|
246
|
-
});
|
|
247
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|