@opendocsdev/cli 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 +661 -0
- package/README.md +300 -0
- package/dist/bin/opendocs.js +712 -0
- package/dist/bin/opendocs.js.map +1 -0
- package/dist/templates/api-reference.mdx +308 -0
- package/dist/templates/components.mdx +286 -0
- package/dist/templates/configuration.mdx +190 -0
- package/dist/templates/docs.json +27 -0
- package/dist/templates/introduction.mdx +25 -0
- package/dist/templates/logo.svg +4 -0
- package/dist/templates/quickstart.mdx +59 -0
- package/dist/templates/writing-content.mdx +236 -0
- package/package.json +92 -0
- package/src/engine/astro.config.ts +75 -0
- package/src/engine/src/components/Analytics.astro +57 -0
- package/src/engine/src/components/ApiPlayground.astro +24 -0
- package/src/engine/src/components/Callout.astro +66 -0
- package/src/engine/src/components/Card.astro +75 -0
- package/src/engine/src/components/CardGroup.astro +29 -0
- package/src/engine/src/components/CodeGroup.astro +231 -0
- package/src/engine/src/components/CopyButton.astro +179 -0
- package/src/engine/src/components/Steps.astro +27 -0
- package/src/engine/src/components/Tab.astro +21 -0
- package/src/engine/src/components/TableOfContents.astro +119 -0
- package/src/engine/src/components/Tabs.astro +135 -0
- package/src/engine/src/components/index.ts +107 -0
- package/src/engine/src/components/react/ApiPlayground/AuthSection.tsx +91 -0
- package/src/engine/src/components/react/ApiPlayground/CodeBlock.tsx +66 -0
- package/src/engine/src/components/react/ApiPlayground/CodeSnippets.tsx +66 -0
- package/src/engine/src/components/react/ApiPlayground/CollapsibleSection.tsx +26 -0
- package/src/engine/src/components/react/ApiPlayground/KeyValueEditor.tsx +58 -0
- package/src/engine/src/components/react/ApiPlayground/ResponseDisplay.tsx +109 -0
- package/src/engine/src/components/react/ApiPlayground/Spinner.tsx +6 -0
- package/src/engine/src/components/react/ApiPlayground/constants.ts +16 -0
- package/src/engine/src/components/react/ApiPlayground/generators.test.ts +130 -0
- package/src/engine/src/components/react/ApiPlayground/generators.ts +75 -0
- package/src/engine/src/components/react/ApiPlayground/index.tsx +490 -0
- package/src/engine/src/components/react/ApiPlayground/types.ts +35 -0
- package/src/engine/src/components/react/Callout.tsx +54 -0
- package/src/engine/src/components/react/Card.tsx +48 -0
- package/src/engine/src/components/react/CardGroup.tsx +24 -0
- package/src/engine/src/components/react/FeedbackWidget.tsx +166 -0
- package/src/engine/src/components/react/GitHubLink.tsx +28 -0
- package/src/engine/src/components/react/NavigationCard.tsx +53 -0
- package/src/engine/src/components/react/PageActions.tsx +124 -0
- package/src/engine/src/components/react/PageFooter.tsx +91 -0
- package/src/engine/src/components/react/SearchModal.tsx +358 -0
- package/src/engine/src/components/react/SearchProvider.tsx +37 -0
- package/src/engine/src/components/react/Sidebar.tsx +369 -0
- package/src/engine/src/components/react/SidebarSearchTrigger.tsx +57 -0
- package/src/engine/src/components/react/Steps.tsx +25 -0
- package/src/engine/src/components/react/ThemeToggle.tsx +72 -0
- package/src/engine/src/components/react/index.ts +14 -0
- package/src/engine/src/env.d.ts +10 -0
- package/src/engine/src/layouts/DocsLayout.astro +357 -0
- package/src/engine/src/lib/__tests__/markdown.test.ts +124 -0
- package/src/engine/src/lib/__tests__/mdx-loader.test.ts +205 -0
- package/src/engine/src/lib/config.ts +79 -0
- package/src/engine/src/lib/markdown.ts +54 -0
- package/src/engine/src/lib/mdx-loader.ts +143 -0
- package/src/engine/src/lib/mdx-utils.ts +72 -0
- package/src/engine/src/lib/remark-opendocs.ts +195 -0
- package/src/engine/src/lib/utils.ts +221 -0
- package/src/engine/src/pages/[...slug].astro +115 -0
- package/src/engine/src/pages/index.astro +71 -0
- package/src/engine/src/scripts/mobile-sidebar.ts +56 -0
- package/src/engine/src/scripts/theme-init.ts +25 -0
- package/src/engine/src/styles/global.css +703 -0
- package/src/engine/tailwind.config.mjs +60 -0
- package/src/engine/tsconfig.json +15 -0
- package/src/templates/api-reference.mdx +308 -0
- package/src/templates/components.mdx +286 -0
- package/src/templates/configuration.mdx +190 -0
- package/src/templates/docs.json +27 -0
- package/src/templates/introduction.mdx +25 -0
- package/src/templates/logo.svg +4 -0
- package/src/templates/quickstart.mdx +59 -0
- package/src/templates/writing-content.mdx +236 -0
package/README.md
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
# opendocs
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/opendocs)
|
|
4
|
+
[](https://github.com/chigala/opendocs/blob/main/LICENSE)
|
|
5
|
+
|
|
6
|
+
Beautiful docs with zero config. An open-source alternative to [Mintlify](https://mintlify.com).
|
|
7
|
+
|
|
8
|
+
Write documentation in MDX, get built-in search, syntax highlighting, theming, and deploy anywhere.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install -g opendocs
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Or use directly with npx:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx opendocs init my-docs
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Commands
|
|
23
|
+
|
|
24
|
+
### `opendocs init [name]`
|
|
25
|
+
|
|
26
|
+
Scaffold a new documentation project.
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
opendocs init my-docs
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Creates a directory with a starter `docs.json`, example MDX pages, and a `public/` folder for static assets.
|
|
33
|
+
|
|
34
|
+
### `opendocs dev`
|
|
35
|
+
|
|
36
|
+
Start a local development server with hot reload.
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
opendocs dev
|
|
40
|
+
opendocs dev --port 3000
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### `opendocs build`
|
|
44
|
+
|
|
45
|
+
Build the documentation site for production. Outputs static HTML to `dist/`.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
opendocs build
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### `opendocs preview`
|
|
52
|
+
|
|
53
|
+
Preview the production build locally.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
opendocs preview
|
|
57
|
+
opendocs preview --port 3000
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### `opendocs deploy`
|
|
61
|
+
|
|
62
|
+
Deploy docs to the hosted platform.
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
opendocs deploy
|
|
66
|
+
opendocs deploy --skip-build # Use existing dist/
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Requires `OPENDOCS_API_KEY` and `OPENDOCS_SITE_ID` environment variables (or configure in `docs.json`).
|
|
70
|
+
|
|
71
|
+
## Configuration
|
|
72
|
+
|
|
73
|
+
All configuration lives in `docs.json` at the project root.
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"name": "My Docs",
|
|
78
|
+
"logo": {
|
|
79
|
+
"light": "/logo.svg",
|
|
80
|
+
"dark": "/logo-dark.svg"
|
|
81
|
+
},
|
|
82
|
+
"favicon": "/favicon.svg",
|
|
83
|
+
"navigation": [
|
|
84
|
+
{
|
|
85
|
+
"group": "Getting Started",
|
|
86
|
+
"pages": ["introduction", "quickstart"]
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"group": "Guides",
|
|
90
|
+
"pages": [
|
|
91
|
+
"components",
|
|
92
|
+
{
|
|
93
|
+
"group": "Advanced",
|
|
94
|
+
"pages": ["custom-components", "theming"]
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
"theme": {
|
|
100
|
+
"primaryColor": "#10b981",
|
|
101
|
+
"accentColor": "#8b5cf6",
|
|
102
|
+
"darkMode": true
|
|
103
|
+
},
|
|
104
|
+
"features": {
|
|
105
|
+
"search": true,
|
|
106
|
+
"feedback": true,
|
|
107
|
+
"analytics": true
|
|
108
|
+
},
|
|
109
|
+
"snippets": ["snippets"],
|
|
110
|
+
"backend": {
|
|
111
|
+
"siteId": "your-site-id",
|
|
112
|
+
"apiUrl": "https://app.opendocs.dev"
|
|
113
|
+
},
|
|
114
|
+
"metadata": {
|
|
115
|
+
"url": "https://docs.example.com",
|
|
116
|
+
"ogImage": "/og-image.png"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Navigation
|
|
122
|
+
|
|
123
|
+
Navigation supports flat pages and nested groups:
|
|
124
|
+
|
|
125
|
+
```json
|
|
126
|
+
{
|
|
127
|
+
"navigation": [
|
|
128
|
+
{
|
|
129
|
+
"group": "Group Name",
|
|
130
|
+
"pages": [
|
|
131
|
+
"page-slug",
|
|
132
|
+
{
|
|
133
|
+
"group": "Nested Group",
|
|
134
|
+
"pages": ["nested/page-one", "nested/page-two"]
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Page slugs map to MDX files relative to the project root (e.g., `"quickstart"` maps to `quickstart.mdx`).
|
|
143
|
+
|
|
144
|
+
### Snippets
|
|
145
|
+
|
|
146
|
+
Reusable MDX content that can be imported across pages:
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
{
|
|
150
|
+
"snippets": ["snippets"]
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Place `.mdx` files in the `snippets/` directory and import them in any page.
|
|
155
|
+
|
|
156
|
+
## Built-in Components
|
|
157
|
+
|
|
158
|
+
All components are available in MDX files without imports.
|
|
159
|
+
|
|
160
|
+
### Callout
|
|
161
|
+
|
|
162
|
+
```mdx
|
|
163
|
+
<Callout type="info" title="Note">
|
|
164
|
+
This is an informational callout.
|
|
165
|
+
</Callout>
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Types: `info`, `warning`, `error`, `tip`
|
|
169
|
+
|
|
170
|
+
### Card
|
|
171
|
+
|
|
172
|
+
```mdx
|
|
173
|
+
<Card title="Getting Started" href="/quickstart">
|
|
174
|
+
Learn how to set up your docs in minutes.
|
|
175
|
+
</Card>
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### CardGroup
|
|
179
|
+
|
|
180
|
+
```mdx
|
|
181
|
+
<CardGroup cols={2}>
|
|
182
|
+
<Card title="First" href="/first">Description</Card>
|
|
183
|
+
<Card title="Second" href="/second">Description</Card>
|
|
184
|
+
</CardGroup>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### CodeGroup
|
|
188
|
+
|
|
189
|
+
Tabbed code blocks for showing the same example in multiple languages:
|
|
190
|
+
|
|
191
|
+
````mdx
|
|
192
|
+
<CodeGroup>
|
|
193
|
+
```bash npm
|
|
194
|
+
npm install opendocs
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
```bash pnpm
|
|
198
|
+
pnpm add opendocs
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
```bash yarn
|
|
202
|
+
yarn add opendocs
|
|
203
|
+
```
|
|
204
|
+
</CodeGroup>
|
|
205
|
+
````
|
|
206
|
+
|
|
207
|
+
### Tabs / Tab
|
|
208
|
+
|
|
209
|
+
```mdx
|
|
210
|
+
<Tabs>
|
|
211
|
+
<Tab title="React">
|
|
212
|
+
React content here.
|
|
213
|
+
</Tab>
|
|
214
|
+
<Tab title="Vue">
|
|
215
|
+
Vue content here.
|
|
216
|
+
</Tab>
|
|
217
|
+
</Tabs>
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Steps
|
|
221
|
+
|
|
222
|
+
```mdx
|
|
223
|
+
<Steps>
|
|
224
|
+
### Install the CLI
|
|
225
|
+
|
|
226
|
+
Run `npm install -g opendocs`.
|
|
227
|
+
|
|
228
|
+
### Create a project
|
|
229
|
+
|
|
230
|
+
Run `opendocs init my-docs`.
|
|
231
|
+
|
|
232
|
+
### Start writing
|
|
233
|
+
|
|
234
|
+
Edit the MDX files in your project.
|
|
235
|
+
</Steps>
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### ApiPlayground
|
|
239
|
+
|
|
240
|
+
Interactive API endpoint explorer:
|
|
241
|
+
|
|
242
|
+
```mdx
|
|
243
|
+
<ApiPlayground
|
|
244
|
+
method="GET"
|
|
245
|
+
endpoint="/api/users"
|
|
246
|
+
description="List all users"
|
|
247
|
+
/>
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Theming
|
|
251
|
+
|
|
252
|
+
Colors are configured in `docs.json` and support both light and dark mode:
|
|
253
|
+
|
|
254
|
+
```json
|
|
255
|
+
{
|
|
256
|
+
"theme": {
|
|
257
|
+
"primaryColor": "#10b981",
|
|
258
|
+
"accentColor": "#8b5cf6",
|
|
259
|
+
"darkMode": true
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
The engine automatically generates light/dark variants from your chosen colors.
|
|
265
|
+
|
|
266
|
+
## Tech Stack
|
|
267
|
+
|
|
268
|
+
- [Astro](https://astro.build/) — Static site generation
|
|
269
|
+
- [Tailwind CSS](https://tailwindcss.com/) — Styling
|
|
270
|
+
- [Shiki](https://shiki.style/) — Syntax highlighting
|
|
271
|
+
- [Pagefind](https://pagefind.app/) — Client-side search
|
|
272
|
+
- [MDX](https://mdxjs.com/) — Markdown with JSX components
|
|
273
|
+
|
|
274
|
+
## Development
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
cd packages/cli
|
|
278
|
+
|
|
279
|
+
# Run tests
|
|
280
|
+
pnpm test
|
|
281
|
+
|
|
282
|
+
# Watch mode
|
|
283
|
+
pnpm test:watch
|
|
284
|
+
|
|
285
|
+
# Type check
|
|
286
|
+
pnpm typecheck
|
|
287
|
+
|
|
288
|
+
# Build
|
|
289
|
+
pnpm build
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
The Astro engine source is at `src/engine/` and is separate from the CLI's tsconfig.
|
|
293
|
+
|
|
294
|
+
## Self-Hosting
|
|
295
|
+
|
|
296
|
+
opendocs also includes a server with analytics, a management dashboard, and edge serving. See the [full repository](https://github.com/chigala/opendocs) for self-hosting instructions.
|
|
297
|
+
|
|
298
|
+
## License
|
|
299
|
+
|
|
300
|
+
[AGPL-3.0](https://github.com/chigala/opendocs/blob/main/LICENSE)
|