@spooky-sync/cli 0.0.1-canary.39 → 0.0.1-canary.43
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 +6 -6
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +2 -2
- package/dist/{resolve-binary-BYotYL89.js → resolve-binary-BMDKUPcG.js} +14 -14
- package/dist/resolve-binary-BiE3UUaE.cjs +8 -0
- package/dist/syncgen.cjs +1 -1
- package/dist/syncgen.js +1 -1
- package/package.json +7 -7
- package/dist/resolve-binary-CFmJcXEj.cjs +0 -8
package/README.md
CHANGED
|
@@ -18,19 +18,19 @@ This package wraps a Rust-based code generator that parses SurrealDB `.surql` sc
|
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
20
|
# Generate TypeScript types
|
|
21
|
-
|
|
21
|
+
spky --input schema.surql --output types.ts
|
|
22
22
|
|
|
23
23
|
# Generate Dart types
|
|
24
|
-
|
|
24
|
+
spky --input schema.surql --output types.dart
|
|
25
25
|
|
|
26
26
|
# Generate JSON Schema
|
|
27
|
-
|
|
27
|
+
spky --input schema.surql --output schema.json
|
|
28
28
|
|
|
29
29
|
# Generate all formats at once
|
|
30
|
-
|
|
30
|
+
spky --input schema.surql --output output --all
|
|
31
31
|
|
|
32
32
|
# Specify format explicitly
|
|
33
|
-
|
|
33
|
+
spky --input schema.surql --output output.ts --format typescript
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
### Programmatic API
|
|
@@ -95,7 +95,7 @@ cli/
|
|
|
95
95
|
|
|
96
96
|
## How It Works
|
|
97
97
|
|
|
98
|
-
1. The Rust binary (`
|
|
98
|
+
1. The Rust binary (`spky`) parses SurrealDB schema files and generates JSON Schema
|
|
99
99
|
2. For TypeScript/Dart output, it uses `quicktype` to convert JSON Schema to the target language
|
|
100
100
|
3. The TypeScript wrapper (`src/index.ts`) spawns the Rust binary as a child process
|
|
101
101
|
4. Vite bundles the TypeScript wrapper for distribution
|
package/dist/cli.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";const r=require("child_process"),s=require("./resolve-binary-
|
|
2
|
+
"use strict";const r=require("child_process"),s=require("./resolve-binary-BiE3UUaE.cjs"),i=s.findBinary(),e=r.spawnSync(i,process.argv.slice(2),{stdio:"inherit"});e.error&&(console.error(`Failed to execute spky: ${e.error.message}`),process.exit(1));process.exit(e.status??1);
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { spawnSync as e } from "child_process";
|
|
3
|
-
import { f as s } from "./resolve-binary-
|
|
3
|
+
import { f as s } from "./resolve-binary-BMDKUPcG.js";
|
|
4
4
|
const o = s(), r = e(o, process.argv.slice(2), { stdio: "inherit" });
|
|
5
|
-
r.error && (console.error(`Failed to execute
|
|
5
|
+
r.error && (console.error(`Failed to execute spky: ${r.error.message}`), process.exit(1));
|
|
6
6
|
process.exit(r.status ?? 1);
|
|
@@ -11,36 +11,36 @@ const x = k(import.meta.url), m = y(x), f = {
|
|
|
11
11
|
"win32-x64": "@spooky-sync/cli-win32-x64"
|
|
12
12
|
};
|
|
13
13
|
function w() {
|
|
14
|
-
const
|
|
15
|
-
if (!
|
|
16
|
-
const
|
|
14
|
+
const n = `${s()}-${l()}`, r = f[n];
|
|
15
|
+
if (!r) return;
|
|
16
|
+
const o = s() === "win32" ? "spky.exe" : "spky";
|
|
17
17
|
try {
|
|
18
|
-
const t = d(import.meta.url).resolve(`${
|
|
19
|
-
return a(y(t),
|
|
18
|
+
const t = d(import.meta.url).resolve(`${r}/package.json`);
|
|
19
|
+
return a(y(t), o);
|
|
20
20
|
} catch {
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
function _() {
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
25
|
+
const n = s() === "win32" ? "spky.exe" : "spky", r = w();
|
|
26
|
+
if (r && e(r))
|
|
27
|
+
return r;
|
|
28
|
+
const o = a(m, "../target/release", n);
|
|
29
|
+
if (e(o))
|
|
27
30
|
return o;
|
|
28
|
-
const
|
|
29
|
-
if (e(n))
|
|
30
|
-
return n;
|
|
31
|
-
const i = a(m, "..", r);
|
|
31
|
+
const i = a(m, "..", n);
|
|
32
32
|
if (e(i))
|
|
33
33
|
return i;
|
|
34
|
-
const t = a(process.cwd(),
|
|
34
|
+
const t = a(process.cwd(), n);
|
|
35
35
|
if (e(t))
|
|
36
36
|
return t;
|
|
37
37
|
const p = `${s()}-${l()}`, c = f[p], u = c ? `
|
|
38
38
|
Try installing the platform package: npm install ${c}` : `
|
|
39
39
|
Your platform (${p}) is not supported.`;
|
|
40
40
|
throw new Error(
|
|
41
|
-
`Could not find
|
|
41
|
+
`Could not find spky binary. Checked paths:
|
|
42
42
|
- Platform package (${c ?? "none"})
|
|
43
|
-
- ${
|
|
43
|
+
- ${o}
|
|
44
44
|
- ${i}
|
|
45
45
|
- ${t}
|
|
46
46
|
` + u
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";const n=require("os"),r=require("path"),c=require("fs"),d=require("url"),m=require("module");var t=typeof document<"u"?document.currentScript:null;const h=d.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:t&&t.tagName.toUpperCase()==="SCRIPT"&&t.src||new URL("resolve-binary-BiE3UUaE.cjs",document.baseURI).href),p=r.dirname(h),y={"darwin-arm64":"@spooky-sync/cli-darwin-arm64","darwin-x64":"@spooky-sync/cli-darwin-x64","linux-arm64":"@spooky-sync/cli-linux-arm64","linux-x64":"@spooky-sync/cli-linux-x64","win32-x64":"@spooky-sync/cli-win32-x64"};function k(){const o=`${n.platform()}-${n.arch()}`,e=y[o];if(!e)return;const s=n.platform()==="win32"?"spky.exe":"spky";try{const i=m.createRequire(typeof document>"u"?require("url").pathToFileURL(__filename).href:t&&t.tagName.toUpperCase()==="SCRIPT"&&t.src||new URL("resolve-binary-BiE3UUaE.cjs",document.baseURI).href).resolve(`${e}/package.json`);return r.resolve(r.dirname(i),s)}catch{return}}function x(){const o=n.platform()==="win32"?"spky.exe":"spky",e=k();if(e&&c.existsSync(e))return e;const s=r.resolve(p,"../target/release",o);if(c.existsSync(s))return s;const a=r.resolve(p,"..",o);if(c.existsSync(a))return a;const i=r.resolve(process.cwd(),o);if(c.existsSync(i))return i;const u=`${n.platform()}-${n.arch()}`,l=y[u],f=l?`
|
|
2
|
+
Try installing the platform package: npm install ${l}`:`
|
|
3
|
+
Your platform (${u}) is not supported.`;throw new Error(`Could not find spky binary. Checked paths:
|
|
4
|
+
- Platform package (${l??"none"})
|
|
5
|
+
- ${s}
|
|
6
|
+
- ${a}
|
|
7
|
+
- ${i}
|
|
8
|
+
`+f)}exports.findBinary=x;
|
package/dist/syncgen.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("child_process"),a=require("util"),i=require("./resolve-binary-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("child_process"),a=require("util"),i=require("./resolve-binary-BiE3UUaE.cjs"),d=a.promisify(t.execFile);async function f(e){const n=i.findBinary(),r=[];r.push("--input",e.input),r.push("--output",e.output),e.format&&r.push("--format",e.format),e.pretty&&r.push("--pretty"),e.all&&r.push("--all"),e.noHeader&&r.push("--no-header"),e.append&&r.push("--append",e.append),e.modulesDir&&r.push("--modules-dir",e.modulesDir),e.mode&&r.push("--mode",e.mode),e.endpoint&&r.push("--endpoint",e.endpoint),e.secret&&r.push("--secret",e.secret),e.config&&r.push("--config",e.config);try{const{stdout:u,stderr:c}=await d(n,r);return c&&console.error(c),u}catch(u){throw new Error(`Syncgen failed: ${u.message}`,{cause:u})}}exports.runSyncgen=f;
|
package/dist/syncgen.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { execFile as c } from "child_process";
|
|
2
2
|
import { promisify as d } from "util";
|
|
3
|
-
import { f as t } from "./resolve-binary-
|
|
3
|
+
import { f as t } from "./resolve-binary-BMDKUPcG.js";
|
|
4
4
|
const i = d(c);
|
|
5
5
|
async function s(e) {
|
|
6
6
|
const a = t(), r = [];
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spooky-sync/cli",
|
|
3
|
-
"version": "0.0.1-canary.
|
|
3
|
+
"version": "0.0.1-canary.43",
|
|
4
4
|
"description": "Generate TypeScript/Dart types from SurrealDB schema files",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/syncgen.cjs",
|
|
7
7
|
"module": "./dist/syncgen.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"bin": {
|
|
10
|
-
"
|
|
10
|
+
"spky": "./dist/cli.js"
|
|
11
11
|
},
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
"vitest": "^1.0.0"
|
|
59
59
|
},
|
|
60
60
|
"optionalDependencies": {
|
|
61
|
-
"@spooky-sync/cli-darwin-arm64": "0.0.1-canary.
|
|
62
|
-
"@spooky-sync/cli-darwin-x64": "0.0.1-canary.
|
|
63
|
-
"@spooky-sync/cli-linux-arm64": "0.0.1-canary.
|
|
64
|
-
"@spooky-sync/cli-linux-x64": "0.0.1-canary.
|
|
65
|
-
"@spooky-sync/cli-win32-x64": "0.0.1-canary.
|
|
61
|
+
"@spooky-sync/cli-darwin-arm64": "0.0.1-canary.43",
|
|
62
|
+
"@spooky-sync/cli-darwin-x64": "0.0.1-canary.43",
|
|
63
|
+
"@spooky-sync/cli-linux-arm64": "0.0.1-canary.43",
|
|
64
|
+
"@spooky-sync/cli-linux-x64": "0.0.1-canary.43",
|
|
65
|
+
"@spooky-sync/cli-win32-x64": "0.0.1-canary.43"
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";const n=require("os"),r=require("path"),c=require("fs"),d=require("url"),m=require("module");var o=typeof document<"u"?document.currentScript:null;const h=d.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:o&&o.tagName.toUpperCase()==="SCRIPT"&&o.src||new URL("resolve-binary-CFmJcXEj.cjs",document.baseURI).href),p=r.dirname(h),y={"darwin-arm64":"@spooky-sync/cli-darwin-arm64","darwin-x64":"@spooky-sync/cli-darwin-x64","linux-arm64":"@spooky-sync/cli-linux-arm64","linux-x64":"@spooky-sync/cli-linux-x64","win32-x64":"@spooky-sync/cli-win32-x64"};function k(){const t=`${n.platform()}-${n.arch()}`,e=y[t];if(!e)return;const s=n.platform()==="win32"?"spooky.exe":"spooky";try{const i=m.createRequire(typeof document>"u"?require("url").pathToFileURL(__filename).href:o&&o.tagName.toUpperCase()==="SCRIPT"&&o.src||new URL("resolve-binary-CFmJcXEj.cjs",document.baseURI).href).resolve(`${e}/package.json`);return r.resolve(r.dirname(i),s)}catch{return}}function x(){const t=n.platform()==="win32"?"spooky.exe":"spooky",e=k();if(e&&c.existsSync(e))return e;const s=r.resolve(p,"../target/release",t);if(c.existsSync(s))return s;const a=r.resolve(p,"..",t);if(c.existsSync(a))return a;const i=r.resolve(process.cwd(),t);if(c.existsSync(i))return i;const u=`${n.platform()}-${n.arch()}`,l=y[u],f=l?`
|
|
2
|
-
Try installing the platform package: npm install ${l}`:`
|
|
3
|
-
Your platform (${u}) is not supported.`;throw new Error(`Could not find spooky binary. Checked paths:
|
|
4
|
-
- Platform package (${l??"none"})
|
|
5
|
-
- ${s}
|
|
6
|
-
- ${a}
|
|
7
|
-
- ${i}
|
|
8
|
-
`+f)}exports.findBinary=x;
|