Skip to content

Commit 7c1a839

Browse files
committed
initial work to rewrite the client in typescript
1 parent 2fc8228 commit 7c1a839

27 files changed

+969
-678
lines changed

noxfile.py

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

196196

197197
@group.session
198-
def check_javascript_suite(session: Session) -> None:
199-
"""Run the Javascript-based test suite and ensure it bundles succesfully"""
200-
session.run("npm", "run", "test", external=True)
198+
def check_javascript_tests(session: Session) -> None:
199+
session.run("npm", "run", "check:tests", external=True)
201200

202201

203202
@group.session
204-
def check_javascript_build(session: Session) -> None:
205-
"""Run the Javascript-based test suite and ensure it bundles succesfully"""
206-
session.run("npm", "run", "test", external=True)
203+
def check_javascript_format(session: Session) -> None:
204+
session.run("npm", "run", "check:format", external=True)
207205

208206

209207
@group.session
210-
def check_javascript_format(session: Session) -> None:
211-
"""Check that Javascript style guidelines are being followed"""
212-
session.run("npm", "run", "check-format", external=True)
208+
def check_javascript_types(session: Session) -> None:
209+
session.run("npm", "run", "check:types", external=True)
213210

214211

215212
@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 & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
},
1010
"scripts": {
1111
"build": "vite build",
12-
"check-format": "npm --workspaces run check-format",
13-
"format": "npm --workspaces run format",
1412
"publish": "npm --workspaces publish",
15-
"test": "npm --workspaces test"
13+
"format": "npm --workspaces run format",
14+
"check:format": "npm --workspaces run check-format",
15+
"check:tests": "npm --workspaces check:tests",
16+
"check:types": "npm --workspaces run check:types"
1617
},
1718
"version": "1.0.0",
1819
"workspaces": [

src/client/packages/app/package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +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+
"check:format": "prettier --check ./src",
23+
"check:tests": "echo 'no tests'",
24+
"check:types": "tsc"
2225
},
2326
"version": "0.45.0"
2427
}

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)