@rindle/cli 0.4.4 → 0.6.2
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 -30
- package/dist/index.d.ts +5 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -13
- package/dist/index.js.map +1 -1
- package/dist/platform.d.ts +2 -2
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +20 -9
- package/dist/platform.js.map +1 -1
- package/package.json +11 -15
- package/src/index.ts +19 -13
- package/src/platform.ts +24 -11
package/README.md
CHANGED
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
# @rindle/cli — the Rindle toolchain, prebuilt for npm
|
|
2
2
|
|
|
3
|
-
The Rindle
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
- **`rindled`** — the
|
|
7
|
-
[`rindle-replica`](../../rindle-replica) live-query engine plus the public
|
|
8
|
-
plane).
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
The Rindle CLI and local fleet components ship as prebuilt, per-platform binaries you can
|
|
4
|
+
`npm install`. This is how a JS/TS developer runs Rindle locally:
|
|
5
|
+
|
|
6
|
+
- **`rindled`** — the Rindle **read-follower** server: the `rindle-server` crate (the
|
|
7
|
+
SQLite-backed [`rindle-replica`](../../rindle-replica) live-query engine plus the public
|
|
8
|
+
subscription/lease plane). It tails a `rindle-replicator` write-master and has no write
|
|
9
|
+
ingress of its own.
|
|
10
|
+
- **`rindle`** — the CLI to inspect, run, and manage the data tier: `rindle status` / `migrate` /
|
|
11
|
+
`schema`, plus the local-dev pair **`rindle init`** (scaffold `rindle.ncl`) and **`rindle up`**
|
|
12
|
+
(render it and run-and-supervise the local write-master + follower pair, respawning on crash or
|
|
13
|
+
migrate-restart).
|
|
14
|
+
- **`rindle-dev-edge`** — the development-only stable HTTP/WebSocket fleet endpoint. `rindle up`
|
|
15
|
+
supervises it automatically; applications never install or launch it directly.
|
|
12
16
|
|
|
13
17
|
This is the network counterpart of [`@rindle/replica`](../replica): both run the same
|
|
14
18
|
`rindle-replica` engine, but `@rindle/replica` is a napi addon that embeds it **in-process**,
|
|
15
|
-
whereas `rindled` is the
|
|
16
|
-
Talk to a running daemon from JS with [`@rindle/daemon-client`](../daemon-client).
|
|
19
|
+
whereas `rindled` is the daemon **executable** (a read-follower) that serves many clients over
|
|
20
|
+
the wire. Talk to a running daemon from JS with [`@rindle/daemon-client`](../daemon-client).
|
|
17
21
|
|
|
18
22
|
```sh
|
|
19
23
|
npm i -D @rindle/cli
|
|
20
|
-
npx rindle init # scaffold
|
|
24
|
+
npx rindle init # scaffold rindle.ncl (the colocated pair) + migrations/
|
|
21
25
|
npx rindle up --migrate --gen shared/schema.gen.ts --watch
|
|
22
|
-
#
|
|
23
|
-
# and re-run apply/gen whenever migrations/ changes
|
|
26
|
+
# render rindle.ncl + supervise the write-master + follower, apply migrations to the master,
|
|
27
|
+
# regenerate the typed schema from the follower, and re-run apply/gen whenever migrations/ changes
|
|
28
|
+
npx rindle exec -- vite dev
|
|
29
|
+
# launch the app with stable read/write/ws bindings derived from rindle.ncl
|
|
24
30
|
```
|
|
25
31
|
|
|
26
32
|
Installing pulls in exactly one prebuilt-binary package for your platform via
|
|
@@ -36,14 +42,14 @@ Full docs — the command reference, flags & env vars, the local dev loop, and r
|
|
|
36
42
|
|
|
37
43
|
## Embedding the daemon in your own supervisor
|
|
38
44
|
|
|
39
|
-
`rindled` is **not** exposed as a CLI command here — `rindle up` is the way to run
|
|
40
|
-
The binary still ships (co-located with `rindle`), so for embedding
|
|
41
|
-
there are programmatic helpers:
|
|
45
|
+
`rindled` is **not** exposed as a CLI command here — `rindle up` is the way to run the local pair.
|
|
46
|
+
The binary still ships (co-located with `rindle`), so for embedding a follower in your own Node
|
|
47
|
+
supervisor there are programmatic helpers:
|
|
42
48
|
|
|
43
49
|
```ts
|
|
44
50
|
import { spawnRindled, rindledBinaryPath } from "@rindle/cli";
|
|
45
51
|
|
|
46
|
-
const child = spawnRindled(["--config", "./
|
|
52
|
+
const child = spawnRindled(["--config", "./follower.json"]); // inherits stdio
|
|
47
53
|
// …or just locate the binary and manage the process yourself:
|
|
48
54
|
const bin = rindledBinaryPath();
|
|
49
55
|
```
|
|
@@ -57,29 +63,29 @@ const bin = rindledBinaryPath();
|
|
|
57
63
|
(`dist/cli.js`) resolves the matching `rindle` binary for the host and execs it, forwarding
|
|
58
64
|
argv/stdio and the exit code.
|
|
59
65
|
- **`@rindle/cli-<key>`** — one package per target (`darwin-arm64`, `darwin-x64`, `linux-x64-gnu`,
|
|
60
|
-
`linux-arm64-gnu`, `linux-x64-musl`, `linux-arm64-musl`, `win32-x64-msvc`), each carrying
|
|
61
|
-
`rindle` and `
|
|
66
|
+
`linux-arm64-gnu`, `linux-x64-musl`, `linux-arm64-musl`, `win32-x64-msvc`), each carrying
|
|
67
|
+
`rindle`, `rindled`, `rindle-replicator`, and `rindle-dev-edge` for that platform under `bin/`,
|
|
62
68
|
gated by `os`/`cpu`/`libc`. They're listed as `optionalDependencies` of this package, so the
|
|
63
69
|
installer fetches only the matching one. They are **generated at release time** (like the napi
|
|
64
70
|
platform packages for `@rindle/replica`), never committed.
|
|
65
71
|
|
|
66
|
-
|
|
67
|
-
`
|
|
68
|
-
the same `bin/` directory.
|
|
72
|
+
All four binaries ship **co-located** on purpose: even though only `rindle` is an npm bin,
|
|
73
|
+
`rindle up` finds every supervised component beside its own executable.
|
|
69
74
|
|
|
70
75
|
Resolution order at runtime (`src/index.ts`):
|
|
71
76
|
|
|
72
|
-
1.
|
|
73
|
-
|
|
77
|
+
1. The binary-specific `*_BINARY_PATH` override (`RINDLE_BINARY_PATH`, `RINDLED_BINARY_PATH`,
|
|
78
|
+
`RINDLE_REPLICATOR_BINARY_PATH`, or `RINDLE_DEV_EDGE_BINARY_PATH`).
|
|
79
|
+
2. `RINDLE_BIN_DIR` — a directory holding the native toolchain (see dev usage below).
|
|
74
80
|
3. the installed `@rindle/cli-<key>` optional dependency.
|
|
75
81
|
|
|
76
82
|
## Local development (in this monorepo)
|
|
77
83
|
|
|
78
84
|
No platform packages are installed in the workspace, so build the binaries and point the launcher at
|
|
79
|
-
the build directory — one env var lights up
|
|
85
|
+
the build directory — one env var lights up the whole fleet:
|
|
80
86
|
|
|
81
87
|
```sh
|
|
82
|
-
cargo build -p rindle-cli -p rindle-server
|
|
88
|
+
cargo build -p rindle-cli -p rindle-server -p rindle-replicator -p rindle-dev-edge --bins --release
|
|
83
89
|
RINDLE_BIN_DIR="$PWD/target/release" npx rindle up # finds rindled in the same dir
|
|
84
90
|
RINDLE_BIN_DIR="$PWD/target/release" npx rindle status
|
|
85
91
|
```
|
|
@@ -89,9 +95,8 @@ RINDLE_BIN_DIR="$PWD/target/release" npx rindle status
|
|
|
89
95
|
|
|
90
96
|
## Releasing
|
|
91
97
|
|
|
92
|
-
The native binaries
|
|
93
|
-
|
|
94
|
-
and uploads the archives + `dist-manifest.json` to a GitHub release.
|
|
98
|
+
The native binaries come from dist (cargo-dist): all four binary crates opt into dist, which uploads
|
|
99
|
+
their archives plus `dist-manifest.json` to a GitHub release.
|
|
95
100
|
`scripts/build-npm-packages.mjs` is the bridge from those artifacts to npm:
|
|
96
101
|
|
|
97
102
|
```sh
|
package/dist/index.d.ts
CHANGED
|
@@ -3,13 +3,12 @@ import { type Binary } from "./platform.ts";
|
|
|
3
3
|
export { binaryName, platformKey, platformPackageName, UnsupportedPlatformError, } from "./platform.ts";
|
|
4
4
|
export type { Binary, Libc } from "./platform.ts";
|
|
5
5
|
/**
|
|
6
|
-
* Absolute path to a Rindle binary
|
|
6
|
+
* Absolute path to a native Rindle toolchain binary for the current platform.
|
|
7
7
|
*
|
|
8
|
-
* Resolution order
|
|
9
|
-
* 1.
|
|
10
|
-
* 2. `RINDLE_BIN_DIR` — a directory holding
|
|
11
|
-
* `
|
|
12
|
-
* (and keeps them co-located, so `rindle up` still finds `rindled` as a sibling).
|
|
8
|
+
* Resolution order:
|
|
9
|
+
* 1. The binary's explicit `*_BINARY_PATH` override.
|
|
10
|
+
* 2. `RINDLE_BIN_DIR` — a directory holding the co-located toolchain. Point it at
|
|
11
|
+
* `target/release` after building the four binary crates and one env var lights up the fleet.
|
|
13
12
|
* 3. The matching `@rindle/cli-<key>` optional dependency that npm/pnpm installed.
|
|
14
13
|
*
|
|
15
14
|
* Throws `UnsupportedPlatformError` for an un-targeted host, or a descriptive Error if the
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAS,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAKjF,OAAO,EAKL,KAAK,MAAM,EACZ,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAIlD;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAoC9C;AAED,iGAAiG;AACjG,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,qGAAqG;AACrG,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,uGAAuG;AACvG,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,EAAO,EAAE,OAAO,GAAE,YAAiB,GAAG,YAAY,CAEtG;AAED,mEAAmE;AACnE,wBAAgB,WAAW,CAAC,IAAI,GAAE,MAAM,EAAO,EAAE,OAAO,GAAE,YAAiB,GAAG,YAAY,CAEzF;AAED,8GAA8G;AAC9G,wBAAgB,YAAY,CAAC,IAAI,GAAE,MAAM,EAAO,EAAE,OAAO,GAAE,YAAiB,GAAG,YAAY,CAE1F"}
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
// @rindle/cli — the Rindle
|
|
1
|
+
// @rindle/cli — the Rindle CLI and supervised local-fleet components as prebuilt npm binaries.
|
|
2
2
|
//
|
|
3
3
|
// `rindled` is the *network front* of the engine: the `rindle-server` crate — the SQLite-backed
|
|
4
4
|
// `rindle-replica` live-query engine plus the public subscription/lease plane. `rindle` is the CLI
|
|
5
5
|
// that inspects and manages a deployed daemon (`rindle status`/`migrate`/…) and, for local dev,
|
|
6
6
|
// scaffolds and supervises one (`rindle init` / `rindle up`). Where `@rindle/replica` is a napi
|
|
7
7
|
// addon that embeds the engine *in-process*, this package ships the standalone executables,
|
|
8
|
-
// prebuilt per platform by dist (cargo-dist), **co-located** so `rindle up` finds
|
|
9
|
-
// it. This module resolves the right binary for the host; the `rindle` bin (dist/cli.js)
|
|
10
|
-
// CLI, and the daemon runs via `rindle up` or `spawnRindled()` (it is not exposed as its
|
|
11
|
-
// this package is a dev convenience). Pair with `@rindle/daemon-client` to talk to a
|
|
8
|
+
// prebuilt per platform by dist (cargo-dist), **co-located** so `rindle up` finds every component
|
|
9
|
+
// beside it. This module resolves the right binary for the host; the `rindle` bin (dist/cli.js)
|
|
10
|
+
// execs the CLI, and the daemon runs via `rindle up` or `spawnRindled()` (it is not exposed as its
|
|
11
|
+
// own bin — this package is a dev convenience). Pair with `@rindle/daemon-client` to talk to a
|
|
12
|
+
// running daemon.
|
|
12
13
|
import { spawn } from "node:child_process";
|
|
13
14
|
import { existsSync } from "node:fs";
|
|
14
15
|
import { createRequire } from "node:module";
|
|
@@ -17,13 +18,12 @@ import { binaryName, platformKey, platformPackageName, UnsupportedPlatformError,
|
|
|
17
18
|
export { binaryName, platformKey, platformPackageName, UnsupportedPlatformError, } from "./platform.js";
|
|
18
19
|
const require = createRequire(import.meta.url);
|
|
19
20
|
/**
|
|
20
|
-
* Absolute path to a Rindle binary
|
|
21
|
+
* Absolute path to a native Rindle toolchain binary for the current platform.
|
|
21
22
|
*
|
|
22
|
-
* Resolution order
|
|
23
|
-
* 1.
|
|
24
|
-
* 2. `RINDLE_BIN_DIR` — a directory holding
|
|
25
|
-
* `
|
|
26
|
-
* (and keeps them co-located, so `rindle up` still finds `rindled` as a sibling).
|
|
23
|
+
* Resolution order:
|
|
24
|
+
* 1. The binary's explicit `*_BINARY_PATH` override.
|
|
25
|
+
* 2. `RINDLE_BIN_DIR` — a directory holding the co-located toolchain. Point it at
|
|
26
|
+
* `target/release` after building the four binary crates and one env var lights up the fleet.
|
|
27
27
|
* 3. The matching `@rindle/cli-<key>` optional dependency that npm/pnpm installed.
|
|
28
28
|
*
|
|
29
29
|
* Throws `UnsupportedPlatformError` for an un-targeted host, or a descriptive Error if the
|
|
@@ -31,10 +31,16 @@ const require = createRequire(import.meta.url);
|
|
|
31
31
|
* publish didn't target) and no override is set.
|
|
32
32
|
*/
|
|
33
33
|
export function binaryPath(bin) {
|
|
34
|
-
const
|
|
34
|
+
const explicitName = {
|
|
35
|
+
rindle: "RINDLE_BINARY_PATH",
|
|
36
|
+
rindled: "RINDLED_BINARY_PATH",
|
|
37
|
+
"rindle-replicator": "RINDLE_REPLICATOR_BINARY_PATH",
|
|
38
|
+
"rindle-dev-edge": "RINDLE_DEV_EDGE_BINARY_PATH",
|
|
39
|
+
};
|
|
40
|
+
const explicit = process.env[explicitName[bin]];
|
|
35
41
|
if (explicit) {
|
|
36
42
|
if (!existsSync(explicit)) {
|
|
37
|
-
throw new Error(`${bin
|
|
43
|
+
throw new Error(`${explicitName[bin]} points at a missing file: ${explicit}`);
|
|
38
44
|
}
|
|
39
45
|
return explicit;
|
|
40
46
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/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,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC;AAED,8GAA8G;AAC9G,MAAM,UAAU,YAAY,CAAC,OAAiB,EAAE,EAAE,UAAwB,EAAE;IAC1E,OAAO,WAAW,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAC/C,CAAC"}
|
package/dist/platform.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type Libc = "gnu" | "musl";
|
|
2
|
-
/** A
|
|
3
|
-
export type Binary = "rindle" | "rindled";
|
|
2
|
+
/** A native binary shipped by the Rindle development toolchain. */
|
|
3
|
+
export type Binary = "rindle" | "rindled" | "rindle-replicator" | "rindle-dev-edge";
|
|
4
4
|
/**
|
|
5
5
|
* The package-name suffix identifying a build target for the current (or given) host:
|
|
6
6
|
* `darwin-{arm64,x64}`, `linux-{x64,arm64}-{gnu,musl}`, `win32-x64-msvc`. Throws
|
package/dist/platform.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,IAAI,GAAG,KAAK,GAAG,MAAM,CAAC;AAElC,mEAAmE;AACnE,MAAM,MAAM,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,mBAAmB,GAAG,iBAAiB,CAAC;AAEpF;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,QAAQ,GAAE,MAAM,CAAC,QAA2B,EAC5C,IAAI,GAAE,MAAqB,EAC3B,IAAI,GAAE,IAA2B,GAChC,MAAM,CAcR;AAED,8FAA8F;AAC9F,wBAAgB,mBAAmB,CAAC,GAAG,GAAE,MAAsB,GAAG,MAAM,CAEvE;AAED,0FAA0F;AAC1F,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAAG,MAAM,CAE5F;AAED,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAY3C"}
|
package/dist/platform.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
// Single source of truth for mapping the *running* Node platform to the per-platform package that
|
|
2
|
-
// carries the prebuilt Rindle binaries (`rindle
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
2
|
+
// carries the prebuilt Rindle binaries (`rindle`, `rindled`, `rindle-replicator`, and the local
|
|
3
|
+
// `rindle-dev-edge`) for it. Those
|
|
4
|
+
// packages (`@rindle/cli-<key>`) are generated at release time by `scripts/build-npm-packages.mjs`
|
|
5
|
+
// from dist's (cargo-dist) release archives, and declared as optionalDependencies of this umbrella
|
|
6
|
+
// package — so npm/pnpm install only the one whose `os`/`cpu` match the host. All binaries ship
|
|
6
7
|
// **co-located** in that one package's `bin/`, which is required: the `rindle` CLI's `rindle up`
|
|
7
|
-
// finds
|
|
8
|
-
// generator MUST agree on the `<key>`
|
|
8
|
+
// finds every component as a sibling of its own executable (rindle-cli §7.1) so it can supervise
|
|
9
|
+
// the local topology. This module and the generator MUST agree on the `<key>`
|
|
10
|
+
// scheme; it is defined here and mirrored in the generator.
|
|
9
11
|
/**
|
|
10
12
|
* The package-name suffix identifying a build target for the current (or given) host:
|
|
11
13
|
* `darwin-{arm64,x64}`, `linux-{x64,arm64}-{gnu,musl}`, `win32-x64-msvc`. Throws
|
|
@@ -17,8 +19,11 @@ export function platformKey(platform = process.platform, arch = process.arch, li
|
|
|
17
19
|
return `darwin-${arch}`;
|
|
18
20
|
case "linux":
|
|
19
21
|
return `linux-${arch}-${libc}`;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
// `win32` is deliberately absent, and must stay in step with `"rindle".targets` in
|
|
23
|
+
// package.json: we publish no Windows binaries, so returning a key here would only trade this
|
|
24
|
+
// actionable error for a MODULE_NOT_FOUND on a package that was never published. Restoring
|
|
25
|
+
// Windows means re-adding the target there AND a `case "win32"` here — see
|
|
26
|
+
// follow-ups/windows-hctree.md.
|
|
22
27
|
default:
|
|
23
28
|
throw new UnsupportedPlatformError(platform, arch);
|
|
24
29
|
}
|
|
@@ -33,7 +38,13 @@ export function binaryName(bin, platform = process.platform) {
|
|
|
33
38
|
}
|
|
34
39
|
export class UnsupportedPlatformError extends Error {
|
|
35
40
|
constructor(platform, arch) {
|
|
36
|
-
super(`@rindle/cli ships no prebuilt Rindle binaries for ${platform}-${arch}`
|
|
41
|
+
super(`@rindle/cli ships no prebuilt Rindle binaries for ${platform}-${arch}` +
|
|
42
|
+
(platform === "win32"
|
|
43
|
+
? ". Rindle's storage engine is Linux-only, so there is no native Windows build. Run the " +
|
|
44
|
+
"toolchain under WSL2 and keep the database on the WSL filesystem (~/), NOT under " +
|
|
45
|
+
"/mnt/c — the Windows drive mount cannot back a memory-mapped database. Your app and " +
|
|
46
|
+
"browser can stay on Windows: WSL2 forwards localhost."
|
|
47
|
+
: ""));
|
|
37
48
|
this.name = "UnsupportedPlatformError";
|
|
38
49
|
}
|
|
39
50
|
}
|
package/dist/platform.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,gGAAgG;AAChG,mCAAmC;AACnC,mGAAmG;AACnG,mGAAmG;AACnG,gGAAgG;AAChG,iGAAiG;AACjG,iGAAiG;AACjG,8EAA8E;AAC9E,4DAA4D;AAO5D;;;;GAIG;AACH,MAAM,UAAU,WAAW,CACzB,WAA4B,OAAO,CAAC,QAAQ,EAC5C,OAAe,OAAO,CAAC,IAAI,EAC3B,OAAa,UAAU,CAAC,QAAQ,CAAC;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C,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;IAC9D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rindle/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"directory": "packages/cli"
|
|
9
9
|
},
|
|
10
10
|
"type": "module",
|
|
11
|
-
"description": "The Rindle toolchain for JS devs:
|
|
11
|
+
"description": "The Rindle toolchain for JS devs: prebuilt CLI, write-master, follower, and local fleet-edge binaries. `rindle up` supervises the fleet and `rindle exec` injects topology-derived app bindings.",
|
|
12
12
|
"main": "./dist/index.js",
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
14
|
"sideEffects": false,
|
|
@@ -39,7 +39,9 @@
|
|
|
39
39
|
"rindle": {
|
|
40
40
|
"binaries": [
|
|
41
41
|
"rindle",
|
|
42
|
-
"rindled"
|
|
42
|
+
"rindled",
|
|
43
|
+
"rindle-replicator",
|
|
44
|
+
"rindle-dev-edge"
|
|
43
45
|
],
|
|
44
46
|
"repository": "rindle-sh/rindle",
|
|
45
47
|
"targets": [
|
|
@@ -76,11 +78,6 @@
|
|
|
76
78
|
"os": "linux",
|
|
77
79
|
"cpu": "arm64",
|
|
78
80
|
"libc": "musl"
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
"rust": "x86_64-pc-windows-msvc",
|
|
82
|
-
"os": "win32",
|
|
83
|
-
"cpu": "x64"
|
|
84
81
|
}
|
|
85
82
|
]
|
|
86
83
|
},
|
|
@@ -89,12 +86,11 @@
|
|
|
89
86
|
"typescript": "^5.7.0"
|
|
90
87
|
},
|
|
91
88
|
"optionalDependencies": {
|
|
92
|
-
"@rindle/cli-darwin-arm64": "0.
|
|
93
|
-
"@rindle/cli-darwin-x64": "0.
|
|
94
|
-
"@rindle/cli-linux-arm64-gnu": "0.
|
|
95
|
-
"@rindle/cli-linux-arm64-musl": "0.
|
|
96
|
-
"@rindle/cli-linux-x64-gnu": "0.
|
|
97
|
-
"@rindle/cli-linux-x64-musl": "0.
|
|
98
|
-
"@rindle/cli-win32-x64-msvc": "0.4.4"
|
|
89
|
+
"@rindle/cli-darwin-arm64": "0.6.2",
|
|
90
|
+
"@rindle/cli-darwin-x64": "0.6.2",
|
|
91
|
+
"@rindle/cli-linux-arm64-gnu": "0.6.2",
|
|
92
|
+
"@rindle/cli-linux-arm64-musl": "0.6.2",
|
|
93
|
+
"@rindle/cli-linux-x64-gnu": "0.6.2",
|
|
94
|
+
"@rindle/cli-linux-x64-musl": "0.6.2"
|
|
99
95
|
}
|
|
100
96
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
// @rindle/cli — the Rindle
|
|
1
|
+
// @rindle/cli — the Rindle CLI and supervised local-fleet components as prebuilt npm binaries.
|
|
2
2
|
//
|
|
3
3
|
// `rindled` is the *network front* of the engine: the `rindle-server` crate — the SQLite-backed
|
|
4
4
|
// `rindle-replica` live-query engine plus the public subscription/lease plane. `rindle` is the CLI
|
|
5
5
|
// that inspects and manages a deployed daemon (`rindle status`/`migrate`/…) and, for local dev,
|
|
6
6
|
// scaffolds and supervises one (`rindle init` / `rindle up`). Where `@rindle/replica` is a napi
|
|
7
7
|
// addon that embeds the engine *in-process*, this package ships the standalone executables,
|
|
8
|
-
// prebuilt per platform by dist (cargo-dist), **co-located** so `rindle up` finds
|
|
9
|
-
// it. This module resolves the right binary for the host; the `rindle` bin (dist/cli.js)
|
|
10
|
-
// CLI, and the daemon runs via `rindle up` or `spawnRindled()` (it is not exposed as its
|
|
11
|
-
// this package is a dev convenience). Pair with `@rindle/daemon-client` to talk to a
|
|
8
|
+
// prebuilt per platform by dist (cargo-dist), **co-located** so `rindle up` finds every component
|
|
9
|
+
// beside it. This module resolves the right binary for the host; the `rindle` bin (dist/cli.js)
|
|
10
|
+
// execs the CLI, and the daemon runs via `rindle up` or `spawnRindled()` (it is not exposed as its
|
|
11
|
+
// own bin — this package is a dev convenience). Pair with `@rindle/daemon-client` to talk to a
|
|
12
|
+
// running daemon.
|
|
12
13
|
import { spawn, type ChildProcess, type SpawnOptions } from "node:child_process";
|
|
13
14
|
import { existsSync } from "node:fs";
|
|
14
15
|
import { createRequire } from "node:module";
|
|
@@ -33,13 +34,12 @@ export type { Binary, Libc } from "./platform.ts";
|
|
|
33
34
|
const require = createRequire(import.meta.url);
|
|
34
35
|
|
|
35
36
|
/**
|
|
36
|
-
* Absolute path to a Rindle binary
|
|
37
|
+
* Absolute path to a native Rindle toolchain binary for the current platform.
|
|
37
38
|
*
|
|
38
|
-
* Resolution order
|
|
39
|
-
* 1.
|
|
40
|
-
* 2. `RINDLE_BIN_DIR` — a directory holding
|
|
41
|
-
* `
|
|
42
|
-
* (and keeps them co-located, so `rindle up` still finds `rindled` as a sibling).
|
|
39
|
+
* Resolution order:
|
|
40
|
+
* 1. The binary's explicit `*_BINARY_PATH` override.
|
|
41
|
+
* 2. `RINDLE_BIN_DIR` — a directory holding the co-located toolchain. Point it at
|
|
42
|
+
* `target/release` after building the four binary crates and one env var lights up the fleet.
|
|
43
43
|
* 3. The matching `@rindle/cli-<key>` optional dependency that npm/pnpm installed.
|
|
44
44
|
*
|
|
45
45
|
* Throws `UnsupportedPlatformError` for an un-targeted host, or a descriptive Error if the
|
|
@@ -47,10 +47,16 @@ const require = createRequire(import.meta.url);
|
|
|
47
47
|
* publish didn't target) and no override is set.
|
|
48
48
|
*/
|
|
49
49
|
export function binaryPath(bin: Binary): string {
|
|
50
|
-
const
|
|
50
|
+
const explicitName: Record<Binary, string> = {
|
|
51
|
+
rindle: "RINDLE_BINARY_PATH",
|
|
52
|
+
rindled: "RINDLED_BINARY_PATH",
|
|
53
|
+
"rindle-replicator": "RINDLE_REPLICATOR_BINARY_PATH",
|
|
54
|
+
"rindle-dev-edge": "RINDLE_DEV_EDGE_BINARY_PATH",
|
|
55
|
+
};
|
|
56
|
+
const explicit = process.env[explicitName[bin]];
|
|
51
57
|
if (explicit) {
|
|
52
58
|
if (!existsSync(explicit)) {
|
|
53
|
-
throw new Error(`${bin
|
|
59
|
+
throw new Error(`${explicitName[bin]} points at a missing file: ${explicit}`);
|
|
54
60
|
}
|
|
55
61
|
return explicit;
|
|
56
62
|
}
|
package/src/platform.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
// Single source of truth for mapping the *running* Node platform to the per-platform package that
|
|
2
|
-
// carries the prebuilt Rindle binaries (`rindle
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
2
|
+
// carries the prebuilt Rindle binaries (`rindle`, `rindled`, `rindle-replicator`, and the local
|
|
3
|
+
// `rindle-dev-edge`) for it. Those
|
|
4
|
+
// packages (`@rindle/cli-<key>`) are generated at release time by `scripts/build-npm-packages.mjs`
|
|
5
|
+
// from dist's (cargo-dist) release archives, and declared as optionalDependencies of this umbrella
|
|
6
|
+
// package — so npm/pnpm install only the one whose `os`/`cpu` match the host. All binaries ship
|
|
6
7
|
// **co-located** in that one package's `bin/`, which is required: the `rindle` CLI's `rindle up`
|
|
7
|
-
// finds
|
|
8
|
-
// generator MUST agree on the `<key>`
|
|
8
|
+
// finds every component as a sibling of its own executable (rindle-cli §7.1) so it can supervise
|
|
9
|
+
// the local topology. This module and the generator MUST agree on the `<key>`
|
|
10
|
+
// scheme; it is defined here and mirrored in the generator.
|
|
9
11
|
|
|
10
12
|
export type Libc = "gnu" | "musl";
|
|
11
13
|
|
|
12
|
-
/** A
|
|
13
|
-
export type Binary = "rindle" | "rindled";
|
|
14
|
+
/** A native binary shipped by the Rindle development toolchain. */
|
|
15
|
+
export type Binary = "rindle" | "rindled" | "rindle-replicator" | "rindle-dev-edge";
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* The package-name suffix identifying a build target for the current (or given) host:
|
|
@@ -27,8 +29,11 @@ export function platformKey(
|
|
|
27
29
|
return `darwin-${arch}`;
|
|
28
30
|
case "linux":
|
|
29
31
|
return `linux-${arch}-${libc}`;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
// `win32` is deliberately absent, and must stay in step with `"rindle".targets` in
|
|
33
|
+
// package.json: we publish no Windows binaries, so returning a key here would only trade this
|
|
34
|
+
// actionable error for a MODULE_NOT_FOUND on a package that was never published. Restoring
|
|
35
|
+
// Windows means re-adding the target there AND a `case "win32"` here — see
|
|
36
|
+
// follow-ups/windows-hctree.md.
|
|
32
37
|
default:
|
|
33
38
|
throw new UnsupportedPlatformError(platform, arch);
|
|
34
39
|
}
|
|
@@ -46,7 +51,15 @@ export function binaryName(bin: Binary, platform: NodeJS.Platform = process.plat
|
|
|
46
51
|
|
|
47
52
|
export class UnsupportedPlatformError extends Error {
|
|
48
53
|
constructor(platform: string, arch: string) {
|
|
49
|
-
super(
|
|
54
|
+
super(
|
|
55
|
+
`@rindle/cli ships no prebuilt Rindle binaries for ${platform}-${arch}` +
|
|
56
|
+
(platform === "win32"
|
|
57
|
+
? ". Rindle's storage engine is Linux-only, so there is no native Windows build. Run the " +
|
|
58
|
+
"toolchain under WSL2 and keep the database on the WSL filesystem (~/), NOT under " +
|
|
59
|
+
"/mnt/c — the Windows drive mount cannot back a memory-mapped database. Your app and " +
|
|
60
|
+
"browser can stay on Windows: WSL2 forwards localhost."
|
|
61
|
+
: ""),
|
|
62
|
+
);
|
|
50
63
|
this.name = "UnsupportedPlatformError";
|
|
51
64
|
}
|
|
52
65
|
}
|