docugate 0.1.1 → 0.1.3
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 +45 -10
- package/dist/cli.js +7 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,17 +1,45 @@
|
|
|
1
1
|
# docugate
|
|
2
2
|
|
|
3
3
|
Command-line tools for [DocuGate](https://www.trydocugate.site), which publishes
|
|
4
|
-
documentation straight from the markdown in your GitHub
|
|
4
|
+
documentation straight from the markdown in your GitHub repositories and decides
|
|
5
5
|
who may read it.
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
|
-
|
|
9
|
-
npx docugate check # check the docs the way DocuGate will read them
|
|
10
|
-
npx docugate openapi # prepare an OpenAPI spec for the API reference
|
|
8
|
+
npm i -g docugate
|
|
11
9
|
```
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
```sh
|
|
12
|
+
docugate init # set this repository up for DocuGate
|
|
13
|
+
docugate check # check the docs the way DocuGate will read them
|
|
14
|
+
docugate openapi # prepare an OpenAPI spec for the API reference
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Installing the command once is usually simpler than reaching for a package
|
|
18
|
+
manager in each repository: it needs no `package.json`, so it works just as
|
|
19
|
+
well in a Go, Python or Flutter repository as in a JavaScript one. That matters
|
|
20
|
+
because one DocuGate space can read from several repositories, and they are
|
|
21
|
+
rarely all the same language.
|
|
22
|
+
|
|
23
|
+
If you would rather not install it globally, `npm i -D docugate` adds it to a
|
|
24
|
+
single Node project, which also pins the version for CI; `npx docugate` runs it
|
|
25
|
+
without installing anything. Both work with pnpm, yarn and bun too.
|
|
26
|
+
|
|
27
|
+
Requires Node 18.17 or later. Run every command from the root of your
|
|
28
|
+
repository.
|
|
29
|
+
|
|
30
|
+
## Several repositories in one space
|
|
31
|
+
|
|
32
|
+
A space can merge the docs from a frontend, a backend and a mobile app into one
|
|
33
|
+
set of pages, so a feature that spans all three is documented once instead of
|
|
34
|
+
three times. Repositories are added to a space from its settings on
|
|
35
|
+
[trydocugate.site](https://www.trydocugate.site/dashboard), not from here.
|
|
36
|
+
|
|
37
|
+
What that changes for this package: run `init` and `check` in **each**
|
|
38
|
+
repository that contributes docs. Every one gets its own `docugate.json`, naming
|
|
39
|
+
its own docs folder. `check` reads the repository it is run in, which is why its
|
|
40
|
+
300-page limit is per repository rather than per space.
|
|
41
|
+
|
|
42
|
+
See [Merging repositories](https://www.trydocugate.site/docs/merging-repositories).
|
|
15
43
|
|
|
16
44
|
## `init`
|
|
17
45
|
|
|
@@ -20,7 +48,7 @@ Creates a `docugate.json` and, if your docs folder has no markdown yet, a first
|
|
|
20
48
|
that already has docs.
|
|
21
49
|
|
|
22
50
|
```sh
|
|
23
|
-
|
|
51
|
+
docugate init --dir docs --title "Acme API"
|
|
24
52
|
```
|
|
25
53
|
|
|
26
54
|
Then push, and publish the space from your
|
|
@@ -52,9 +80,14 @@ jobs:
|
|
|
52
80
|
- uses: actions/setup-node@v4
|
|
53
81
|
with:
|
|
54
82
|
node-version: 22
|
|
55
|
-
- run: npx docugate check
|
|
83
|
+
- run: npx docugate@0.1 check
|
|
56
84
|
```
|
|
57
85
|
|
|
86
|
+
Pin the version in CI, as above, or add the package to the repository and run
|
|
87
|
+
it from there. Without a pin, the rules being enforced can change between two
|
|
88
|
+
runs of the same workflow, which turns a green build red with nothing in the
|
|
89
|
+
commit to explain it.
|
|
90
|
+
|
|
58
91
|
## `openapi`
|
|
59
92
|
|
|
60
93
|
Takes the OpenAPI 3 spec your backend already produces and writes the version
|
|
@@ -62,7 +95,7 @@ you want published: only the public paths, without sensitive fields, with keys
|
|
|
62
95
|
in a stable order so it reviews cleanly in a pull request.
|
|
63
96
|
|
|
64
97
|
```sh
|
|
65
|
-
|
|
98
|
+
docugate openapi --from http://localhost:3000/openapi.json \
|
|
66
99
|
--exclude "/internal/**" --redact passwordHash --out openapi.json
|
|
67
100
|
```
|
|
68
101
|
|
|
@@ -102,11 +135,13 @@ soon. See the
|
|
|
102
135
|
|
|
103
136
|
## `docugate.json`
|
|
104
137
|
|
|
138
|
+
One per repository, at its root.
|
|
139
|
+
|
|
105
140
|
| Key | Meaning |
|
|
106
141
|
| --- | --- |
|
|
107
142
|
| `docsDir` | The folder DocuGate reads. Defaults to `docs`. |
|
|
108
143
|
| `title` | The space's title. |
|
|
109
|
-
| `sidebar` | File and folder names in the order the sidebar should show them. |
|
|
144
|
+
| `sidebar` | File and folder names in the order the sidebar should show them. Orders this repository's own pages, not the whole space. |
|
|
110
145
|
| `api.generate` | Defaults for `docugate openapi`. |
|
|
111
146
|
|
|
112
147
|
## Licence
|
package/dist/cli.js
CHANGED
|
@@ -8,7 +8,7 @@ const SITE = 'https://www.trydocugate.site';
|
|
|
8
8
|
const HELP = `docugate: set up and check the docs DocuGate reads from your repository
|
|
9
9
|
|
|
10
10
|
Usage
|
|
11
|
-
|
|
11
|
+
docugate <command> [options]
|
|
12
12
|
|
|
13
13
|
Commands
|
|
14
14
|
init Set up this repository for DocuGate
|
|
@@ -70,7 +70,11 @@ function parse(argv) {
|
|
|
70
70
|
return { command, flags, bools };
|
|
71
71
|
}
|
|
72
72
|
function fail(message) {
|
|
73
|
-
|
|
73
|
+
// Phrased without a command name on purpose: this is the message somebody
|
|
74
|
+
// sees when they are already stuck, and it would be wrong for half of them.
|
|
75
|
+
// `docugate --help` is not a thing you can run if you reached this through
|
|
76
|
+
// npx, and `npx docugate --help` is not one if you installed it.
|
|
77
|
+
console.error(`${red('error')} ${message}\n${dim('See --help for usage.')}`);
|
|
74
78
|
process.exit(2);
|
|
75
79
|
}
|
|
76
80
|
function version() {
|
|
@@ -140,7 +144,7 @@ async function main() {
|
|
|
140
144
|
}
|
|
141
145
|
else {
|
|
142
146
|
console.log(`${red('out of date')} ${output} does not match ${from}.`);
|
|
143
|
-
console.log(dim('Run `
|
|
147
|
+
console.log(dim('Run `docugate openapi` and commit the result.'));
|
|
144
148
|
process.exitCode = 1;
|
|
145
149
|
}
|
|
146
150
|
return;
|
package/package.json
CHANGED