UNPKG

@arslaan/pwa

Version:

A simple CLI tool to scaffold and generate service worker and manifest files for PWAs using customizable route-based caching strategies.

28 lines (27 loc) 755 B
import fs from "fs"; import path from "path"; export const detectFramework = async () => { const pkgPath = path.resolve(process.cwd(), "package.json"); if (!fs.existsSync(pkgPath)) return "Unknown"; const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8")); const deps = { ...pkg.dependencies, ...pkg.devDependencies, }; if (deps["next"]) return "Next.js"; if (deps["react-scripts"] || deps["react"]) return "React"; if (deps["vue"]) return "Vue.js"; if (deps["nuxt"]) return "Nuxt.js"; if (deps["svelte"]) return "Svelte"; if (deps["@angular/core"]) return "Angular"; if (deps["vite"]) return "Vite"; return "Unknown"; };