@gtkx/testing 0.1.53 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -13
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -21,25 +21,44 @@ GTKX bridges React's component model with GTK4's native widget system. Write fam
|
|
|
21
21
|
## Features
|
|
22
22
|
|
|
23
23
|
- **React Components** — Use React hooks, state, and component patterns you already know
|
|
24
|
-
- **
|
|
24
|
+
- **Hot Module Replacement** — Edit your code and see changes instantly, powered by Vite
|
|
25
25
|
- **Native Performance** — Direct FFI bindings to GTK4 via Rust and libffi
|
|
26
|
+
- **CLI & Scaffolding** — Get started in seconds with `npx @gtkx/cli create`
|
|
26
27
|
- **CSS-in-JS Styling** — Emotion-style `css` template literals for GTK widgets
|
|
27
28
|
- **Testing Library** — Familiar `screen`, `userEvent`, and query APIs for testing components
|
|
28
29
|
|
|
29
30
|
## Quick Start
|
|
30
31
|
|
|
32
|
+
Create a new GTKX app with a single command:
|
|
33
|
+
|
|
31
34
|
```bash
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
npx @gtkx/cli create
|
|
36
|
+
```
|
|
34
37
|
|
|
35
|
-
|
|
36
|
-
npm install -D @types/react tsx typescript
|
|
38
|
+
This launches an interactive wizard that sets up your project with TypeScript, your preferred package manager, and optional testing support.
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
npm install @gtkx/css
|
|
40
|
+
You can also pass options directly:
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
```bash
|
|
43
|
+
npx @gtkx/cli create my-app --app-id com.example.myapp --pm pnpm --testing vitest
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Then start developing with HMR:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
cd my-app
|
|
50
|
+
npm run dev
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Edit your code and see changes instantly without restarting the app!
|
|
54
|
+
|
|
55
|
+
### Manual Setup
|
|
56
|
+
|
|
57
|
+
Alternatively, install packages directly:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npm install @gtkx/cli @gtkx/react @gtkx/ffi react
|
|
61
|
+
npm install -D @types/react typescript
|
|
43
62
|
```
|
|
44
63
|
|
|
45
64
|
Create your first app:
|
|
@@ -80,7 +99,13 @@ export const App = () => {
|
|
|
80
99
|
};
|
|
81
100
|
```
|
|
82
101
|
|
|
83
|
-
Run with:
|
|
102
|
+
Run with HMR:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
npx gtkx dev src/app.tsx
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Or without HMR:
|
|
84
109
|
|
|
85
110
|
```bash
|
|
86
111
|
npx tsx index.tsx
|
|
@@ -177,7 +202,8 @@ Query types: `ByRole`, `ByText`, `ByLabelText`, `ByTestId`
|
|
|
177
202
|
A comprehensive showcase of GTK4 widgets and features:
|
|
178
203
|
|
|
179
204
|
```bash
|
|
180
|
-
|
|
205
|
+
cd examples/gtk4-demo
|
|
206
|
+
pnpm dev
|
|
181
207
|
```
|
|
182
208
|
|
|
183
209
|
### Todo App
|
|
@@ -185,14 +211,16 @@ turbo start --filter=gtk4-demo
|
|
|
185
211
|
A todo app demonstrating `@gtkx/testing` with realistic component tests:
|
|
186
212
|
|
|
187
213
|
```bash
|
|
188
|
-
|
|
189
|
-
|
|
214
|
+
cd examples/todo
|
|
215
|
+
pnpm dev
|
|
216
|
+
pnpm test
|
|
190
217
|
```
|
|
191
218
|
|
|
192
219
|
## Packages
|
|
193
220
|
|
|
194
221
|
| Package | Description |
|
|
195
222
|
|---------|-------------|
|
|
223
|
+
| [@gtkx/cli](packages/cli) | CLI for creating and developing GTKX apps with HMR |
|
|
196
224
|
| [@gtkx/react](packages/react) | React reconciler and JSX components |
|
|
197
225
|
| [@gtkx/ffi](packages/ffi) | TypeScript FFI bindings for GTK4 |
|
|
198
226
|
| [@gtkx/native](packages/native) | Rust native module for FFI bridge |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gtkx/testing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Testing utilities for GTKX applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gtk",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@gtkx/ffi": "0.
|
|
36
|
-
"@gtkx/native": "0.
|
|
37
|
-
"@gtkx/react": "0.
|
|
35
|
+
"@gtkx/ffi": "0.2.0",
|
|
36
|
+
"@gtkx/native": "0.2.0",
|
|
37
|
+
"@gtkx/react": "0.2.0"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "tsc -b && cp ../../README.md .",
|