zero-rust 0.2.0 → 0.3.1
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 +35 -10
- package/dist/bin.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,18 +1,43 @@
|
|
|
1
1
|
# zero-rust
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
The command-line tool for [Zero for Rust](https://github.com/wevm/zero-rust)
|
|
4
|
+
(the [`zero-client`](https://crates.io/crates/zero-client) crate). Your Zero
|
|
5
|
+
app's TypeScript schema stays the source of truth, and this tool generates
|
|
6
|
+
the Rust the client needs from it: a row struct per table with its
|
|
7
|
+
`Update` and `Key`, the schema, a typed query builder (`zql`), and typed
|
|
8
|
+
CRUD for mutators (`mutate`).
|
|
6
9
|
|
|
7
10
|
```sh
|
|
11
|
+
npm install --save-dev zero-rust
|
|
8
12
|
npx zero-rust codegen --schema-file shared/schema.ts --out src/schema.rs
|
|
9
13
|
```
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
`packages/zerogen`, shared with `zero-swift` and bundled in.
|
|
15
|
+
It needs Node 22.18 or later, which loads TypeScript files directly, and the
|
|
16
|
+
app's own `@rocicorp/zero`, 1.11 or later.
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
## `zero-rust codegen`
|
|
19
|
+
|
|
20
|
+
Options override `zero-rust.json`, which is read when present:
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"schema": "../web/shared/schema.ts",
|
|
25
|
+
"output": "src/schema.rs",
|
|
26
|
+
"tables": {
|
|
27
|
+
"issue": {"columns": {"shortID": {"type": "int"}}}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
`number()` columns are `f64`; set a column's type to `int` to make it an
|
|
33
|
+
`i64`, which must then hold integers. Include the output as a module with
|
|
34
|
+
`#[rustfmt::skip] mod schema;`. `--check` fails, without writing, when the
|
|
35
|
+
output is out of date, for CI. Run `npx zero-rust codegen --help` for every
|
|
36
|
+
option.
|
|
37
|
+
|
|
38
|
+
## Output and agents
|
|
39
|
+
|
|
40
|
+
The CLI is built on [incur](https://github.com/wevm/incur). `--format json`
|
|
41
|
+
prints the result as JSON, for scripts and CI. `--llms` prints a manifest of
|
|
42
|
+
the commands for a coding agent, and `npx zero-rust skills add` installs
|
|
43
|
+
them as an agent skill.
|
package/dist/bin.js
CHANGED
|
@@ -1016,7 +1016,7 @@ function createRustCli(version) {
|
|
|
1016
1016
|
// package.json
|
|
1017
1017
|
var package_default = {
|
|
1018
1018
|
name: "zero-rust",
|
|
1019
|
-
version: "0.
|
|
1019
|
+
version: "0.3.1",
|
|
1020
1020
|
description: "Generates the Rust row types, schema, and query builder of a Zero app for the Zero Rust client.",
|
|
1021
1021
|
license: "Apache-2.0",
|
|
1022
1022
|
repository: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zero-rust",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Generates the Rust row types, schema, and query builder of a Zero app for the Zero Rust client.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"esbuild": "0.28.2",
|
|
25
25
|
"oxfmt": "^0.74.0",
|
|
26
26
|
"vitest": "^5.0.5",
|
|
27
|
+
"zero-schema": "0.0.0",
|
|
27
28
|
"@rocicorp/zero": "1.13.0",
|
|
28
|
-
"zerogen": "0.0.0",
|
|
29
29
|
"zql": "0.0.0",
|
|
30
|
-
"
|
|
30
|
+
"zerogen": "0.0.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@rocicorp/zero": ">=1.11.0"
|