create-surf-app 0.1.2 → 0.1.4
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/dist/index.js +7 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -118,6 +118,7 @@ createServer().start()
|
|
|
118
118
|
"frontend/package.json": JSON.stringify(frontendPkg, null, 2),
|
|
119
119
|
"frontend/.env": `VITE_PORT=${frontendPort}
|
|
120
120
|
VITE_BACKEND_PORT=${backendPort}
|
|
121
|
+
VITE_BASE=${process.env.VITE_BASE || "/"}
|
|
121
122
|
`,
|
|
122
123
|
"frontend/vite.config.ts": `import { defineConfig, loadEnv } from 'vite'
|
|
123
124
|
import react from '@vitejs/plugin-react'
|
|
@@ -142,8 +143,10 @@ function requiredPort(name: string) {
|
|
|
142
143
|
|
|
143
144
|
const FRONTEND_PORT = requiredPort('VITE_PORT')
|
|
144
145
|
const BACKEND_PORT = requiredPort('VITE_BACKEND_PORT')
|
|
146
|
+
const BASE = env.VITE_BASE || '/'
|
|
145
147
|
|
|
146
148
|
export default defineConfig({
|
|
149
|
+
base: BASE,
|
|
147
150
|
plugins: [react(), tailwindcss()],
|
|
148
151
|
server: {
|
|
149
152
|
port: FRONTEND_PORT,
|
|
@@ -333,7 +336,7 @@ The agent can also call \`POST /api/__sync-schema\` explicitly after editing.
|
|
|
333
336
|
var root = path.resolve(projectName);
|
|
334
337
|
var name = path.basename(root);
|
|
335
338
|
console.log(`
|
|
336
|
-
Creating Surf app in
|
|
339
|
+
Creating Surf app in ./${projectName === "." ? "" : name}
|
|
337
340
|
`);
|
|
338
341
|
fs.mkdirSync(root, { recursive: true });
|
|
339
342
|
for (const [relPath, content] of Object.entries(templates)) {
|
|
@@ -359,11 +362,12 @@ function copyDir(src, dest) {
|
|
|
359
362
|
}
|
|
360
363
|
}
|
|
361
364
|
}
|
|
365
|
+
var cdStep = projectName === "." ? "" : ` cd ${name}
|
|
366
|
+
`;
|
|
362
367
|
console.log(`
|
|
363
368
|
Done! Next steps:
|
|
364
369
|
|
|
365
|
-
cd
|
|
366
|
-
cd backend && npm install && cd ..
|
|
370
|
+
${cdStep} cd backend && npm install && cd ..
|
|
367
371
|
cd frontend && npm install && cd ..
|
|
368
372
|
|
|
369
373
|
# Start backend
|