@spooky-sync/cli 0.0.0-canary.1 → 0.0.1-canary.11

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/dist/cli.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";const n=require("commander"),r=require("./syncgen.cjs"),o=new n.Command;o.name("syncgen").description("Generate types from SurrealDB schema files").version("0.1.0");o.option("-i, --input <path>","Path to the input .surql schema file").option("-o, --output <path>","Path to the output file (extension determines format: .json, .ts, .dart)").option("-f, --format <format>","Output format (json, typescript, dart, surql)").option("-p, --pretty","Pretty print the JSON output (only for JSON format)",!0).option("-a, --all","Generate all formats (TypeScript and Dart) in addition to JSON Schema",!1).option("--no-header","Disable the generated file comment header (enabled by default)",!1).option("--append <path>","Path to another .surql file to append to the input").option("--modules-dir <path>","Directory containing Surrealism modules to compile and bundle").option("--mode <mode>",'Generation mode: "singlenode" (HTTP to single SSP), "cluster" (HTTP to scheduler), or "surrealism" (embedded WASM)',"singlenode").option("--endpoint <url>","SSP/Scheduler Endpoint URL").option("--secret <secret>","SSP/Scheduler Auth Secret").option("--config <path>","Path to spooky.yml configuration file").parse(process.argv);const e=o.opts();async function i(){(!e.input||!e.output)&&(console.error("Error: --input and --output are required"),o.help(),process.exit(1));try{const t=await r.runSyncgen({input:e.input,output:e.output,format:e.format,pretty:e.pretty,all:e.all,noHeader:e.noHeader,append:e.append,modulesDir:e.modulesDir,mode:e.mode,endpoint:e.endpoint,secret:e.secret,config:e.config});console.log(t)}catch(t){console.error("Error:",t instanceof Error?t.message:String(t)),process.exit(1)}}i();
2
+ "use strict";const r=require("child_process"),s=require("./resolve-binary-CFmJcXEj.cjs"),o=s.findBinary(),e=r.spawnSync(o,process.argv.slice(2),{stdio:"inherit"});e.error&&(console.error(`Failed to execute spooky: ${e.error.message}`),process.exit(1));process.exit(e.status??1);
package/dist/cli.js CHANGED
@@ -1,41 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { Command as n } from "commander";
3
- import { runSyncgen as r } from "./syncgen.js";
4
- const o = new n();
5
- o.name("syncgen").description("Generate types from SurrealDB schema files").version("0.1.0");
6
- o.option("-i, --input <path>", "Path to the input .surql schema file").option(
7
- "-o, --output <path>",
8
- "Path to the output file (extension determines format: .json, .ts, .dart)"
9
- ).option("-f, --format <format>", "Output format (json, typescript, dart, surql)").option("-p, --pretty", "Pretty print the JSON output (only for JSON format)", !0).option(
10
- "-a, --all",
11
- "Generate all formats (TypeScript and Dart) in addition to JSON Schema",
12
- !1
13
- ).option("--no-header", "Disable the generated file comment header (enabled by default)", !1).option("--append <path>", "Path to another .surql file to append to the input").option("--modules-dir <path>", "Directory containing Surrealism modules to compile and bundle").option(
14
- "--mode <mode>",
15
- 'Generation mode: "singlenode" (HTTP to single SSP), "cluster" (HTTP to scheduler), or "surrealism" (embedded WASM)',
16
- "singlenode"
17
- ).option("--endpoint <url>", "SSP/Scheduler Endpoint URL").option("--secret <secret>", "SSP/Scheduler Auth Secret").option("--config <path>", "Path to spooky.yml configuration file").parse(process.argv);
18
- const e = o.opts();
19
- async function i() {
20
- (!e.input || !e.output) && (console.error("Error: --input and --output are required"), o.help(), process.exit(1));
21
- try {
22
- const t = await r({
23
- input: e.input,
24
- output: e.output,
25
- format: e.format,
26
- pretty: e.pretty,
27
- all: e.all,
28
- noHeader: e.noHeader,
29
- append: e.append,
30
- modulesDir: e.modulesDir,
31
- mode: e.mode,
32
- endpoint: e.endpoint,
33
- secret: e.secret,
34
- config: e.config
35
- });
36
- console.log(t);
37
- } catch (t) {
38
- console.error("Error:", t instanceof Error ? t.message : String(t)), process.exit(1);
39
- }
40
- }
41
- i();
2
+ import { spawnSync as e } from "child_process";
3
+ import { f as s } from "./resolve-binary-BYotYL89.js";
4
+ const o = s(), r = e(o, process.argv.slice(2), { stdio: "inherit" });
5
+ r.error && (console.error(`Failed to execute spooky: ${r.error.message}`), process.exit(1));
6
+ process.exit(r.status ?? 1);
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;IAClD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA0BD,wBAAsB,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA0DzE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;IAClD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA0DzE"}
@@ -0,0 +1,51 @@
1
+ import { platform as s, arch as l } from "os";
2
+ import { dirname as y, resolve as a } from "path";
3
+ import { existsSync as e } from "fs";
4
+ import { fileURLToPath as k } from "url";
5
+ import { createRequire as d } from "module";
6
+ const x = k(import.meta.url), m = y(x), f = {
7
+ "darwin-arm64": "@spooky-sync/cli-darwin-arm64",
8
+ "darwin-x64": "@spooky-sync/cli-darwin-x64",
9
+ "linux-arm64": "@spooky-sync/cli-linux-arm64",
10
+ "linux-x64": "@spooky-sync/cli-linux-x64",
11
+ "win32-x64": "@spooky-sync/cli-win32-x64"
12
+ };
13
+ function w() {
14
+ const r = `${s()}-${l()}`, o = f[r];
15
+ if (!o) return;
16
+ const n = s() === "win32" ? "spooky.exe" : "spooky";
17
+ try {
18
+ const t = d(import.meta.url).resolve(`${o}/package.json`);
19
+ return a(y(t), n);
20
+ } catch {
21
+ return;
22
+ }
23
+ }
24
+ function _() {
25
+ const r = s() === "win32" ? "spooky.exe" : "spooky", o = w();
26
+ if (o && e(o))
27
+ return o;
28
+ const n = a(m, "../target/release", r);
29
+ if (e(n))
30
+ return n;
31
+ const i = a(m, "..", r);
32
+ if (e(i))
33
+ return i;
34
+ const t = a(process.cwd(), r);
35
+ if (e(t))
36
+ return t;
37
+ const p = `${s()}-${l()}`, c = f[p], u = c ? `
38
+ Try installing the platform package: npm install ${c}` : `
39
+ Your platform (${p}) is not supported.`;
40
+ throw new Error(
41
+ `Could not find spooky binary. Checked paths:
42
+ - Platform package (${c ?? "none"})
43
+ - ${n}
44
+ - ${i}
45
+ - ${t}
46
+ ` + u
47
+ );
48
+ }
49
+ export {
50
+ _ as f
51
+ };
@@ -0,0 +1,8 @@
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;
@@ -0,0 +1,2 @@
1
+ export declare function findBinary(): string;
2
+ //# sourceMappingURL=resolve-binary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-binary.d.ts","sourceRoot":"","sources":["../src/resolve-binary.ts"],"names":[],"mappings":"AAiCA,wBAAgB,UAAU,IAAI,MAAM,CAyCnC"}
package/dist/syncgen.cjs CHANGED
@@ -1,4 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("child_process"),o=require("util"),t=require("path"),d=require("fs"),f=require("os"),l=require("url");var c=typeof document<"u"?document.currentScript:null;const p=o.promisify(a.execFile),h=l.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:c&&c.tagName.toUpperCase()==="SCRIPT"&&c.src||new URL("syncgen.cjs",document.baseURI).href),i=t.dirname(h);function m(){const e=f.platform()==="win32"?"spooky.exe":"spooky",n=[t.resolve(i,"../target/release",e),t.resolve(i,"..",e),t.resolve(process.cwd(),e)];for(const r of n)if(d.existsSync(r))return r;throw new Error(`Could not find syncgen binary. Checked paths:
2
- ${n.map(r=>` - ${r}`).join(`
3
- `)}
4
- Please ensure it is built or installed.`)}async function y(e){const n=m(),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:s,stderr:u}=await p(n,r);return u&&console.error(u),s}catch(s){throw new Error(`Syncgen failed: ${s.message}`)}}exports.runSyncgen=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("child_process"),a=require("util"),i=require("./resolve-binary-CFmJcXEj.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}`)}}exports.runSyncgen=f;
package/dist/syncgen.js CHANGED
@@ -1,39 +1,17 @@
1
- import { execFile as s } from "child_process";
2
- import { promisify as o } from "util";
3
- import { dirname as c, resolve as i } from "path";
4
- import { existsSync as m } from "fs";
5
- import { platform as u } from "os";
6
- import { fileURLToPath as d } from "url";
7
- const p = o(s), l = d(import.meta.url), f = c(l);
8
- function h() {
9
- const e = u() === "win32" ? "spooky.exe" : "spooky", t = [
10
- // Development/Source build location (from dist/index.js -> ../target/release)
11
- i(f, "../target/release", e),
12
- // Distributed package location (relative to dist/index.js -> ../bin)
13
- i(f, "..", e),
14
- // Installation root
15
- i(process.cwd(), e)
16
- ];
17
- for (const r of t)
18
- if (m(r))
19
- return r;
20
- throw new Error(
21
- `Could not find syncgen binary. Checked paths:
22
- ${t.map((r) => ` - ${r}`).join(`
23
- `)}
24
- Please ensure it is built or installed.`
25
- );
26
- }
27
- async function _(e) {
28
- const t = h(), r = [];
1
+ import { execFile as c } from "child_process";
2
+ import { promisify as d } from "util";
3
+ import { f as t } from "./resolve-binary-BYotYL89.js";
4
+ const i = d(c);
5
+ async function p(e) {
6
+ const a = t(), r = [];
29
7
  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);
30
8
  try {
31
- const { stdout: n, stderr: a } = await p(t, r);
32
- return a && console.error(a), n;
33
- } catch (n) {
34
- throw new Error(`Syncgen failed: ${n.message}`);
9
+ const { stdout: f, stderr: u } = await i(a, r);
10
+ return u && console.error(u), f;
11
+ } catch (f) {
12
+ throw new Error(`Syncgen failed: ${f.message}`);
35
13
  }
36
14
  }
37
15
  export {
38
- _ as runSyncgen
16
+ p as runSyncgen
39
17
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spooky-sync/cli",
3
- "version": "0.0.0-canary.1",
3
+ "version": "0.0.1-canary.11",
4
4
  "description": "Generate TypeScript/Dart types from SurrealDB schema files",
5
5
  "type": "module",
6
6
  "main": "./dist/syncgen.cjs",
@@ -17,15 +17,15 @@
17
17
  }
18
18
  },
19
19
  "files": [
20
- "dist",
21
- "target/release/spooky"
20
+ "dist"
22
21
  ],
23
22
  "scripts": {
24
23
  "dev": "vite",
25
24
  "build:rust": "cargo build --release",
26
25
  "build:vite": "vite build",
27
26
  "build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist",
28
- "build": "npm run build:rust && npm run build:vite && npm run build:types",
27
+ "build:js": "npm run build:vite && npm run build:types",
28
+ "build": "npm run build:rust && npm run build:js",
29
29
  "preview": "vite preview",
30
30
  "test": "vitest",
31
31
  "lint": "eslint src",
@@ -48,14 +48,18 @@
48
48
  "publishConfig": {
49
49
  "access": "public"
50
50
  },
51
- "dependencies": {
52
- "commander": "^12.0.0"
53
- },
54
51
  "devDependencies": {
55
52
  "@types/node": "^20.0.0",
56
53
  "typescript": "^5.3.0",
57
54
  "vite": "^5.0.0",
58
55
  "vite-plugin-dts": "^3.7.0",
59
56
  "vitest": "^1.0.0"
57
+ },
58
+ "optionalDependencies": {
59
+ "@spooky-sync/cli-darwin-arm64": "0.0.1-canary.11",
60
+ "@spooky-sync/cli-darwin-x64": "0.0.1-canary.11",
61
+ "@spooky-sync/cli-linux-arm64": "0.0.1-canary.11",
62
+ "@spooky-sync/cli-linux-x64": "0.0.1-canary.11",
63
+ "@spooky-sync/cli-win32-x64": "0.0.1-canary.11"
60
64
  }
61
65
  }
Binary file