"""Dockerfile and package.json generator for JS/TS frameworks. Auto-generates Dockerfile, package.json, and .dockerignore for React, Next.js, Vue.js, Express, NestJS, and plain Node.js projects so they can be pushed to HuggingFace Docker Spaces. """ from __future__ import annotations import re from typing import Any # ─── Framework Detection ──────────────────────────────────────────────── # Keywords in code that identify a framework FRAMEWORK_SIGNALS: dict[str, list[str]] = { "nextjs": [ "from 'next", 'from "next', "next/link", "next/image", "next/router", "next/head", "NextResponse", "NextRequest", "next/navigation", "getServerSideProps", "getStaticProps", ], "react": [ "from 'react", 'from "react', "react-dom", "ReactDOM", "useState", "useEffect", "jsx", "tsx", "React.Component", "React.createElement", ], "vue": [ "from 'vue", 'from "vue', "createApp", "Vue.createApp", "