create-nara 1.0.11 → 1.0.12

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.

Potentially problematic release.


This version of create-nara might be problematic. Click here for more details.

Files changed (2) hide show
  1. package/dist/template.js +19 -1
  2. package/package.json +1 -1
package/dist/template.js CHANGED
@@ -60,7 +60,25 @@ export async function setupProject(options) {
60
60
  if (features.includes('uploads')) {
61
61
  fs.mkdirSync(path.join(targetDir, 'uploads'), { recursive: true });
62
62
  }
63
- // 6. Generate package.json (dynamic content)
63
+ // 6. Modify server.ts to import feature routes
64
+ const serverPath = path.join(targetDir, 'server.ts');
65
+ if (fs.existsSync(serverPath)) {
66
+ let serverContent = fs.readFileSync(serverPath, 'utf8');
67
+ // Add auth routes import and registration
68
+ if (features.includes('auth')) {
69
+ // Add import after web routes import
70
+ serverContent = serverContent.replace("import { registerRoutes } from './routes/web.js';", "import { registerRoutes } from './routes/web.js';\nimport { registerAuthRoutes } from './routes/auth.js';");
71
+ // Add registration before app.start()
72
+ serverContent = serverContent.replace('app.start();', 'registerAuthRoutes(app);\napp.start();');
73
+ }
74
+ // Add upload routes import and registration
75
+ if (features.includes('uploads')) {
76
+ serverContent = serverContent.replace("import { registerRoutes } from './routes/web.js';", "import { registerRoutes } from './routes/web.js';\nimport { registerUploadRoutes } from './routes/uploads.js';");
77
+ serverContent = serverContent.replace('app.start();', 'registerUploadRoutes(app);\napp.start();');
78
+ }
79
+ fs.writeFileSync(serverPath, serverContent);
80
+ }
81
+ // 7. Generate package.json (dynamic content)
64
82
  const pkg = createPackageJson(projectName, mode, features);
65
83
  fs.writeFileSync(path.join(targetDir, 'package.json'), JSON.stringify(pkg, null, 2));
66
84
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nara",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "CLI to scaffold NARA projects",
5
5
  "type": "module",
6
6
  "bin": {