@kenjura/ursa 0.45.0 → 0.46.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # 0.46.0
2
+ 2025-12-20
3
+
4
+ - Normalized handling of trailing slashes in URLs
5
+
6
+ # 0.45.0
7
+ 2025-12-20
8
+
9
+ - Added --exclude flag to ignore specified files or directories during generation
10
+ - Improved performance of the serve command with optimized file watching
11
+ - Automatically generating index.html for directories without an index file
12
+
1
13
  # 0.44.0
2
14
  2025-12-16
3
15
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@kenjura/ursa",
3
3
  "author": "Andrew London <andrew@kenjura.com>",
4
4
  "type": "module",
5
- "version": "0.45.0",
5
+ "version": "0.46.0",
6
6
  "description": "static site generator from MD/wikitext/YML",
7
7
  "main": "lib/index.js",
8
8
  "bin": {
@@ -635,10 +635,15 @@ async function generateAutoIndices(output, directories, source, templates, menu,
635
635
  // Alternate index file names to look for (in priority order)
636
636
  const INDEX_ALTERNATES = ['_index.html', 'home.html', '_home.html'];
637
637
 
638
+ // Normalize paths (remove trailing slashes for consistent replacement)
639
+ const sourceNorm = source.replace(/\/+$/, '');
640
+ const outputNorm = output.replace(/\/+$/, '');
641
+
638
642
  // Get all output directories (including root)
639
- const outputDirs = new Set([output]);
643
+ const outputDirs = new Set([outputNorm]);
640
644
  for (const dir of directories) {
641
- const outputDir = dir.replace(source, output);
645
+ // Handle both with and without trailing slash in source
646
+ const outputDir = dir.replace(sourceNorm, outputNorm);
642
647
  outputDirs.add(outputDir);
643
648
  }
644
649
 
@@ -673,7 +678,7 @@ async function generateAutoIndices(output, directories, source, templates, menu,
673
678
  const content = await readFile(foundAlternate, 'utf8');
674
679
  await outputFile(indexPath, content);
675
680
  renamedCount++;
676
- progress.status('Auto-index', `Promoted ${basename(foundAlternate)} → index.html in ${dir.replace(output, '')}`);
681
+ progress.status('Auto-index', `Promoted ${basename(foundAlternate)} → index.html in ${dir.replace(outputNorm, '') || '/'}`);
677
682
  } catch (e) {
678
683
  progress.log(`Error promoting ${foundAlternate} to index.html: ${e.message}`);
679
684
  }
@@ -705,7 +710,7 @@ async function generateAutoIndices(output, directories, source, templates, menu,
705
710
  continue;
706
711
  }
707
712
 
708
- const folderDisplayName = dir === output ? 'Home' : toTitleCase(folderName);
713
+ const folderDisplayName = dir === outputNorm ? 'Home' : toTitleCase(folderName);
709
714
  const indexHtml = `<h1>${folderDisplayName}</h1>\n<ul class="auto-index">\n${items.join('\n')}\n</ul>`;
710
715
 
711
716
  const template = templates["default-template"];
@@ -731,7 +736,7 @@ async function generateAutoIndices(output, directories, source, templates, menu,
731
736
 
732
737
  await outputFile(indexPath, finalHtml);
733
738
  generatedCount++;
734
- progress.status('Auto-index', `Generated index.html for ${dir.replace(output, '') || '/'}`);
739
+ progress.status('Auto-index', `Generated index.html for ${dir.replace(outputNorm, '') || '/'}`);
735
740
  } catch (e) {
736
741
  progress.log(`Error generating auto-index for ${dir}: ${e.message}`);
737
742
  }