Skip to content

Commit 50b051d

Browse files
committed
feat: switch react ui to use npm and Tauri
[Tauri](https://v2.tauri.app/) gives us a way to build a small platform application, while still allowing deployment as a conventional web app. The built macos arm64 app is around 3.5 megabytes! This also will enable us to have a command line interface, e.g. via https://v2.tauri.app/plugin/cli/ (not covered in this PR). > [!WARNING] > This introduces a development-time Rust dependence, as that is how Tauri works -- the "server side"/launcher is written in Rust. Signed-off-by: Nick Mitchell <[email protected]>
1 parent b769704 commit 50b051d

30 files changed

+12387
-5717
lines changed

pdl-live-react/.gitignore

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
1-
.yarn/*
2-
!.yarn/patches
3-
!.yarn/plugins
4-
!.yarn/releases
5-
!.yarn/sdks
6-
!.yarn/versions
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
79

8-
# Swap the comments on the following lines if you wish to use zero-installs
9-
# In that case, don't forget to run `yarn config set enableGlobalCache false`!
10-
# Documentation here: https://yarnpkg.com/features/caching#zero-installs
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
1114

12-
#!.yarn/cache
13-
.pnp.*
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?
1425

15-
####
16-
node_modules/
26+
# Playwright
1727
/test-results/
1828
/playwright-report/
1929
/blob-report/
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["tauri-apps.tauri-vscode", "rust-lang.rust-analyzer"]
3+
}

pdl-live-react/.yarnrc.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

pdl-live-react/README.md

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
# PDL Viewer
1+
# Prompt Declaration Language - Viewer
22

33
To get started, make sure you have a recent version of
44
[NodeJS](https://nodejs.org/en/download) installed and
5-
[Yarn](https://classic.yarnpkg.com/lang/en/docs/install). On MacOS,
6-
these can be installed via `brew install node yarn`.
5+
[Rust](https://www.rust-lang.org/tools/install).
76

87
## Implementation Details
98

10-
The PDL Viewer uses [Vite](https://vite.dev/) for bundling,
11-
[React](https://react.dev/) for the UI,
9+
The PDL Viewer uses [Tauri](https://v2.tauri.app/) to help with
10+
building production platform applications. Under the covers, Tauri uses
11+
[Vite](https://vite.dev/) for bundling.
12+
13+
The code leverages [React](https://react.dev/) for the UI,
1214
[PatternFly](https://www.patternfly.org/) for UI components, and is
1315
written in [TypeScript](https://www.typescriptlang.org/). The React
1416
components are written in [TSX](https://react.dev/learn/typescript)
@@ -18,29 +20,37 @@ components are written in [TSX](https://react.dev/learn/typescript)
1820

1921
To install dependencies:
2022
```shell
21-
yarn
23+
npm ci
2224
```
2325

2426
To start the watcher:
2527
```shell
26-
yarn dev
28+
npm start
2729
```
2830

29-
Which will open up a local port which you can view in your favorite
30-
browser. Edits to any source files will result in quick and automatic
31-
updates to that running UI.
31+
Which will open a new window. Edits to any source files will result in
32+
quick and automatic updates to that running UI.
3233

3334
## Tests
3435

3536
There are currently only simple tests for: linting, formatting, and
3637
type checking. These can be run via:
3738
```shell
38-
yarn test
39+
npm test
3940
```
4041

4142
## Production
4243

43-
This will generate production bundles in `dist/`
44+
This will generate production web app bundles in `dist/`, and a production platform application.
45+
```shell
46+
npm run build
47+
```
48+
49+
### Production Platform Application Builds
50+
51+
To build production double-clickable applications:
4452
```shell
45-
yarn build
53+
npm run build:app
4654
```
55+
56+
The built applications will be found under `src-tauri/target/release/bundle`.

pdl-live-react/eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import reactRefresh from 'eslint-plugin-react-refresh'
55
import tseslint from 'typescript-eslint'
66

77
export default tseslint.config(
8-
{ ignores: ['dist','test-results','src/**/*.d.ts'] },
8+
{ ignores: ['dist','test-results','src/**/*.d.ts','src-tauri'] },
99
{
1010
extends: [js.configs.recommended, ...tseslint.configs.recommended],
1111
files: ['**/*.{ts,tsx}'],

0 commit comments

Comments
 (0)