Skip to content

Commit a0039ef

Browse files
committed
update build
1 parent 697a7ac commit a0039ef

File tree

8 files changed

+50
-490
lines changed

8 files changed

+50
-490
lines changed

build.ts

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -25,45 +25,45 @@ async function buildJs(
2525
}
2626

2727
await Promise.all([
28-
buildJs("src/index.ts", { outdir: "dist/src" }),
29-
buildJs("src/react/useApp.tsx", { outdir: "dist/src/react" }),
30-
buildJs("examples/example-ui-react.tsx", { outdir: "dist/examples" }),
31-
buildJs("examples/example-ui.ts", { outdir: "dist/examples" }),
32-
buildJs("examples/example-server.ts", {
33-
target: "node",
34-
outdir: "dist/examples",
35-
}),
28+
buildJs("src/app.ts"),
29+
buildJs("src/react/index.tsx", { outdir: "dist/react" }),
30+
// buildJs("examples/example-ui-react.tsx", { outdir: "dist/examples" }),
31+
// buildJs("examples/example-ui.ts", { outdir: "dist/examples" }),
32+
// buildJs("examples/example-server.ts", {
33+
// target: "node",
34+
// outdir: "dist/examples",
35+
// }),
3636
]);
3737

38-
async function inlineHtml(htmlFilePath: string, outputFilePath: string) {
39-
let html = await readFile(htmlFilePath, "utf-8");
40-
// Find all src sources, then fetch them, then replace them
41-
const files = html.matchAll(
42-
/<script src="((?:\.\/)?dist\/.*?\.js)"><\/script>/g,
43-
);
44-
const fileContent = Object.fromEntries(
45-
await Promise.all(
46-
Array.from(files, async ([, filename]) => {
47-
const scriptContent = await readFile(filename, "utf-8");
48-
return [filename, scriptContent];
49-
}),
50-
),
51-
);
52-
html = html.replace(
53-
/<script src="((?:\.\/)?dist\/.*?\.js)"><\/script>/g,
54-
(_, filename) => {
55-
let scriptContent = fileContent[filename];
56-
// Escape </script> to prevent premature script tag closing
57-
// This is the standard way to inline scripts safely
58-
scriptContent = scriptContent.replace(/<\/script>/gi, "<\\/script>");
59-
return `<script>${scriptContent}</script>`;
60-
},
61-
);
62-
await writeFile(outputFilePath, html);
63-
}
38+
// async function inlineHtml(htmlFilePath: string, outputFilePath: string) {
39+
// let html = await readFile(htmlFilePath, "utf-8");
40+
// // Find all src sources, then fetch them, then replace them
41+
// const files = html.matchAll(
42+
// /<script src="((?:\.\/)?dist\/.*?\.js)"><\/script>/g,
43+
// );
44+
// const fileContent = Object.fromEntries(
45+
// await Promise.all(
46+
// Array.from(files, async ([, filename]) => {
47+
// const scriptContent = await readFile(filename, "utf-8");
48+
// return [filename, scriptContent];
49+
// }),
50+
// ),
51+
// );
52+
// html = html.replace(
53+
// /<script src="((?:\.\/)?dist\/.*?\.js)"><\/script>/g,
54+
// (_, filename) => {
55+
// let scriptContent = fileContent[filename];
56+
// // Escape </script> to prevent premature script tag closing
57+
// // This is the standard way to inline scripts safely
58+
// scriptContent = scriptContent.replace(/<\/script>/gi, "<\\/script>");
59+
// return `<script>${scriptContent}</script>`;
60+
// },
61+
// );
62+
// await writeFile(outputFilePath, html);
63+
// }
6464

65-
await inlineHtml("examples/example-ui.html", "dist/examples/example-ui.html");
66-
await inlineHtml(
67-
"examples/example-ui-react.html",
68-
"dist/examples/example-ui-react.html",
69-
);
65+
// await inlineHtml("examples/example-ui.html", "dist/examples/example-ui.html");
66+
// await inlineHtml(
67+
// "examples/example-ui-react.html",
68+
// "dist/examples/example-ui-react.html",
69+
// );

index.ts

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

package.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@
44
"version": "1.0.0",
55
"description": "Hey",
66
"type": "module",
7-
"main": "./src/index.ts",
7+
"main": "./dist/app.js",
88
"exports": {
9-
".": "./src/index.ts",
10-
"./types": "./src/types.ts",
11-
"./react/useApp": "./src/react/useApp.tsx"
9+
".": {
10+
"types": "./dist/app.d.ts",
11+
"default": "./dist/app.js"
12+
},
13+
"./react": {
14+
"types": "./dist/react/index.d.ts",
15+
"default": "./dist/react/index.js"
16+
}
1217
},
1318
"scripts": {
1419
"start:example-server0": "tsx examples/example-server.ts",

react/useApp.tsx

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

react/useAutoResize.ts

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

src/index.ts

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

0 commit comments

Comments
 (0)