@t3lnet/sceneforge 1.0.13 → 1.0.14

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/dist/index.js CHANGED
@@ -2387,13 +2387,27 @@ async function discoverDemos(demoDir) {
2387
2387
  }
2388
2388
 
2389
2389
  // context/template-loader.ts
2390
+ import { existsSync } from "fs";
2390
2391
  import * as fs5 from "fs/promises";
2391
2392
  import * as path5 from "path";
2392
2393
  import { fileURLToPath } from "url";
2393
2394
  var __filename = fileURLToPath(import.meta.url);
2394
2395
  var __dirname = path5.dirname(__filename);
2395
2396
  function getTemplatesDir() {
2396
- return path5.join(__dirname, "templates");
2397
+ const candidates = [
2398
+ // Standard dist layout: dist/templates/{base,stages,skills}
2399
+ path5.join(__dirname, "templates"),
2400
+ // Nested layout if templates were copied into an existing dist/templates
2401
+ path5.join(__dirname, "templates", "templates"),
2402
+ // Source layout when templates are shipped under context/templates
2403
+ path5.join(__dirname, "..", "context", "templates")
2404
+ ];
2405
+ for (const candidate of candidates) {
2406
+ if (existsSync(path5.join(candidate, "base"))) {
2407
+ return candidate;
2408
+ }
2409
+ }
2410
+ return candidates[0];
2397
2411
  }
2398
2412
  async function loadTemplate(category, name) {
2399
2413
  const templatesDir = getTemplatesDir();
@@ -2420,7 +2434,9 @@ async function loadTemplatesByCategory(category) {
2420
2434
  }
2421
2435
  return templates;
2422
2436
  } catch (error) {
2423
- throw new Error(`Failed to load templates from ${category}: ${error}`);
2437
+ throw new Error(
2438
+ `Failed to load templates from ${category} in ${templatesDir}: ${error}`
2439
+ );
2424
2440
  }
2425
2441
  }
2426
2442
  function interpolateVariables(content, variables) {