@hygraph/cli 0.0.0 → 0.0.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 CHANGED
@@ -1 +1,25 @@
1
1
  # @hygraph/cli
2
+
3
+ Manage your Hygraph schema as code. You describe the schema you want in
4
+ TypeScript, review what would change, and apply it as one migration.
5
+
6
+ ```bash
7
+ npm i -D @hygraph/cli
8
+ npx hygraph --help
9
+ ```
10
+
11
+ ## Status
12
+
13
+ The commands below are declared but not implemented yet.
14
+
15
+ ```
16
+ hygraph plan show what would change against the target environment
17
+ hygraph apply execute the plan as one migration
18
+ hygraph validate dry-run the migration on the server against real data
19
+ hygraph pull report what changed live relative to your config
20
+ hygraph export write a live environment out as TypeScript
21
+ hygraph whoami show what the current token is and can do
22
+ ```
23
+
24
+ The authoring API is exposed as `@hygraph/cli/define` and is still empty while
25
+ its shape is settled.
package/bin/hygraph.js ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ import { run } from "../dist/cli.js";
3
+
4
+ try {
5
+ await run();
6
+ } catch (error) {
7
+ // Commander has already exited for its own errors. Anything reaching here
8
+ // is a failure the command did not translate for the user.
9
+ console.error(error instanceof Error ? error.message : String(error));
10
+ process.exitCode = 1;
11
+ }
package/dist/cli.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ //#region src/cli.d.ts
2
+ export interface RunResult {
3
+ stdout: string;
4
+ stderr: string;
5
+ exitCode: number;
6
+ }
7
+ /**
8
+ * Parses arguments and captures what would have been written, instead of
9
+ * touching the process. Pure, so it is testable. Async because commands
10
+ * talk to the management API; parseAsync awaits an action that returns a
11
+ * promise, where parse would let it run unobserved.
12
+ */
13
+ export declare function handle(argv: readonly string[]): Promise<RunResult>;
14
+ /** Entry point for the bin. Commander reads process.argv and slices it itself. */
15
+ export declare function run(): Promise<void>;
16
+ //#endregion