create-surf-app 0.1.1 → 0.1.3

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.
Files changed (2) hide show
  1. package/dist/index.js +16 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -92,7 +92,7 @@ var templates = {
92
92
  private: true,
93
93
  scripts: {
94
94
  start: "node server.js",
95
- dev: "node --watch server.js"
95
+ dev: "node --env-file=.env --watch server.js"
96
96
  },
97
97
  dependencies: {
98
98
  "@surf-ai/sdk": "latest",
@@ -111,6 +111,8 @@ createServer().start()
111
111
  // name: text('name').notNull(),
112
112
  // created_at: timestamp('created_at').defaultNow(),
113
113
  // })
114
+ `,
115
+ "backend/.env": `PORT=${backendPort}
114
116
  `,
115
117
  // ── Frontend ─────────────────────────────────────────────────────────────
116
118
  "frontend/package.json": JSON.stringify(frontendPkg, null, 2),
@@ -299,9 +301,18 @@ exports.users = pgTable('users', {
299
301
  Tables are auto-created on startup and when \`schema.js\` changes (file watcher).
300
302
  The agent can also call \`POST /api/__sync-schema\` explicitly after editing.
301
303
 
304
+ ## Dev Servers
305
+
306
+ - Frontend: \`cd frontend && npm run dev\` (port from \`.env\`, do NOT pass \`--port\`)
307
+ - Backend: \`cd backend && npm run dev\` (port from \`.env\`)
308
+ - After \`npm install\` new packages, do NOT restart servers \u2014 Vite auto-discovers deps, backend uses \`node --watch\`
309
+ - If a server crashes, restart with \`npm run dev\` in that directory
310
+ - NEVER use \`npx vite\` \u2014 always use \`npm run dev\`
311
+
302
312
  ## Do NOT modify
303
313
 
304
314
  - \`vite.config.ts\` \u2014 proxy and build config
315
+ - \`frontend/.env\` \u2014 port configuration (auto-generated)
305
316
  - \`backend/server.js\` \u2014 uses @surf-ai/sdk/server
306
317
  - \`entry-client.tsx\` \u2014 app bootstrap with SSR hydration
307
318
  - \`entry-server.tsx\` \u2014 SSR render for deploy
@@ -322,7 +333,7 @@ The agent can also call \`POST /api/__sync-schema\` explicitly after editing.
322
333
  var root = path.resolve(projectName);
323
334
  var name = path.basename(root);
324
335
  console.log(`
325
- Creating Surf app in ${root}
336
+ Creating Surf app in ./${projectName === "." ? "" : name}
326
337
  `);
327
338
  fs.mkdirSync(root, { recursive: true });
328
339
  for (const [relPath, content] of Object.entries(templates)) {
@@ -348,11 +359,12 @@ function copyDir(src, dest) {
348
359
  }
349
360
  }
350
361
  }
362
+ var cdStep = projectName === "." ? "" : ` cd ${name}
363
+ `;
351
364
  console.log(`
352
365
  Done! Next steps:
353
366
 
354
- cd ${name}
355
- cd backend && npm install && cd ..
367
+ ${cdStep} cd backend && npm install && cd ..
356
368
  cd frontend && npm install && cd ..
357
369
 
358
370
  # Start backend
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-surf-app",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Scaffold a Surf app — Vite + React + Express + @surf-ai/sdk",
5
5
  "type": "module",
6
6
  "bin": {