@kenjura/ursa 0.40.0 → 0.41.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,8 @@
1
+ # 0.41.0
2
+ 2025-12-13
3
+
4
+ - Fixed footer bug
5
+
1
6
  # 0.40.0
2
7
  2025-12-13
3
8
 
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.40.0",
5
+ "version": "0.41.0",
6
6
  "description": "static site generator from MD/wikitext/YML",
7
7
  "main": "lib/index.js",
8
8
  "bin": {
@@ -567,25 +567,42 @@ async function getFooter(source, _source) {
567
567
  console.error(`Error reading footer.md: ${e.message}`);
568
568
  }
569
569
 
570
- // Try to read package.json from doc repo
570
+ // Try to read package.json from doc repo (check both source dir and parent)
571
571
  let docPackage = null;
572
- const packagePath = join(resolve(_source), 'package.json');
573
- try {
574
- if (existsSync(packagePath)) {
575
- const packageJson = await readFile(packagePath, 'utf8');
576
- docPackage = JSON.parse(packageJson);
572
+ const sourceDir = resolve(_source);
573
+ const packagePaths = [
574
+ join(sourceDir, 'package.json'), // In source dir itself
575
+ join(sourceDir, '..', 'package.json'), // One level up (if docs is a subfolder)
576
+ ];
577
+
578
+ for (const packagePath of packagePaths) {
579
+ try {
580
+ if (existsSync(packagePath)) {
581
+ const packageJson = await readFile(packagePath, 'utf8');
582
+ docPackage = JSON.parse(packageJson);
583
+ console.log(`Found doc package.json at ${packagePath}`);
584
+ break;
585
+ }
586
+ } catch (e) {
587
+ // Continue to next path
577
588
  }
578
- } catch (e) {
579
- console.error(`Error reading doc package.json: ${e.message}`);
580
589
  }
581
590
 
582
591
  // Get ursa version from ursa's own package.json
592
+ // Use import.meta.url to find the package.json relative to this file
583
593
  let ursaVersion = 'unknown';
584
594
  try {
585
- const ursaPackagePath = new URL('../../../package.json', import.meta.url).pathname;
586
- const ursaPackageJson = await readFile(ursaPackagePath, 'utf8');
587
- const ursaPackage = JSON.parse(ursaPackageJson);
588
- ursaVersion = ursaPackage.version;
595
+ // From src/jobs/generate.js, go up to package root
596
+ const currentFileUrl = new URL(import.meta.url);
597
+ const currentDir = dirname(currentFileUrl.pathname);
598
+ const ursaPackagePath = resolve(currentDir, '..', '..', 'package.json');
599
+
600
+ if (existsSync(ursaPackagePath)) {
601
+ const ursaPackageJson = await readFile(ursaPackagePath, 'utf8');
602
+ const ursaPackage = JSON.parse(ursaPackageJson);
603
+ ursaVersion = ursaPackage.version;
604
+ console.log(`Found ursa package.json at ${ursaPackagePath}, version: ${ursaVersion}`);
605
+ }
589
606
  } catch (e) {
590
607
  console.error(`Error reading ursa package.json: ${e.message}`);
591
608
  }