create-backlist 6.1.1 → 6.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-backlist",
3
- "version": "6.1.1",
3
+ "version": "6.1.3",
4
4
  "description": "An advanced, multi-language backend generator based on frontend analysis.",
5
5
  "type": "commonjs",
6
6
  "bin": {
@@ -85,7 +85,7 @@ async function generateNodeProject(options) {
85
85
  console.log(chalk.yellow(' -> No API endpoints found. A basic project will be created.'));
86
86
  }
87
87
 
88
- // --- Step 2: Identify Models to Generate ---
88
+ // --- Step 2: Identify Models to Generate ---
89
89
  const modelsToGenerate = new Map();
90
90
  endpoints.forEach(ep => {
91
91
  // 🔥 FIX: 'ep.schemaFields' තිබ්බත් නැතත් Controller එක හදන්න ඕන.
@@ -228,10 +228,22 @@ async function generateNodeProject(options) {
228
228
  }
229
229
 
230
230
  // --- Step 9: Generate Main Route File & Inject Logic into Server ---
231
- // IMPORTANT: 'endpoints' variable eka dan sanitized version eka.
232
- await renderAndWrite(getTemplatePath('node-ts-express/partials/routes.ts.ejs'), path.join(destSrcDir, 'routes.ts'), { endpoints, addAuth, dbType });
231
+ // 🔥 FIX: Auth Endpoints ටික routes.ts එකට යවන්න එපා.
232
+ // මොකද ඒවා Auth.routes.ts එකෙන් වෙනම හැන්ඩ්ල් වෙනවා.
233
+ const nonAuthEndpoints = endpoints.filter(ep => ep.controllerName !== 'Auth');
234
+
235
+ // IMPORTANT: Pass 'nonAuthEndpoints' instead of 'endpoints'
236
+ await renderAndWrite(
237
+ getTemplatePath('node-ts-express/partials/routes.ts.ejs'),
238
+ path.join(destSrcDir, 'routes.ts'),
239
+ { endpoints: nonAuthEndpoints, addAuth, dbType }
240
+ );
233
241
 
234
242
  let serverFileContent = await fs.readFile(path.join(destSrcDir, 'server.ts'), 'utf-8');
243
+
244
+ // =========================================================================
245
+ // 👇 මේ ටික තමයි උඹේ Code එකෙන් Missing වෙලා තිබ්බේ. මේක නැතුව DB Connect වෙන්නේ නෑ.
246
+ // =========================================================================
235
247
  let dbConnectionCode = '', swaggerInjector = '', authRoutesInjector = '';
236
248
 
237
249
  if (dbType === 'mongoose') {
@@ -253,6 +265,8 @@ async function generateNodeProject(options) {
253
265
  const listenRegex = /(app\.listen\()/;
254
266
  serverFileContent = serverFileContent.replace(listenRegex, `${swaggerInjector}\n$1`);
255
267
  await fs.writeFile(path.join(destSrcDir, 'server.ts'), serverFileContent);
268
+ // =========================================================================
269
+
256
270
 
257
271
  // --- Step 10: Install Dependencies & Run Post-install Scripts ---
258
272
  console.log(chalk.magenta(' -> Installing dependencies... This may take a moment.'));