Skip to content

Commit 23fc370

Browse files
committed
Reorg build files
1 parent 8edc4c9 commit 23fc370

File tree

10 files changed

+28
-47
lines changed

10 files changed

+28
-47
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ dist
22
node_modules
33

44
# Auto-generated UI entry files (generated by vite.ui.config.ts)
5-
src/ui/entries/*.html
5+
src/ui/entries/
66
.vscode/mcp.json
77
.github/prompts/*
88

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
},
2929
"./ui": {
3030
"import": {
31-
"types": "./dist/esm/ui/build.d.ts",
32-
"default": "./dist/esm/ui/build.js"
31+
"types": "./dist/esm/ui/index.d.ts",
32+
"default": "./dist/esm/ui/index.js"
3333
},
3434
"require": {
35-
"types": "./dist/cjs/ui/build.d.ts",
36-
"default": "./dist/cjs/ui/build.js"
35+
"types": "./dist/cjs/ui/index.d.ts",
36+
"default": "./dist/cjs/ui/index.js"
3737
}
3838
}
3939
},

src/ui/build.ts renamed to src/ui/build/config.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,3 @@ export function createUIBuildConfig(options: UIBuildOptions): UserConfig {
120120
...viteConfig,
121121
};
122122
}
123-
124-
/**
125-
* Re-export the UIRegistry for consumers who want to programmatically
126-
* register custom UIs at runtime.
127-
*/
128-
export { UIRegistry, getDefaultUIRegistry, setDefaultUIRegistry } from "./registry.js";
129-
130-
/**
131-
* Re-export the useRenderData hook for consumers building custom UI components.
132-
*/
133-
export { useRenderData } from "./hooks/index.js";

src/ui/build/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/**
2+
* Build utilities for UI components.
3+
*/
4+
export { createUIBuildConfig, discoverComponents } from "./config.js";
5+
export type { UIBuildOptions } from "./config.js";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,4 @@ function mount() {
6161
}
6262

6363
mount();
64+

src/ui/build/template.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>{{TITLE}}</title>
7+
</head>
8+
<body>
9+
<div id="root" data-component="{{COMPONENT_NAME}}"></div>
10+
<script type="module" src="../build/mount.tsx"></script>
11+
</body>
12+
</html>

src/ui/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export { UIRegistry, getDefaultUIRegistry, setDefaultUIRegistry } from "./registry.js";
2+
export { useRenderData } from "./hooks/index.js";
3+
export { createUIBuildConfig } from "./build/index.js";

src/ui/template.html

Lines changed: 0 additions & 29 deletions
This file was deleted.

tsconfig.build.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@
2727
}
2828
},
2929
"include": ["src/**/*.ts", "src/**/*.tsx"],
30-
"exclude": ["src/ui/entries/**/*"]
30+
"exclude": ["src/ui/entries/**/*", "src/ui/build/mount.tsx"]
3131
}

vite.ui.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { join, resolve } from "path";
77

88
const componentsDir = resolve(__dirname, "src/ui/components");
99
const entriesDir = resolve(__dirname, "src/ui/entries");
10-
const templatePath = resolve(__dirname, "src/ui/template.html");
10+
const templatePath = resolve(__dirname, "src/ui/build/template.html");
1111

1212
/**
1313
* Discover all component directories in src/ui/components/

0 commit comments

Comments
 (0)