@litodocs/cli 0.6.0 → 0.7.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/README.md CHANGED
@@ -2,25 +2,27 @@
2
2
 
3
3
  Beautiful documentation sites from Markdown. Fast, simple, and open-source.
4
4
 
5
+ [![npm version](https://img.shields.io/npm/v/@litodocs/cli)](https://www.npmjs.com/package/@litodocs/cli)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
7
+
5
8
  > **Note:** This package was previously published as `@devrohit06/superdocs`. It has been renamed to `@litodocs/cli`.
6
9
 
7
10
  ## Features
8
11
 
9
- - **Simple Setup** - Point to your docs folder and go
10
- - 🚀 **Astro-Powered** - Leverages Astro's speed and SEO optimization
11
- - 📝 **Markdown & MDX** - Full support for both formats with frontmatter
12
- - 🎨 **Customizable Templates** - Use GitHub-hosted or local templates
13
- - 🔥 **Hot Reload** - Dev server with live file watching
14
- - **Fast Builds** - Static site generation for optimal performance
15
- - 🎯 **SEO Optimized** - Meta tags, semantic HTML, and proper structure
16
- - 🌍 **i18n Support** - Built-in internationalization with 40+ languages
17
- - 📚 **Versioning** - Documentation versioning with version switcher
18
- - 🎨 **Dynamic Theming** - OKLCH color palette generation from primary color
12
+ - **Multi-Framework** - Choose your preferred framework: Astro, React, Next.js, Vue, or Nuxt
13
+ - **Simple Setup** - Point to your docs folder and go
14
+ - **Markdown & MDX** - Full support for both formats with frontmatter
15
+ - **Custom Landing Pages** - Full HTML/CSS/JS control or section-based layouts
16
+ - **Hot Reload** - Dev server with live file watching
17
+ - **Fast Builds** - Static site generation for optimal performance
18
+ - **SEO Optimized** - Meta tags, semantic HTML, and proper structure
19
+ - **i18n Support** - Built-in internationalization with 40+ languages
20
+ - **Versioning** - Documentation versioning with version switcher
21
+ - **Dynamic Theming** - OKLCH color palette generation from primary color
22
+ - **GitHub Templates** - Use official or custom GitHub-hosted templates
19
23
 
20
24
  ## Installation
21
25
 
22
- ### Global Installation
23
-
24
26
  ```bash
25
27
  npm install -g @litodocs/cli
26
28
  # or
@@ -29,203 +31,407 @@ pnpm add -g @litodocs/cli
29
31
  yarn global add @litodocs/cli
30
32
  ```
31
33
 
32
- ### Local Development
34
+ ## Quick Start
33
35
 
34
- Clone the repository and link it locally:
36
+ ```bash
37
+ # Initialize a new docs project
38
+ lito init
39
+
40
+ # Start dev server
41
+ lito dev -i ./my-docs
42
+
43
+ # Build for production
44
+ lito build -i ./my-docs -o ./dist
45
+
46
+ # Preview production build
47
+ lito preview -o ./dist
48
+ ```
49
+
50
+ ## Commands
51
+
52
+ | Command | Description |
53
+ | --------------- | -------------------------------------------- |
54
+ | `lito init` | Initialize a new documentation project |
55
+ | `lito dev` | Start development server with hot reload |
56
+ | `lito build` | Generate static documentation site |
57
+ | `lito preview` | Preview production build locally |
58
+ | `lito validate` | Validate docs-config.json configuration |
59
+ | `lito doctor` | Diagnose common issues |
60
+ | `lito info` | Show project information and statistics |
61
+ | `lito eject` | Export full project source for customization |
62
+ | `lito template` | Manage templates (list, cache) |
63
+ | `lito upgrade` | Update CLI to latest version |
64
+
65
+ ## Multi-Framework Support
66
+
67
+ Lito supports multiple frameworks. Choose the one that fits your workflow:
35
68
 
36
69
  ```bash
37
- git clone https://github.com/Lito-docs/cli.git
38
- cd cli
39
- pnpm install
40
- chmod +x bin/cli.js
41
- npm link
70
+ # Astro (default) - Fast static sites
71
+ lito dev -i ./docs --template astro
72
+
73
+ # React - Vite-powered React app
74
+ lito dev -i ./docs --template react
75
+
76
+ # Next.js - React with SSR/SSG
77
+ lito dev -i ./docs --template next
78
+
79
+ # Vue - Vite-powered Vue app
80
+ lito dev -i ./docs --template vue
81
+
82
+ # Nuxt - Vue with SSR/SSG
83
+ lito dev -i ./docs --template nuxt
42
84
  ```
43
85
 
44
- Now you can use `lito` command globally from your terminal.
86
+ ### Template Registry
45
87
 
46
- ## Quick Start
88
+ | Shorthand | Repository |
89
+ | --------- | -------------------------------------- |
90
+ | `astro` | `github:Lito-docs/lito-astro-template` |
91
+ | `react` | `github:Lito-docs/lito-react-template` |
92
+ | `next` | `github:Lito-docs/lito-next-template` |
93
+ | `vue` | `github:Lito-docs/lito-vue-template` |
94
+ | `nuxt` | `github:Lito-docs/lito-nuxt-template` |
95
+
96
+ You can also use custom templates:
47
97
 
48
98
  ```bash
49
- # Create a docs folder with markdown files
50
- mkdir my-docs
51
- echo "# Hello World" > my-docs/index.md
99
+ # GitHub repository
100
+ lito dev -i ./docs --template github:owner/repo
52
101
 
53
- # Start dev server
102
+ # Specific branch or tag
103
+ lito dev -i ./docs --template github:owner/repo#v1.0.0
104
+
105
+ # Local template
106
+ lito dev -i ./docs --template ./my-custom-template
107
+ ```
108
+
109
+ ## Command Reference
110
+
111
+ ### `lito init`
112
+
113
+ Initialize a new documentation project with interactive prompts:
114
+
115
+ ```bash
116
+ lito init
117
+ lito init -o ./my-docs -n "My Project" --template react
118
+ ```
119
+
120
+ | Option | Description | Default |
121
+ | ----------------------- | ------------------- | ------------- |
122
+ | `-o, --output <path>` | Output directory | (interactive) |
123
+ | `-n, --name <name>` | Project name | (interactive) |
124
+ | `-t, --template <name>` | Template to use | `astro` |
125
+ | `--sample` | Create sample pages | `true` |
126
+
127
+ ### `lito dev`
128
+
129
+ Start development server with hot reload:
130
+
131
+ ```bash
54
132
  lito dev -i ./my-docs
133
+ lito dev -i ./my-docs --template react --port 3000
134
+ ```
55
135
 
56
- # Build for production
136
+ | Option | Description | Default |
137
+ | ----------------------- | ------------------------------ | ------- |
138
+ | `-i, --input <path>` | Path to docs folder (required) | - |
139
+ | `-t, --template <name>` | Template to use | `astro` |
140
+ | `-p, --port <number>` | Dev server port | `4321` |
141
+ | `-b, --base-url <url>` | Base URL for the site | `/` |
142
+ | `--search` | Enable search | `false` |
143
+ | `--refresh` | Force re-download template | `false` |
144
+
145
+ ### `lito build`
146
+
147
+ Generate a static documentation site:
148
+
149
+ ```bash
57
150
  lito build -i ./my-docs -o ./dist
151
+ lito build -i ./my-docs --provider vercel --template next
58
152
  ```
59
153
 
60
- ## Usage
154
+ | Option | Description | Default |
155
+ | ----------------------- | ------------------------------------------------------ | -------- |
156
+ | `-i, --input <path>` | Path to docs folder (required) | - |
157
+ | `-o, --output <path>` | Output directory | `./dist` |
158
+ | `-t, --template <name>` | Template to use | `astro` |
159
+ | `-b, --base-url <url>` | Base URL for the site | `/` |
160
+ | `--provider <name>` | Hosting provider (vercel, netlify, cloudflare, static) | `static` |
161
+ | `--rendering <mode>` | Rendering mode (static, server, hybrid) | `static` |
162
+ | `--search` | Enable search | `false` |
163
+ | `--refresh` | Force re-download template | `false` |
61
164
 
62
- ### Build Command
165
+ ### `lito preview`
63
166
 
64
- Generate a static documentation site:
167
+ Preview production build locally:
65
168
 
66
169
  ```bash
67
- lito build --input ./my-docs --output ./dist
170
+ lito preview -o ./dist
171
+ lito preview -i ./my-docs # Auto-builds if needed
68
172
  ```
69
173
 
70
- **Options:**
174
+ | Option | Description | Default |
175
+ | --------------------- | ----------------------------------- | -------- |
176
+ | `-i, --input <path>` | Docs folder (will build if no dist) | - |
177
+ | `-o, --output <path>` | Path to built site | `./dist` |
178
+ | `-p, --port <number>` | Preview server port | `4321` |
179
+
180
+ ### `lito validate`
181
+
182
+ Validate your configuration:
183
+
184
+ ```bash
185
+ lito validate -i ./my-docs
186
+ lito validate -i ./my-docs --quiet # For CI pipelines
187
+ ```
71
188
 
72
- | Option | Description | Default |
73
- |--------|-------------|---------|
74
- | `-i, --input <path>` | Path to your docs folder (required) | - |
75
- | `-o, --output <path>` | Output directory | `./dist` |
76
- | `-t, --template <name>` | Template to use | `default` |
77
- | `-b, --base-url <url>` | Base URL for the site | `/` |
78
- | `--provider <name>` | Hosting provider (vercel, netlify, cloudflare, static) | `static` |
79
- | `--rendering <mode>` | Rendering mode (static, server, hybrid) | `static` |
80
- | `--search` | Enable search functionality | `false` |
81
- | `--refresh` | Force re-download template | `false` |
189
+ | Option | Description | Default |
190
+ | -------------------- | ----------------------- | ------- |
191
+ | `-i, --input <path>` | Path to docs folder | `.` |
192
+ | `-q, --quiet` | Exit code only (for CI) | `false` |
82
193
 
83
- ### Dev Command
194
+ ### `lito doctor`
84
195
 
85
- Start a development server with hot reload:
196
+ Diagnose common issues:
86
197
 
87
198
  ```bash
88
- lito dev --input ./my-docs
199
+ lito doctor -i ./my-docs
89
200
  ```
90
201
 
91
- **Options:**
202
+ Checks performed:
92
203
 
93
- | Option | Description | Default |
94
- |--------|-------------|---------|
95
- | `-i, --input <path>` | Path to your docs folder (required) | - |
96
- | `-t, --template <name>` | Template to use | `default` |
97
- | `-b, --base-url <url>` | Base URL for the site | `/` |
98
- | `-p, --port <number>` | Port for dev server | `4321` |
99
- | `--search` | Enable search functionality | `false` |
100
- | `--refresh` | Force re-download template | `false` |
204
+ - Directory and config file existence
205
+ - JSON syntax and schema validation
206
+ - Content files (.md/.mdx) presence
207
+ - Common mistakes (misplaced files)
208
+ - Template cache status
209
+ - Node.js version (18+ required, 20+ recommended)
101
210
 
102
- ### Eject Command
211
+ ### `lito info`
103
212
 
104
- Export the full Astro project source code to customize it further:
213
+ Show project information:
105
214
 
106
215
  ```bash
107
- lito eject --input ./my-docs --output ./my-project
216
+ lito info -i ./my-docs
108
217
  ```
109
218
 
110
- ## Deployment
219
+ Displays:
111
220
 
112
- Lito includes built-in optimizations for major hosting providers. Use the `--provider` flag during build:
221
+ - Project metadata
222
+ - Content statistics
223
+ - Navigation structure
224
+ - Enabled features
225
+ - Branding configuration
226
+ - Environment info
113
227
 
114
- ### Vercel
228
+ ### `lito eject`
229
+
230
+ Export the full project source:
115
231
 
116
232
  ```bash
117
- lito build -i ./docs --provider vercel
233
+ lito eject -i ./my-docs -o ./my-project
118
234
  ```
119
235
 
120
- Generates `vercel.json` and optimizes for Vercel's edge network.
236
+ ### `lito template`
121
237
 
122
- ### Netlify
238
+ Manage templates:
123
239
 
124
240
  ```bash
125
- lito build -i ./docs --provider netlify
241
+ lito template list # List available templates
242
+ lito template cache --clear # Clear template cache
126
243
  ```
127
244
 
128
- Generates `netlify.toml` with security headers.
245
+ ### `lito upgrade`
129
246
 
130
- ### Cloudflare Pages
247
+ Update to latest version:
131
248
 
132
249
  ```bash
133
- lito build -i ./docs --provider cloudflare --rendering server
250
+ lito upgrade
134
251
  ```
135
252
 
136
- Configures the project for Cloudflare's edge runtime with SSR support.
253
+ ## Custom Landing Pages
137
254
 
138
- ## Analytics
255
+ ### Full Custom Landing
256
+
257
+ Create a `_landing/` folder with HTML/CSS/JS:
139
258
 
140
- Lito supports Google Analytics 4 out of the box with zero performance penalty (powered by Partytown).
259
+ ```
260
+ my-docs/
261
+ ├── _landing/
262
+ │ ├── index.html
263
+ │ ├── styles.css
264
+ │ └── script.js
265
+ ├── introduction.mdx
266
+ └── docs-config.json
267
+ ```
141
268
 
142
- Add this to your `docs-config.json`:
269
+ Configure in `docs-config.json`:
143
270
 
144
271
  ```json
145
272
  {
146
- "integrations": {
147
- "analytics": {
148
- "provider": "google-analytics",
149
- "measurementId": "G-XXXXXXXXXX"
150
- }
273
+ "landing": {
274
+ "type": "custom",
275
+ "source": "_landing",
276
+ "injectNav": true,
277
+ "injectFooter": true
151
278
  }
152
279
  }
153
280
  ```
154
281
 
155
- ## Templates
156
-
157
- Lito supports flexible template sources:
282
+ ### Section-Based Landing
158
283
 
159
- ### Default Template
284
+ Mix custom HTML with default components:
160
285
 
161
- ```bash
162
- lito dev -i ./docs
286
+ ```json
287
+ {
288
+ "landing": {
289
+ "type": "sections",
290
+ "sections": [
291
+ { "type": "hero", "source": "default" },
292
+ { "type": "custom", "html": "_landing/features.html" },
293
+ { "type": "cta", "source": "default" },
294
+ { "type": "custom", "html": "_landing/pricing.html" }
295
+ ]
296
+ }
297
+ }
163
298
  ```
164
299
 
165
- ### GitHub Templates
300
+ ### Available Section Types
301
+
302
+ | Section | Description |
303
+ | -------------- | ----------------------------------- |
304
+ | `hero` | Main hero with title, subtitle, CTA |
305
+ | `features` | Feature grid or list |
306
+ | `cta` | Call-to-action banner |
307
+ | `testimonials` | Customer testimonials |
308
+ | `pricing` | Pricing tables |
309
+ | `faq` | Frequently asked questions |
310
+ | `stats` | Statistics/metrics |
311
+ | `logos` | Partner/client logos |
312
+ | `comparison` | Feature comparison table |
313
+ | `footer` | Custom footer section |
314
+
315
+ ### Landing Types
316
+
317
+ | Type | Description |
318
+ | ---------- | ---------------------------------- |
319
+ | `none` | No landing, go straight to docs |
320
+ | `default` | Use template's default landing |
321
+ | `config` | Generate from docs-config.json |
322
+ | `custom` | Full HTML/CSS/JS from `_landing/` |
323
+ | `sections` | Mix of custom and default sections |
166
324
 
167
- Use templates hosted on GitHub:
325
+ ## Deployment
326
+
327
+ ### Vercel
168
328
 
169
329
  ```bash
170
- # From a GitHub repo
171
- lito dev -i ./docs --template github:owner/repo
330
+ lito build -i ./docs --provider vercel
331
+ ```
172
332
 
173
- # Specific branch or tag
174
- lito dev -i ./docs --template github:owner/repo#v1.0.0
333
+ ### Netlify
175
334
 
176
- # Template in a subdirectory
177
- lito dev -i ./docs --template github:owner/repo/templates/modern
335
+ ```bash
336
+ lito build -i ./docs --provider netlify
178
337
  ```
179
338
 
180
- ### Local Templates
181
-
182
- Use a local template folder:
339
+ ### Cloudflare Pages
183
340
 
184
341
  ```bash
185
- lito dev -i ./docs --template ./my-custom-template
342
+ lito build -i ./docs --provider cloudflare --rendering server
186
343
  ```
187
344
 
188
- ### Template Management
345
+ ## Configuration
189
346
 
190
- ```bash
191
- # List available templates
192
- lito template list
347
+ Create a `docs-config.json` in your docs folder:
193
348
 
194
- # Clear template cache
195
- lito template cache --clear
349
+ ```json
350
+ {
351
+ "metadata": {
352
+ "name": "My Docs",
353
+ "description": "Documentation for my project"
354
+ },
355
+ "branding": {
356
+ "primaryColor": "#10b981",
357
+ "logo": "/logo.svg",
358
+ "favicon": "/favicon.ico"
359
+ },
360
+ "navigation": {
361
+ "sidebar": [
362
+ {
363
+ "group": "Getting Started",
364
+ "items": [
365
+ { "label": "Introduction", "href": "/introduction" },
366
+ { "label": "Quick Start", "href": "/quickstart" }
367
+ ]
368
+ }
369
+ ]
370
+ },
371
+ "search": {
372
+ "enabled": true
373
+ }
374
+ }
196
375
  ```
197
376
 
198
- ### Update Templates
377
+ ### Core Config Keys (Portable)
199
378
 
200
- Templates are cached for 24 hours. Force update with:
379
+ These work across all templates:
201
380
 
202
- ```bash
203
- lito dev -i ./docs --refresh
381
+ - `metadata` - Name, description, version
382
+ - `branding` - Colors, logo, favicon
383
+ - `navigation` - Sidebar, navbar
384
+ - `search` - Search settings
385
+ - `seo` - SEO configuration
386
+ - `i18n` - Internationalization
387
+ - `assets` - Asset paths
388
+
389
+ ### Extension Keys (Template-Specific)
390
+
391
+ These may vary by template:
392
+
393
+ - `footer` - Footer configuration
394
+ - `theme` - Theme customization
395
+ - `landing` - Landing page settings
396
+ - `integrations` - Third-party integrations
397
+ - `versioning` - Version settings
398
+
399
+ ## Analytics
400
+
401
+ Add Google Analytics 4:
402
+
403
+ ```json
404
+ {
405
+ "integrations": {
406
+ "analytics": {
407
+ "provider": "google-analytics",
408
+ "measurementId": "G-XXXXXXXXXX"
409
+ }
410
+ }
411
+ }
204
412
  ```
205
413
 
206
414
  ## Documentation Structure
207
415
 
208
- Your docs folder should contain Markdown (`.md`) or MDX (`.mdx`) files:
209
-
210
416
  ```
211
417
  my-docs/
212
- ├── index.md
418
+ ├── docs-config.json
419
+ ├── introduction.mdx
213
420
  ├── getting-started.md
214
421
  ├── api/
215
422
  │ ├── reference.md
216
423
  │ └── examples.md
217
- └── guides/
218
- └── advanced.md
424
+ ├── _assets/ # Static assets
425
+ ├── _images/ # Images
426
+ └── _landing/ # Custom landing (optional)
219
427
  ```
220
428
 
221
429
  ### Frontmatter
222
430
 
223
- Add frontmatter to your markdown files for better metadata:
224
-
225
431
  ```markdown
226
432
  ---
227
433
  title: Getting Started
228
- description: Learn how to get started quickly
434
+ description: Learn how to get started
229
435
  ---
230
436
 
231
437
  # Getting Started
@@ -233,16 +439,15 @@ description: Learn how to get started quickly
233
439
  Your content here...
234
440
  ```
235
441
 
236
- ## Architecture
237
-
238
- The CLI tool follows this pipeline:
442
+ ## Local Development
239
443
 
240
- 1. **Resolves Template** - Fetches from GitHub or uses local template
241
- 2. **Scaffolds** - Creates a temporary Astro project from the template
242
- 3. **Syncs** - Copies your docs into `src/pages/` for automatic routing
243
- 4. **Configures** - Generates dynamic `astro.config.mjs` with your options
244
- 5. **Builds/Serves** - Spawns native Astro CLI commands
245
- 6. **Watches** (dev mode) - Uses `chokidar` to monitor file changes
444
+ ```bash
445
+ git clone https://github.com/Lito-docs/cli.git
446
+ cd cli
447
+ pnpm install
448
+ chmod +x bin/cli.js
449
+ npm link
450
+ ```
246
451
 
247
452
  ## Contributing
248
453
 
@@ -251,7 +456,3 @@ Contributions are welcome! Please feel free to submit a Pull Request.
251
456
  ## License
252
457
 
253
458
  MIT
254
-
255
- ---
256
-
257
- **Built with ❤️ using Astro and Node.js**