@knowcode/doc-builder 1.2.5 → 1.2.6

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.
@@ -490,6 +490,14 @@ async function buildDocumentation(config) {
490
490
  await createAuthPages(outputDir, config);
491
491
  }
492
492
 
493
+ // Create index.html from README.html if it doesn't exist
494
+ const indexPath = path.join(outputDir, 'index.html');
495
+ const readmePath = path.join(outputDir, 'README.html');
496
+ if (!fs.existsSync(indexPath) && fs.existsSync(readmePath)) {
497
+ await fs.copy(readmePath, indexPath);
498
+ console.log(chalk.green('✅ Created index.html from README.html'));
499
+ }
500
+
493
501
  console.log(chalk.green('✅ Documentation build complete!'));
494
502
  }
495
503
 
package/lib/deploy.js CHANGED
@@ -341,33 +341,14 @@ async function deployToVercel(config, isProd = false) {
341
341
  async function prepareDeployment(config) {
342
342
  const outputDir = path.join(process.cwd(), config.outputDir || 'html');
343
343
 
344
- // Create a simple index redirect if needed
344
+ // Create index.html from README.html if needed
345
345
  const indexPath = path.join(outputDir, 'index.html');
346
346
  if (!fs.existsSync(indexPath)) {
347
347
  const readmePath = path.join(outputDir, 'README.html');
348
348
  if (fs.existsSync(readmePath)) {
349
- // Create redirect to README.html with proper styling
350
- const redirectHtml = `<!DOCTYPE html>
351
- <html>
352
- <head>
353
- <meta charset="UTF-8">
354
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
355
- <title>${config.siteName || 'Documentation'}</title>
356
- <link rel="stylesheet" href="/css/style.css">
357
- <script>
358
- // Immediate redirect with fallback
359
- window.location.replace('/README.html');
360
- </script>
361
- </head>
362
- <body>
363
- <div style="text-align: center; margin-top: 50px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;">
364
- <p>Loading documentation...</p>
365
- <p>If you are not redirected automatically, <a href="/README.html">click here</a>.</p>
366
- </div>
367
- </body>
368
- </html>`;
369
- fs.writeFileSync(indexPath, redirectHtml);
370
- console.log(chalk.green('✅ Created index.html redirect to README.html'));
349
+ // Copy README.html to index.html for proper root page
350
+ fs.copyFileSync(readmePath, indexPath);
351
+ console.log(chalk.green('✅ Created index.html from README.html'));
371
352
  } else {
372
353
  // If no README.html, create a simple redirect to home
373
354
  // This should rarely happen since build process now auto-generates README.md
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowcode/doc-builder",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "description": "Reusable documentation builder for markdown-based sites with Vercel deployment support",
5
5
  "main": "index.js",
6
6
  "bin": {