Skip to content

Commit 5f8f65b

Browse files
committed
initial work to rewrite the client in typescript
1 parent 6a4c947 commit 5f8f65b

27 files changed

+971
-678
lines changed

noxfile.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -232,21 +232,18 @@ def check_docs(session: Session) -> None:
232232

233233

234234
@group.session
235-
def check_javascript_suite(session: Session) -> None:
236-
"""Run the Javascript-based test suite and ensure it bundles succesfully"""
237-
session.run("npm", "run", "test", external=True)
235+
def check_javascript_tests(session: Session) -> None:
236+
session.run("npm", "run", "check:tests", external=True)
238237

239238

240239
@group.session
241-
def check_javascript_build(session: Session) -> None:
242-
"""Run the Javascript-based test suite and ensure it bundles succesfully"""
243-
session.run("npm", "run", "test", external=True)
240+
def check_javascript_format(session: Session) -> None:
241+
session.run("npm", "run", "check:format", external=True)
244242

245243

246244
@group.session
247-
def check_javascript_format(session: Session) -> None:
248-
"""Check that Javascript style guidelines are being followed"""
249-
session.run("npm", "run", "check-format", external=True)
245+
def check_javascript_types(session: Session) -> None:
246+
session.run("npm", "run", "check:types", external=True)
250247

251248

252249
@group.session

src/client/package-lock.json

Lines changed: 152 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/client/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
},
1010
"scripts": {
1111
"build": "vite build",
12-
"check-format": "npm --workspaces run check-format",
12+
"publish": "npm --workspaces publish",
1313
"format": "npm --workspaces run format",
14-
"test": "npm --workspaces test"
14+
"check:format": "npm --workspaces run check-format",
15+
"check:tests": "npm --workspaces check:tests",
16+
"check:types": "npm --workspaces run check:types"
1517
},
1618
"version": "1.0.0",
1719
"workspaces": [

src/client/packages/app/package.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,22 @@
66
},
77
"description": "A client application for ReactPy implemented in React",
88
"devDependencies": {
9-
"prettier": "^2.5.1"
9+
"prettier": "^2.5.1",
10+
"typescript": "^4.9.5",
11+
"@types/react-dom": "^18.0.11"
1012
},
1113
"license": "MIT",
12-
"main": "src/index.js",
14+
"main": "src/index.tsx",
1315
"name": "@reactpy/app",
1416
"repository": {
1517
"type": "git",
1618
"url": "https://github.com/reactive-python/reactpy"
1719
},
1820
"scripts": {
19-
"check-format": "prettier --check ./src",
2021
"format": "prettier --write ./src",
21-
"test": "echo 'no tests'"
22-
}
22+
"check:format": "prettier --check ./src",
23+
"check:tests": "echo 'no tests'",
24+
"check:types": "tsc"
25+
},
26+
"version": "0.45.0"
2327
}

src/client/packages/app/src/index.js

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from "react";
2+
import { render } from "react-dom";
3+
import { Layout, SimpleReactPyServer } from "@reactpy/client";
4+
5+
export function mount(root: HTMLElement) {
6+
const server = new SimpleReactPyServer({
7+
serverApi: {
8+
baseUrl: document.location.origin,
9+
routePath: document.location.pathname,
10+
queryString: document.location.search,
11+
},
12+
});
13+
render(<Layout server={server} />, root);
14+
}

0 commit comments

Comments
 (0)