linopress-cli 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/README.md +147 -2
- package/bin/linopress.js +3 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +627 -0
- package/dist/config-BsoZ23gK.js +152 -0
- package/dist/config.d.ts +72 -0
- package/dist/config.js +1 -0
- package/dist/index.d.ts +263 -0
- package/dist/index.js +3 -0
- package/dist/linear.d.ts +70 -0
- package/dist/linear.js +1 -0
- package/dist/markdown.d.ts +118 -0
- package/dist/markdown.js +1 -0
- package/dist/model-CJlOLfea.js +185 -0
- package/dist/model-CgSIC_VE.d.ts +42 -0
- package/dist/src-BU0LDvW9.js +593 -0
- package/dist/src-Bm80C3HE.js +170 -0
- package/dist/src-D8wnsQ43.js +226 -0
- package/dist/src-zk0Kzn3v.js +249 -0
- package/dist/target-Cb9cQbDZ.d.ts +48 -0
- package/dist/transforms-BBEyouxz.d.ts +81 -0
- package/dist/typedoc.d.ts +43 -0
- package/dist/typedoc.js +1 -0
- package/package.json +86 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Karol Novljaković
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,148 @@
|
|
|
1
|
-
#
|
|
1
|
+
# linopress-cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Turn TypeScript doc comments into **editions**: an internal API reference synced into Linear
|
|
4
|
+
Documents, and a public reference written as Markdown for your docs site. `@internal` APIs appear
|
|
5
|
+
only in the internal edition.
|
|
6
|
+
|
|
7
|
+
> Linopress is an independent open-source project. It is not made by or affiliated with Linear.
|
|
8
|
+
|
|
9
|
+
- **Nested docs.** Each module becomes a Linear document nested under an index document, in a team
|
|
10
|
+
or a project. `--flat` keeps them side by side with title prefixes instead.
|
|
11
|
+
- **Only what changed.** A manifest remembers which page maps to which document and a hash of what
|
|
12
|
+
was sent, so a push updates only the pages whose content changed.
|
|
13
|
+
- **Working links.** Links between pages point at the Linear documents, images in doc comments are
|
|
14
|
+
uploaded, and every document gets a footer linking its source files.
|
|
15
|
+
- **Plan first.** `plan` shows what a push would change, without writing anything.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
Node 22.18 or later. TypeDoc and its Markdown plugin are peer dependencies, needed when an edition
|
|
20
|
+
reads a `typedoc.json`:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install --save-dev linopress-cli typedoc typedoc-plugin-markdown
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Quick start
|
|
27
|
+
|
|
28
|
+
1. Add a `typedoc.json` for your entry points (see TypeDoc's
|
|
29
|
+
[options](https://typedoc.org/documents/Options.html)), with
|
|
30
|
+
`"plugin": ["typedoc-plugin-markdown"]`.
|
|
31
|
+
2. Describe your editions in `linopress.config.ts` (name it `linopress.config.mts` if your
|
|
32
|
+
`package.json` doesn't set `"type": "module"`):
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { defineConfig } from "linopress-cli/config";
|
|
36
|
+
|
|
37
|
+
export default defineConfig({
|
|
38
|
+
editions: {
|
|
39
|
+
// Everything, including @internal: synced to Linear Documents.
|
|
40
|
+
internal: {
|
|
41
|
+
typedoc: "typedoc.json",
|
|
42
|
+
title: "API (internal)",
|
|
43
|
+
target: "linear",
|
|
44
|
+
team: "<teamId>", // or project: "<projectId>"; layout: "flat" to skip nesting
|
|
45
|
+
},
|
|
46
|
+
// @internal left out: Markdown files for VitePress or any static site generator.
|
|
47
|
+
public: {
|
|
48
|
+
typedoc: "typedoc.json",
|
|
49
|
+
typedocOptions: { excludeInternal: true },
|
|
50
|
+
title: "API",
|
|
51
|
+
target: "markdown",
|
|
52
|
+
out: "docs/api",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
3. Check what would change, then publish. Pushing to Linear reads a personal API key from
|
|
59
|
+
`LINEAR_API_KEY` (create one in Linear under Settings → Account → Security & access):
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npx linopress plan --all
|
|
63
|
+
LINEAR_API_KEY=lin_api_… npx linopress push --all
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
4. Commit `.linopress-manifest.json`. The next push uses it to find the documents it created
|
|
67
|
+
instead of making new ones.
|
|
68
|
+
|
|
69
|
+
## Commands
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
linopress plan [edition | --all] [options] Show what publishing would change (never writes)
|
|
73
|
+
linopress push [edition | --all] [options] Publish to the edition's target (--dry-run to only plan)
|
|
74
|
+
linopress print [edition | --all] [options] Print the Markdown each page would get
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
| Option | Meaning |
|
|
78
|
+
| ------------------------------- | ----------------------------------------------------------------------- |
|
|
79
|
+
| `--typedoc <file>` | TypeDoc options file to run |
|
|
80
|
+
| `--dir <dir>` | Folder of already-generated Markdown |
|
|
81
|
+
| `--team <id>`, `--project <id>` | Linear team or project to hold the docs |
|
|
82
|
+
| `--out <dir>` | Write Markdown files to this folder instead of Linear |
|
|
83
|
+
| `--force` | `push`: replace files in the output folder that Linopress didn't write |
|
|
84
|
+
| `--flat` | Top-level docs with title prefixes instead of nesting under the index |
|
|
85
|
+
| `--title <title>` | Index page title, or the prefix with `--flat` (default "API Reference") |
|
|
86
|
+
| `--manifest <file>` | Sync state file (default `.linopress-manifest.json`) |
|
|
87
|
+
| `--config <file>` | Config file (default `linopress.config.{ts,mts,js,mjs}`) |
|
|
88
|
+
| `--all` | Run for every edition in the config |
|
|
89
|
+
| `--dry-run` | `push`: plan only, change nothing |
|
|
90
|
+
| `--verbose` | `plan`: also list unchanged docs and files |
|
|
91
|
+
|
|
92
|
+
Flags override the edition's config. Without a config file, pass a source and a target directly:
|
|
93
|
+
`linopress push --typedoc typedoc.json --team <teamId>`.
|
|
94
|
+
|
|
95
|
+
## Editions
|
|
96
|
+
|
|
97
|
+
An edition is one view of your API for one audience, published to one target. Editions can share a
|
|
98
|
+
`typedoc.json`: `typedocOptions` is applied over it, so they differ only where they say so.
|
|
99
|
+
|
|
100
|
+
- `{ excludeInternal: true }` drops `@internal` symbols.
|
|
101
|
+
- For an audience of your own, tag symbols with a category (`@category Team only`) and leave it out
|
|
102
|
+
with `typedocOptions: { excludeCategories: ["Team only"] }`. TypeDoc's `excludeTags` only removes
|
|
103
|
+
a tag's text from comments; it doesn't hide the symbol.
|
|
104
|
+
- `{ treatWarningsAsErrors: true }` (or `treatValidationWarningsAsErrors`) makes TypeDoc warnings,
|
|
105
|
+
such as a dangling `{@link}`, fail `plan`, `push` and `print`, so CI catches broken doc comments.
|
|
106
|
+
|
|
107
|
+
The config is checked when loaded: an unknown option, a `team` on a Markdown edition or a missing
|
|
108
|
+
`out` is an error.
|
|
109
|
+
|
|
110
|
+
## Targets
|
|
111
|
+
|
|
112
|
+
**`linear`**: Linear Documents in a team or project.
|
|
113
|
+
|
|
114
|
+
- TypeDoc's `<a id>` anchors are removed and in-page `#` links are unlinked: Linear would show the
|
|
115
|
+
anchors as text, and its heading ids differ from TypeDoc's.
|
|
116
|
+
- Relative links point at the Linear documents. Images and linked files (``)
|
|
117
|
+
are uploaded once, and again only when they change.
|
|
118
|
+
- The footer links each source file at the pushed commit, using the git `origin` remote. Set a
|
|
119
|
+
top-level `repository` (`"acme/billing"` or a full URL) if the remote uses an SSH host alias. Links
|
|
120
|
+
appear only when the commit is on a remote branch, so push from a pushed commit or from CI.
|
|
121
|
+
- Linear's version history records only edits made in Linear, not updates through its API, so
|
|
122
|
+
synced docs show no history there. The git history of the doc comments is the record.
|
|
123
|
+
|
|
124
|
+
**`markdown`**: files in `out`, ready for VitePress or another static site generator.
|
|
125
|
+
|
|
126
|
+
- Pages keep TypeDoc's anchors and `#fragment` links, get their title as an H1, and start with a
|
|
127
|
+
"generated, edit the source" comment. Images are copied to `<out>/_media/`.
|
|
128
|
+
- `push` writes changed files and deletes the files of removed pages. It records what it wrote in
|
|
129
|
+
`<out>/.linopress.json` and never touches anything else, so `out` can also hold your site's config
|
|
130
|
+
and hand-written pages. If a page would overwrite a file it didn't write, `push` stops and names it;
|
|
131
|
+
`--force` replaces it. Each Markdown edition needs its own `out`.
|
|
132
|
+
|
|
133
|
+
## GitHub Action
|
|
134
|
+
|
|
135
|
+
`KarolNov/linopress@v0` runs `plan` on pull requests and `push` on pushes to the default branch,
|
|
136
|
+
writes the output to the job summary, and after a push saves the manifest to a branch with a pull
|
|
137
|
+
request to merge it. See the
|
|
138
|
+
[repository README](https://github.com/KarolNov/linopress#github-action) for the workflow and inputs.
|
|
139
|
+
|
|
140
|
+
## Programmatic use
|
|
141
|
+
|
|
142
|
+
The engine is exported too: `linopress-cli` (sync engine), `linopress-cli/config`,
|
|
143
|
+
`linopress-cli/linear`, `linopress-cli/markdown` and `linopress-cli/typedoc`. These APIs may change
|
|
144
|
+
before 1.0.
|
|
145
|
+
|
|
146
|
+
## License
|
|
147
|
+
|
|
148
|
+
[MIT](https://github.com/KarolNov/linopress/blob/main/LICENSE)
|
package/bin/linopress.js
ADDED
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|