@hygraph/cli 0.0.12 → 0.0.14
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 +32 -10
- package/dist/cli.js +5550 -4628
- package/dist/define.d.ts +150 -15
- package/dist/define2.js +140 -24
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,6 +30,10 @@ The CLI needs a permanent auth token from your project's settings in Studio:
|
|
|
30
30
|
- a **permanent auth token** **(PAT)**
|
|
31
31
|
- Create one in **Project Settings > Permanent Auth Tokens > Add token**
|
|
32
32
|
- Then enable all management permissions for it
|
|
33
|
+
- Or use **Generate CLI PAT** on the same page. It creates a token with the
|
|
34
|
+
management permissions the CLI needs and no content access. The button
|
|
35
|
+
is not on for every project yet. Ask Hygraph support to turn it on for
|
|
36
|
+
your project.
|
|
33
37
|
- Put the token in the `HYGRAPH_TOKEN` environment variable. The config
|
|
34
38
|
reads it from there, so the token never ends up in a file you commit.
|
|
35
39
|
|
|
@@ -37,23 +41,41 @@ The CLI needs a permanent auth token from your project's settings in Studio:
|
|
|
37
41
|
export HYGRAPH_TOKEN="…"
|
|
38
42
|
```
|
|
39
43
|
|
|
44
|
+
If it is not set and you run `export` in a terminal, `export` asks for
|
|
45
|
+
the token in a hidden prompt. Without a terminal, such as in CI, set the
|
|
46
|
+
variable. `plan`, `apply`, `pull` and `whoami` always need it.
|
|
47
|
+
|
|
40
48
|
## Start from your project
|
|
41
49
|
|
|
42
50
|
`export` writes your project's current schema as a config file:
|
|
43
51
|
|
|
44
52
|
```bash
|
|
45
|
-
npx hygraph export
|
|
53
|
+
npx hygraph export
|
|
46
54
|
```
|
|
47
55
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
`export` reads the project's Management API endpoint, the project and the
|
|
57
|
+
environment from the token, and prints what it found. A flag takes
|
|
58
|
+
precedence over the token:
|
|
59
|
+
|
|
60
|
+
- `--endpoint`: the project's **Management API endpoint**, from **Project
|
|
61
|
+
Settings > Endpoints > Management API**, such as
|
|
62
|
+
`https://management-eu-central-1.hygraph.com/graphql`. Give it when
|
|
63
|
+
`export` says that the token does not name its endpoint, for example for an
|
|
64
|
+
older token or a local stack.
|
|
65
|
+
- `--project`: the **project ID**, from **Project Settings > Project**.
|
|
66
|
+
- `--environment`: the environment to export. Without it and without one in
|
|
67
|
+
the token, `export` exports `master`.
|
|
68
|
+
|
|
69
|
+
In a terminal, `export` asks for each value that no flag or the token gives,
|
|
70
|
+
and shows the default in brackets.
|
|
71
|
+
|
|
72
|
+
`--out` names the file to write. Without it, `export` asks for the file in a
|
|
73
|
+
terminal, with `hygraph.config.ts` as the default. When stdout is not a
|
|
74
|
+
terminal, such as `npx hygraph export > hygraph.config.ts`, it prints the
|
|
75
|
+
config to stdout.
|
|
76
|
+
|
|
77
|
+
After running the `export` command, you can check the exported environment in
|
|
78
|
+
the `hygraph.config.ts` file.
|
|
57
79
|
|
|
58
80
|
Then run the `plan` command. It should show no changes, because the current
|
|
59
81
|
config matches your project:
|