Skip to content

Commit 28e0119

Browse files
committed
New build method of @reactpy/app
1 parent ae242ba commit 28e0119

File tree

6 files changed

+19
-36
lines changed

6 files changed

+19
-36
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# --- Build Artifacts ---
2-
src/reactpy/static/**/index.js*
2+
src/reactpy/static/*
33

44
# --- Jupyter ---
55
*.ipynb_checkpoints

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ commands = [
6969
'bun run --cwd "src/js/packages/@reactpy/client" build',
7070
'bun install --cwd "src/js/packages/@reactpy/app"',
7171
'bun run --cwd "src/js/packages/@reactpy/app" build',
72-
'python "src/build_scripts/copy_dir.py" "src/js/packages/@reactpy/app/dist" "src/reactpy/static/assets"',
72+
'python "src/build_scripts/copy_dir.py" "src/js/packages/@reactpy/app/dist" "src/reactpy/static"',
7373
]
7474
artifacts = []
7575

src/js/packages/@reactpy/app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"typescript": "^5.7.3"
1212
},
1313
"scripts": {
14-
"build": "bun build \"src/index.ts\" --outdir \"dist\" --minify --sourcemap=linked",
14+
"build": "bun build \"src/index.html\" --outdir=\"dist\" --minify --sourcemap=\"linked\" --experimental-html --public-path=\"reactpy/static/\"",
1515
"checkTypes": "tsc --noEmit"
1616
}
1717
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!doctype html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8" />
6+
<script type="module" crossorigin src="index.ts"></script>
7+
</head>
8+
9+
<body>
10+
<div id="app"></div>
11+
{mount_script}
12+
<!-- TODO: Replace `mount_script` with template tag -->
13+
</body>
14+
15+
</html>
Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1 @@
1-
import { mount, SimpleReactPyClient } from "@reactpy/client";
2-
3-
function app(element: HTMLElement) {
4-
const client = new SimpleReactPyClient({
5-
serverLocation: {
6-
url: document.location.origin,
7-
route: document.location.pathname,
8-
query: document.location.search,
9-
},
10-
});
11-
mount(element, client);
12-
}
13-
14-
const element = document.getElementById("app");
15-
if (element) {
16-
app(element);
17-
} else {
18-
console.error("Element with id 'app' not found");
19-
}
1+
export { mount } from "@reactpy/client";

src/reactpy/static/index.html

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

0 commit comments

Comments
 (0)