@series-inc/rundot-3d-engine 0.4.4 → 0.5.1

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": "@series-inc/rundot-3d-engine",
3
- "version": "0.4.4",
3
+ "version": "0.5.1",
4
4
  "type": "module",
5
5
  "types": "./dist/index.d.ts",
6
6
  "scripts": {
@@ -36,8 +36,10 @@
36
36
  "@stowkit/reader": "^0.1.39",
37
37
  "@stowkit/three-loader": "^0.1.40",
38
38
  "three": "^0.180.0",
39
- "three-stdlib": "^2.36.0",
40
- "@series-inc/rundot-game-sdk": "5.3.0"
39
+ "three-stdlib": "^2.36.0"
40
+ },
41
+ "peerDependencies": {
42
+ "@series-inc/rundot-game-sdk": "^5.3.0"
41
43
  },
42
44
  "devDependencies": {
43
45
  "@types/three": "^0.180.0",
@@ -0,0 +1,3 @@
1
+ export const DOCS_LABEL = "Run.3DEngine Docs Index";
2
+ // Old labels that should be found and replaced when updating
3
+ export const LEGACY_LABELS = ["Docs Index"];
@@ -1,8 +1,9 @@
1
1
  import { readdirSync, statSync, writeFileSync } from "fs";
2
2
  import { join, relative, resolve, sep } from "path";
3
+ import { DOCS_LABEL } from "./docs-config.mjs";
3
4
 
4
5
  export function genDocsIndex(
5
- label = "Docs Index",
6
+ label = DOCS_LABEL,
6
7
  root = "docs",
7
8
  srcDir = resolve(import.meta.dirname, "..", "docs"),
8
9
  outPath = resolve(import.meta.dirname, "..", "docs-index.txt"),
@@ -82,7 +82,8 @@ if (existsSync(gitignorePath)) {
82
82
  // Generate docs index from the copied docs and splice into the consumer's AGENTS.md/CLAUDE.md
83
83
  const { genDocsIndex } = await import("./gen-docs-index.mjs");
84
84
  const { updateDocsIndex } = await import("./update-docs-index.mjs");
85
+ const { DOCS_LABEL } = await import("./docs-config.mjs");
85
86
 
86
87
  const indexPath = join(projectRoot, "docs-index.txt");
87
- genDocsIndex("Run.3DEngine Docs Index", ".rundot/3d-engine-docs", docsDest, indexPath);
88
+ genDocsIndex(DOCS_LABEL, ".rundot/3d-engine-docs", docsDest, indexPath);
88
89
  updateDocsIndex(projectRoot);
@@ -1,5 +1,6 @@
1
1
  import { existsSync, readFileSync, unlinkSync, writeFileSync } from "fs";
2
2
  import { resolve } from "path";
3
+ import { LEGACY_LABELS } from "./docs-config.mjs";
3
4
 
4
5
  export function updateDocsIndex(cwd = resolve(import.meta.dirname, "..")) {
5
6
  const indexPath = resolve(cwd, "docs-index.txt");
@@ -16,8 +17,13 @@ export function updateDocsIndex(cwd = resolve(import.meta.dirname, "..")) {
16
17
  console.warn("Could not parse label from docs-index.txt, skipping");
17
18
  return;
18
19
  }
19
- const escaped = labelMatch[1].replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
20
- const re = new RegExp(`\\[${escaped}\\][^\\n]*(?:\\n(?![\\[<])[^\\n]*)*`);
20
+
21
+ // Build regexes for the current label and all legacy labels
22
+ const allLabels = [labelMatch[1], ...LEGACY_LABELS];
23
+ const regexes = allLabels.map((label) => {
24
+ const escaped = label.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
25
+ return new RegExp(`\\[${escaped}\\][^\\n]*(?:\\n(?![\\[<])[^\\n]*)*`);
26
+ });
21
27
 
22
28
  const targets = ["AGENTS.md", "CLAUDE.md"];
23
29
 
@@ -33,8 +39,9 @@ export function updateDocsIndex(cwd = resolve(import.meta.dirname, "..")) {
33
39
 
34
40
  let content = readFileSync(filePath, "utf-8");
35
41
 
36
- if (re.test(content)) {
37
- content = content.replace(re, fresh);
42
+ const matchedRe = regexes.find((re) => re.test(content));
43
+ if (matchedRe) {
44
+ content = content.replace(matchedRe, fresh);
38
45
  } else {
39
46
  content = content.trimEnd() + "\n" + fresh + "\n";
40
47
  }