@typerighter/rpc-server 0.1.0 → 0.1.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/index.js +15 -5
- package/package.json +2 -2
- package/platform.js +1 -1
package/index.js
CHANGED
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
|
-
import { spawn } from "node:child_process";
|
|
2
|
+
import { execFileSync, spawn } from "node:child_process";
|
|
3
3
|
import { EventEmitter } from "node:events";
|
|
4
4
|
import { binPath } from "./platform.js";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
function resolveBin() {
|
|
7
|
+
const local = binPath();
|
|
8
|
+
if (existsSync(local)) return local;
|
|
9
|
+
|
|
10
|
+
// Fall back to system PATH
|
|
11
|
+
try {
|
|
12
|
+
return execFileSync("which", ["typedown-rpc"], { encoding: "utf-8" }).trim();
|
|
13
|
+
} catch {
|
|
14
|
+
// ignore
|
|
15
|
+
}
|
|
7
16
|
|
|
8
|
-
if (!existsSync(bin)) {
|
|
9
17
|
throw new Error(
|
|
10
|
-
`typedown-rpc binary not found
|
|
11
|
-
`or build manually with "cargo build --release -p typedown-server".`,
|
|
18
|
+
`typedown-rpc binary not found. Run "pnpm install" to download it, ` +
|
|
19
|
+
`install via Nix, or build manually with "cargo build --release -p typedown-server".`,
|
|
12
20
|
);
|
|
13
21
|
}
|
|
14
22
|
|
|
23
|
+
const bin = resolveBin();
|
|
24
|
+
|
|
15
25
|
const DEFAULT_PORT = 4747;
|
|
16
26
|
|
|
17
27
|
export class RpcServer extends EventEmitter {
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@typerighter/rpc-server",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.2",
|
|
5
5
|
"description": "Typedown RPC server binary.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/
|
|
8
|
+
"url": "https://github.com/huydo862003/typerighter.git",
|
|
9
9
|
"directory": "packages/rpc-server"
|
|
10
10
|
},
|
|
11
11
|
"type": "module",
|
package/platform.js
CHANGED
|
@@ -45,7 +45,7 @@ export function artifactName(osArchStr) {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
export function artifactUrl(tag, artifact) {
|
|
48
|
-
return `https://github.com/
|
|
48
|
+
return `https://github.com/huydo862003/typerighter/releases/download/${tag}/${artifact}`;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
export function repoRoot() {
|