nexforge-cli 1.0.6 → 1.0.7
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/package.json +1 -1
- package/src/commands/create.js +62 -7
package/package.json
CHANGED
package/src/commands/create.js
CHANGED
|
@@ -116,7 +116,7 @@ app.listen(PORT, () => console.log(\`Server running on port \${PORT}\`));
|
|
|
116
116
|
|
|
117
117
|
const setupFrontend = (targetDir) => {
|
|
118
118
|
console.log(chalk.cyan("\n⚛️ Scaffolding Frontend (React + Vite)..."))
|
|
119
|
-
|
|
119
|
+
fs.mkdirSync(targetDir, { recursive: true })
|
|
120
120
|
|
|
121
121
|
createFolderStructure(path.join(targetDir, "src"), [
|
|
122
122
|
"assets",
|
|
@@ -129,14 +129,69 @@ const setupFrontend = (targetDir) => {
|
|
|
129
129
|
"utils",
|
|
130
130
|
])
|
|
131
131
|
|
|
132
|
+
// Create Vite Boilerplate
|
|
133
|
+
const viteConfig = `import { defineConfig } from 'vite'
|
|
134
|
+
import react from '@vitejs/plugin-react'
|
|
135
|
+
|
|
136
|
+
export default defineConfig({
|
|
137
|
+
plugins: [react()],
|
|
138
|
+
})`
|
|
139
|
+
fs.writeFileSync(path.join(targetDir, "vite.config.js"), viteConfig)
|
|
140
|
+
|
|
141
|
+
const indexHtml = `<!doctype html>
|
|
142
|
+
<html lang="en">
|
|
143
|
+
<head>
|
|
144
|
+
<meta charset="UTF-8" />
|
|
145
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
146
|
+
<title>NexForge App</title>
|
|
147
|
+
</head>
|
|
148
|
+
<body>
|
|
149
|
+
<div id="root"></div>
|
|
150
|
+
<script type="module" src="/src/main.jsx"></script>
|
|
151
|
+
</body>
|
|
152
|
+
</html>`
|
|
153
|
+
fs.writeFileSync(path.join(targetDir, "index.html"), indexHtml)
|
|
154
|
+
|
|
155
|
+
const mainJsx = `import React from 'react'
|
|
156
|
+
import ReactDOM from 'react-dom/client'
|
|
157
|
+
import App from './App.jsx'
|
|
158
|
+
import './index.css'
|
|
159
|
+
|
|
160
|
+
ReactDOM.createRoot(document.getElementById('root')).render(
|
|
161
|
+
<React.StrictMode>
|
|
162
|
+
<App />
|
|
163
|
+
</React.StrictMode>,
|
|
164
|
+
)`
|
|
165
|
+
fs.writeFileSync(path.join(targetDir, "src", "main.jsx"), mainJsx)
|
|
166
|
+
|
|
167
|
+
const appJsx = `import React from 'react'
|
|
168
|
+
|
|
169
|
+
function App() {
|
|
170
|
+
return (
|
|
171
|
+
<div className="min-h-screen flex items-center justify-center bg-gray-900 text-white">
|
|
172
|
+
<h1 className="text-4xl font-bold">Welcome to NexForge</h1>
|
|
173
|
+
</div>
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export default App`
|
|
178
|
+
fs.writeFileSync(path.join(targetDir, "src", "App.jsx"), appJsx)
|
|
179
|
+
|
|
132
180
|
// Merge package.json
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
181
|
+
const pkgJson = {
|
|
182
|
+
name: "frontend",
|
|
183
|
+
private: true,
|
|
184
|
+
version: "0.0.0",
|
|
185
|
+
type: "module",
|
|
186
|
+
scripts: {
|
|
187
|
+
dev: "vite",
|
|
188
|
+
build: "vite build",
|
|
189
|
+
preview: "vite preview"
|
|
190
|
+
},
|
|
191
|
+
dependencies: { ...FRONTEND_DEPS, "react": "^19.2.6", "react-dom": "^19.2.6", "react-router-dom": "^7.18.0" },
|
|
192
|
+
devDependencies: { "@vitejs/plugin-react": "^6.0.1", "vite": "^8.0.12", tailwindcss: "^3.4.19", postcss: "^8.5.15", autoprefixer: "^10.5.0" }
|
|
139
193
|
}
|
|
194
|
+
fs.writeFileSync(path.join(targetDir, "package.json"), JSON.stringify(pkgJson, null, 2))
|
|
140
195
|
|
|
141
196
|
// Tailwind config
|
|
142
197
|
const twConfig = `/** @type {import('tailwindcss').Config} */
|