diff --git a/index.html b/index.html
index a3ff4bae..afe995e1 100644
--- a/index.html
+++ b/index.html
@@ -1,29 +1,69 @@
-
-
-
-
-
-
+
+
+
+
+
+
+ Examples Index
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/package.json b/package.json
index ae93c18a..d2cc41ba 100644
--- a/package.json
+++ b/package.json
@@ -30,6 +30,7 @@
"./packages/*"
],
"devDependencies": {
+ "@types/node": "latest",
"@typescript-eslint/eslint-plugin": "7.2.0",
"@typescript-eslint/parser": "7.2.0",
"eslint": "8.57.0",
diff --git a/vite.config.ts b/vite.config.ts
new file mode 100644
index 00000000..bf7d8e18
--- /dev/null
+++ b/vite.config.ts
@@ -0,0 +1,63 @@
+/* eslint-disable import/no-extraneous-dependencies */
+import * as fs from "fs";
+import * as path from "path";
+import { defineConfig } from "vite";
+import { globSync } from "glob";
+
+const writeIndexHTML = () => {
+ let links: string = "";
+ const examplePaths = globSync("packages/**/src/**/example.html");
+ for (const examplePath of examplePaths) {
+ const directory = path.dirname(examplePath);
+ const packageNameMatch = directory.match(/packages\\([^\\]+)/);
+ if (!(packageNameMatch && packageNameMatch.length > 1)) continue;
+ const packageName = packageNameMatch[1];
+ const exampleName = path.basename(directory);
+ links += `${packageName}/${exampleName}\n`;
+ }
+ const index = `
+
+
+
+
+
+
+ Examples Index
+
+
+
+
+
+
Choose an example
+ ${links}
+
+
+
+
+ `;
+ fs.writeFileSync("./index.html", index);
+};
+
+const createIndex = () => ({
+ name: "create-index",
+ configureServer() {
+ // fs.watch("./packages", { recursive: true }, writeIndexHTML);
+ writeIndexHTML();
+ },
+});
+
+export default defineConfig({
+ plugins: [createIndex()],
+});
diff --git a/yarn.lock b/yarn.lock
index c0fc421d..a230062a 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -733,6 +733,15 @@ __metadata:
languageName: node
linkType: hard
+"@types/node@npm:latest":
+ version: 22.2.0
+ resolution: "@types/node@npm:22.2.0"
+ dependencies:
+ undici-types: ~6.13.0
+ checksum: 63724799337bfb57719a1992690e738341d824e1744a2ac52c5278a008fbfadf99765519c19858feb80418cc7da0d5c8bdf7ea4d82973869b3882bd602c48ade
+ languageName: node
+ linkType: hard
+
"@types/semver@npm:^7.5.0":
version: 7.5.8
resolution: "@types/semver@npm:7.5.8"
@@ -3614,6 +3623,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "root-workspace-0b6124@workspace:."
dependencies:
+ "@types/node": latest
"@typescript-eslint/eslint-plugin": 7.2.0
"@typescript-eslint/parser": 7.2.0
eslint: 8.57.0
@@ -4159,6 +4169,13 @@ __metadata:
languageName: node
linkType: hard
+"undici-types@npm:~6.13.0":
+ version: 6.13.0
+ resolution: "undici-types@npm:6.13.0"
+ checksum: 9d0ef6bf58994bebbea6a4ab75f381c69a89a7ed151bfbae0d4ef95450d56502c9eccb323abf17b7d099c1d9c1cbae62e909e4dfeb8d204612d2f1fdada24707
+ languageName: node
+ linkType: hard
+
"unique-filename@npm:^3.0.0":
version: 3.0.0
resolution: "unique-filename@npm:3.0.0"