( pkg: PackageJson, frameworks: typeof FRAMEWORKS, )
| 4 | import type { ActionType, FRAMEWORKS, PluginCard, PluginSection } from './types' |
| 5 | |
| 6 | export const detectFramework = ( |
| 7 | pkg: PackageJson, |
| 8 | frameworks: typeof FRAMEWORKS, |
| 9 | ): string => { |
| 10 | const allDeps = { |
| 11 | ...pkg.dependencies, |
| 12 | ...pkg.devDependencies, |
| 13 | } |
| 14 | |
| 15 | // Map of framework to their actual package names |
| 16 | const frameworkPackageMap: Record<string, Array<string>> = { |
| 17 | react: ['react', 'react-dom'], |
| 18 | vue: ['vue', '@vue/core'], |
| 19 | solid: ['solid-js'], |
| 20 | svelte: ['svelte'], |
| 21 | angular: ['@angular/core'], |
| 22 | } |
| 23 | |
| 24 | // Check for actual framework packages |
| 25 | for (const framework of frameworks) { |
| 26 | const frameworkPackages = frameworkPackageMap[framework] |
| 27 | if (frameworkPackages && frameworkPackages.some((pkg) => allDeps[pkg])) { |
| 28 | return framework |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | return 'unknown' |
| 33 | } |
| 34 | |
| 35 | export const isPluginRegistered = ( |
| 36 | registeredPlugins: Set<string>, |
no outgoing calls
no test coverage detected