mordoc 0.1.1
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 +240 -0
- package/bin/cli.js +81 -0
- package/dist/build/Builder.d.ts +91 -0
- package/dist/build/Builder.d.ts.map +1 -0
- package/dist/build/Builder.js +391 -0
- package/dist/build/Builder.js.map +1 -0
- package/dist/build/ClientBundler.d.ts +36 -0
- package/dist/build/ClientBundler.d.ts.map +1 -0
- package/dist/build/ClientBundler.js +132 -0
- package/dist/build/ClientBundler.js.map +1 -0
- package/dist/build/HtmlGenerator.d.ts +46 -0
- package/dist/build/HtmlGenerator.d.ts.map +1 -0
- package/dist/build/HtmlGenerator.js +200 -0
- package/dist/build/HtmlGenerator.js.map +1 -0
- package/dist/build/SearchIndexer.d.ts +31 -0
- package/dist/build/SearchIndexer.d.ts.map +1 -0
- package/dist/build/SearchIndexer.js +116 -0
- package/dist/build/SearchIndexer.js.map +1 -0
- package/dist/cli/build.d.ts +20 -0
- package/dist/cli/build.d.ts.map +1 -0
- package/dist/cli/build.js +111 -0
- package/dist/cli/build.js.map +1 -0
- package/dist/cli/create-app.d.ts +14 -0
- package/dist/cli/create-app.d.ts.map +1 -0
- package/dist/cli/create-app.js +216 -0
- package/dist/cli/create-app.js.map +1 -0
- package/dist/cli/dev.d.ts +20 -0
- package/dist/cli/dev.d.ts.map +1 -0
- package/dist/cli/dev.js +169 -0
- package/dist/cli/dev.js.map +1 -0
- package/dist/client/App.d.ts +17 -0
- package/dist/client/App.d.ts.map +1 -0
- package/dist/client/App.js +94 -0
- package/dist/client/App.js.map +1 -0
- package/dist/client/contexts/ConfigContext.d.ts +22 -0
- package/dist/client/contexts/ConfigContext.d.ts.map +1 -0
- package/dist/client/contexts/ConfigContext.js +27 -0
- package/dist/client/contexts/ConfigContext.js.map +1 -0
- package/dist/client/contexts/ContentContext.d.ts +31 -0
- package/dist/client/contexts/ContentContext.d.ts.map +1 -0
- package/dist/client/contexts/ContentContext.js +46 -0
- package/dist/client/contexts/ContentContext.js.map +1 -0
- package/dist/client/contexts/SearchContext.d.ts +38 -0
- package/dist/client/contexts/SearchContext.d.ts.map +1 -0
- package/dist/client/contexts/SearchContext.js +207 -0
- package/dist/client/contexts/SearchContext.js.map +1 -0
- package/dist/client/contexts/ThemeContext.d.ts +23 -0
- package/dist/client/contexts/ThemeContext.d.ts.map +1 -0
- package/dist/client/contexts/ThemeContext.js +62 -0
- package/dist/client/contexts/ThemeContext.js.map +1 -0
- package/dist/client/hooks/useContent.d.ts +12 -0
- package/dist/client/hooks/useContent.d.ts.map +1 -0
- package/dist/client/hooks/useContent.js +74 -0
- package/dist/client/hooks/useContent.js.map +1 -0
- package/dist/client/hooks/useNavigation.d.ts +15 -0
- package/dist/client/hooks/useNavigation.d.ts.map +1 -0
- package/dist/client/hooks/useNavigation.js +101 -0
- package/dist/client/hooks/useNavigation.js.map +1 -0
- package/dist/client/hooks/useSearch.d.ts +22 -0
- package/dist/client/hooks/useSearch.d.ts.map +1 -0
- package/dist/client/hooks/useSearch.js +64 -0
- package/dist/client/hooks/useSearch.js.map +1 -0
- package/dist/client/main.d.ts +5 -0
- package/dist/client/main.d.ts.map +1 -0
- package/dist/client/main.js +66 -0
- package/dist/client/main.js.map +1 -0
- package/dist/components/Callout.d.ts +9 -0
- package/dist/components/Callout.d.ts.map +1 -0
- package/dist/components/Callout.js +24 -0
- package/dist/components/Callout.js.map +1 -0
- package/dist/components/Card.d.ts +10 -0
- package/dist/components/Card.d.ts.map +1 -0
- package/dist/components/Card.js +15 -0
- package/dist/components/Card.js.map +1 -0
- package/dist/components/CardGrid.d.ts +8 -0
- package/dist/components/CardGrid.d.ts.map +1 -0
- package/dist/components/CardGrid.js +9 -0
- package/dist/components/CardGrid.js.map +1 -0
- package/dist/components/CodeBlock.d.ts +24 -0
- package/dist/components/CodeBlock.d.ts.map +1 -0
- package/dist/components/CodeBlock.js +76 -0
- package/dist/components/CodeBlock.js.map +1 -0
- package/dist/components/ContentPage.d.ts +9 -0
- package/dist/components/ContentPage.d.ts.map +1 -0
- package/dist/components/ContentPage.js +36 -0
- package/dist/components/ContentPage.js.map +1 -0
- package/dist/components/Header.d.ts +14 -0
- package/dist/components/Header.d.ts.map +1 -0
- package/dist/components/Header.js +30 -0
- package/dist/components/Header.js.map +1 -0
- package/dist/components/Heading.d.ts +16 -0
- package/dist/components/Heading.d.ts.map +1 -0
- package/dist/components/Heading.js +31 -0
- package/dist/components/Heading.js.map +1 -0
- package/dist/components/Image.d.ts +8 -0
- package/dist/components/Image.d.ts.map +1 -0
- package/dist/components/Image.js +24 -0
- package/dist/components/Image.js.map +1 -0
- package/dist/components/Layout.d.ts +14 -0
- package/dist/components/Layout.d.ts.map +1 -0
- package/dist/components/Layout.js +32 -0
- package/dist/components/Layout.js.map +1 -0
- package/dist/components/MarkdocRenderer.d.ts +15 -0
- package/dist/components/MarkdocRenderer.d.ts.map +1 -0
- package/dist/components/MarkdocRenderer.js +73 -0
- package/dist/components/MarkdocRenderer.js.map +1 -0
- package/dist/components/MobileMenu.d.ts +14 -0
- package/dist/components/MobileMenu.d.ts.map +1 -0
- package/dist/components/MobileMenu.js +45 -0
- package/dist/components/MobileMenu.js.map +1 -0
- package/dist/components/PageNavigation.d.ts +9 -0
- package/dist/components/PageNavigation.d.ts.map +1 -0
- package/dist/components/PageNavigation.js +23 -0
- package/dist/components/PageNavigation.js.map +1 -0
- package/dist/components/SearchModal.d.ts +9 -0
- package/dist/components/SearchModal.d.ts.map +1 -0
- package/dist/components/SearchModal.js +74 -0
- package/dist/components/SearchModal.js.map +1 -0
- package/dist/components/SideNav.d.ts +9 -0
- package/dist/components/SideNav.d.ts.map +1 -0
- package/dist/components/SideNav.js +66 -0
- package/dist/components/SideNav.js.map +1 -0
- package/dist/components/TableOfContents.d.ts +10 -0
- package/dist/components/TableOfContents.d.ts.map +1 -0
- package/dist/components/TableOfContents.js +151 -0
- package/dist/components/TableOfContents.js.map +1 -0
- package/dist/config/ConfigLoader.d.ts +50 -0
- package/dist/config/ConfigLoader.d.ts.map +1 -0
- package/dist/config/ConfigLoader.js +214 -0
- package/dist/config/ConfigLoader.js.map +1 -0
- package/dist/config/StyleCompiler.d.ts +17 -0
- package/dist/config/StyleCompiler.d.ts.map +1 -0
- package/dist/config/StyleCompiler.js +116 -0
- package/dist/config/StyleCompiler.js.map +1 -0
- package/dist/config/ThemeGenerator.d.ts +14 -0
- package/dist/config/ThemeGenerator.d.ts.map +1 -0
- package/dist/config/ThemeGenerator.js +129 -0
- package/dist/config/ThemeGenerator.js.map +1 -0
- package/dist/content/ContentLoader.d.ts +70 -0
- package/dist/content/ContentLoader.d.ts.map +1 -0
- package/dist/content/ContentLoader.js +146 -0
- package/dist/content/ContentLoader.js.map +1 -0
- package/dist/content/ContentProcessor.d.ts +84 -0
- package/dist/content/ContentProcessor.d.ts.map +1 -0
- package/dist/content/ContentProcessor.js +380 -0
- package/dist/content/ContentProcessor.js.map +1 -0
- package/dist/content/RouteManager.d.ts +69 -0
- package/dist/content/RouteManager.d.ts.map +1 -0
- package/dist/content/RouteManager.js +143 -0
- package/dist/content/RouteManager.js.map +1 -0
- package/dist/styles/components/callout.d.ts +11 -0
- package/dist/styles/components/callout.d.ts.map +1 -0
- package/dist/styles/components/callout.js +83 -0
- package/dist/styles/components/callout.js.map +1 -0
- package/dist/styles/components/card.d.ts +11 -0
- package/dist/styles/components/card.d.ts.map +1 -0
- package/dist/styles/components/card.js +179 -0
- package/dist/styles/components/card.js.map +1 -0
- package/dist/styles/components/codeblock.d.ts +11 -0
- package/dist/styles/components/codeblock.d.ts.map +1 -0
- package/dist/styles/components/codeblock.js +249 -0
- package/dist/styles/components/codeblock.js.map +1 -0
- package/dist/styles/components/content.d.ts +11 -0
- package/dist/styles/components/content.d.ts.map +1 -0
- package/dist/styles/components/content.js +198 -0
- package/dist/styles/components/content.js.map +1 -0
- package/dist/styles/components/fonts.d.ts +11 -0
- package/dist/styles/components/fonts.d.ts.map +1 -0
- package/dist/styles/components/fonts.js +34 -0
- package/dist/styles/components/fonts.js.map +1 -0
- package/dist/styles/components/header.d.ts +11 -0
- package/dist/styles/components/header.d.ts.map +1 -0
- package/dist/styles/components/header.js +293 -0
- package/dist/styles/components/header.js.map +1 -0
- package/dist/styles/components/heading.d.ts +11 -0
- package/dist/styles/components/heading.d.ts.map +1 -0
- package/dist/styles/components/heading.js +115 -0
- package/dist/styles/components/heading.js.map +1 -0
- package/dist/styles/components/layout.d.ts +11 -0
- package/dist/styles/components/layout.d.ts.map +1 -0
- package/dist/styles/components/layout.js +79 -0
- package/dist/styles/components/layout.js.map +1 -0
- package/dist/styles/components/mobilemenu.d.ts +11 -0
- package/dist/styles/components/mobilemenu.d.ts.map +1 -0
- package/dist/styles/components/mobilemenu.js +112 -0
- package/dist/styles/components/mobilemenu.js.map +1 -0
- package/dist/styles/components/reset.d.ts +11 -0
- package/dist/styles/components/reset.d.ts.map +1 -0
- package/dist/styles/components/reset.js +131 -0
- package/dist/styles/components/reset.js.map +1 -0
- package/dist/styles/components/searchmodal.d.ts +11 -0
- package/dist/styles/components/searchmodal.d.ts.map +1 -0
- package/dist/styles/components/searchmodal.js +333 -0
- package/dist/styles/components/searchmodal.js.map +1 -0
- package/dist/styles/components/sidenav.d.ts +11 -0
- package/dist/styles/components/sidenav.d.ts.map +1 -0
- package/dist/styles/components/sidenav.js +209 -0
- package/dist/styles/components/sidenav.js.map +1 -0
- package/dist/styles/components/toc.d.ts +11 -0
- package/dist/styles/components/toc.d.ts.map +1 -0
- package/dist/styles/components/toc.js +112 -0
- package/dist/styles/components/toc.js.map +1 -0
- package/dist/styles/components/typography.d.ts +11 -0
- package/dist/styles/components/typography.d.ts.map +1 -0
- package/dist/styles/components/typography.js +247 -0
- package/dist/styles/components/typography.js.map +1 -0
- package/dist/styles/components/utility.d.ts +11 -0
- package/dist/styles/components/utility.d.ts.map +1 -0
- package/dist/styles/components/utility.js +231 -0
- package/dist/styles/components/utility.js.map +1 -0
- package/dist/styles/types.d.ts +79 -0
- package/dist/styles/types.d.ts.map +1 -0
- package/dist/styles/types.js +7 -0
- package/dist/styles/types.js.map +1 -0
- package/dist/styles/utils.d.ts +21 -0
- package/dist/styles/utils.d.ts.map +1 -0
- package/dist/styles/utils.js +50 -0
- package/dist/styles/utils.js.map +1 -0
- package/dist/styles/variables/main.d.ts +15 -0
- package/dist/styles/variables/main.d.ts.map +1 -0
- package/dist/styles/variables/main.js +116 -0
- package/dist/styles/variables/main.js.map +1 -0
- package/dist/types/config.d.ts +43 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +7 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/content.d.ts +46 -0
- package/dist/types/content.d.ts.map +1 -0
- package/dist/types/content.js +7 -0
- package/dist/types/content.js.map +1 -0
- package/dist/types/navigation.d.ts +45 -0
- package/dist/types/navigation.d.ts.map +1 -0
- package/dist/types/navigation.js +7 -0
- package/dist/types/navigation.js.map +1 -0
- package/dist/utils/language-utils.d.ts +41 -0
- package/dist/utils/language-utils.d.ts.map +1 -0
- package/dist/utils/language-utils.js +79 -0
- package/dist/utils/language-utils.js.map +1 -0
- package/dist/utils/slugify.d.ts +20 -0
- package/dist/utils/slugify.d.ts.map +1 -0
- package/dist/utils/slugify.js +44 -0
- package/dist/utils/slugify.js.map +1 -0
- package/package.json +58 -0
package/README.md
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
# Mordoc
|
|
2
|
+
|
|
3
|
+
A modern static site generator for documentation with SSG + SPA capabilities. Build fast, SEO-friendly documentation sites with smooth client-side navigation.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Mordoc combines the best of static site generation and single-page applications to deliver documentation sites that are:
|
|
8
|
+
- **SEO-friendly** with pre-rendered HTML for every page
|
|
9
|
+
- **Fast to navigate** with client-side routing after initial load
|
|
10
|
+
- **Easy to write** using Markdown and Markdoc
|
|
11
|
+
- **Customizable** with simple JSON configuration
|
|
12
|
+
- **Multi-language ready** with built-in internationalization support
|
|
13
|
+
|
|
14
|
+
## Key Features
|
|
15
|
+
|
|
16
|
+
- 📄 **Markdoc-powered** - Write content in Markdown with powerful custom components
|
|
17
|
+
- 🚀 **Static + SPA** - Pre-rendered HTML with smooth client-side navigation
|
|
18
|
+
- 🔍 **Built-in Search** - Instant full-text search powered by Pagefind
|
|
19
|
+
- 🌍 **Multi-language** - First-class support for internationalization
|
|
20
|
+
- 🎨 **Customizable Theming** - Configure colors and styles with simple JSON
|
|
21
|
+
- ⚡ **React-based** - Modern React 19 for component rendering
|
|
22
|
+
- 📱 **Responsive** - Mobile-friendly by default
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
Create a new Mordoc documentation site using `create-mordoc-app`:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm create mordoc-app my-docs
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
> **Note:** The `create-mordoc-app` package is not yet published. Coming soon!
|
|
33
|
+
|
|
34
|
+
Or with other package managers:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Using yarn
|
|
38
|
+
yarn create mordoc-app my-docs
|
|
39
|
+
|
|
40
|
+
# Using pnpm
|
|
41
|
+
pnpm create mordoc-app my-docs
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Quick Start
|
|
45
|
+
|
|
46
|
+
1. **Create a new project:**
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npm create mordoc-app my-docs
|
|
50
|
+
cd my-docs
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
2. **Build your documentation:**
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npm run build
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
3. **Start the development server:**
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm run dev
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Your documentation site will be available at `http://localhost:3000`
|
|
66
|
+
|
|
67
|
+
## CLI Commands
|
|
68
|
+
|
|
69
|
+
### `mordoc build`
|
|
70
|
+
|
|
71
|
+
Generate the static documentation site.
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
mordoc build [options]
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Options:**
|
|
78
|
+
|
|
79
|
+
| Option | Alias | Description | Default |
|
|
80
|
+
|--------|-------|-------------|---------|
|
|
81
|
+
| `--output <dir>` | `-o` | Output directory | `dist` |
|
|
82
|
+
| `--verbose` | `-v` | Enable verbose logging | `false` |
|
|
83
|
+
| `--drafts` | `-d` | Include draft content in build | `false` |
|
|
84
|
+
| `--no-clean` | | Don't clean output directory before build | `false` |
|
|
85
|
+
| `--help` | `-h` | Show help message | |
|
|
86
|
+
|
|
87
|
+
**Examples:**
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Basic build
|
|
91
|
+
mordoc build
|
|
92
|
+
|
|
93
|
+
# Build to custom directory
|
|
94
|
+
mordoc build --output build
|
|
95
|
+
|
|
96
|
+
# Build with drafts and verbose output
|
|
97
|
+
mordoc build --verbose --drafts
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### `mordoc dev`
|
|
101
|
+
|
|
102
|
+
Start the development server to preview your documentation.
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
mordoc dev [options]
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Options:**
|
|
109
|
+
|
|
110
|
+
| Option | Alias | Description | Default |
|
|
111
|
+
|--------|-------|-------------|---------|
|
|
112
|
+
| `--port <number>` | `-p` | Port number | `3000` |
|
|
113
|
+
| `--host <host>` | `-h` | Host address | `localhost` |
|
|
114
|
+
| `--open` | `-o` | Open browser automatically | `false` |
|
|
115
|
+
| `--help` | | Show help message | |
|
|
116
|
+
|
|
117
|
+
**Examples:**
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Start dev server on default port
|
|
121
|
+
mordoc dev
|
|
122
|
+
|
|
123
|
+
# Use custom port
|
|
124
|
+
mordoc dev --port 8080
|
|
125
|
+
|
|
126
|
+
# Make accessible on network
|
|
127
|
+
mordoc dev --host 0.0.0.0
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
> **Note:** The dev server serves the pre-built `dist/` folder. Run `mordoc build` first and rebuild manually after making changes.
|
|
131
|
+
|
|
132
|
+
## Project Structure
|
|
133
|
+
|
|
134
|
+
After creating a new project, you'll have the following structure:
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
my-docs/
|
|
138
|
+
├── content/ # Your markdown content files
|
|
139
|
+
│ └── en/ # English content (default language)
|
|
140
|
+
│ ├── index.md # Homepage
|
|
141
|
+
│ ├── getting-started.md
|
|
142
|
+
│ └── guides/
|
|
143
|
+
│ └── first-steps.md
|
|
144
|
+
├── config/ # Configuration files
|
|
145
|
+
│ ├── site.json # Site metadata and settings
|
|
146
|
+
│ ├── sidenav.yaml # Sidebar navigation structure
|
|
147
|
+
│ └── styles/ # Theme customization
|
|
148
|
+
├── public/ # Static assets (images, fonts, etc.)
|
|
149
|
+
├── dist/ # Generated site (after build)
|
|
150
|
+
├── package.json
|
|
151
|
+
└── node_modules/
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Configuration
|
|
155
|
+
|
|
156
|
+
Mordoc uses simple configuration files in the `config/` directory:
|
|
157
|
+
|
|
158
|
+
- **`site.json`** - Site metadata (title, description, base URL)
|
|
159
|
+
- **`sidenav.yaml`** - Sidebar navigation structure
|
|
160
|
+
- **`styles/`** - Theme colors and customization
|
|
161
|
+
|
|
162
|
+
For detailed configuration options and syntax, see the [Mordoc Documentation](#) *(coming soon)*.
|
|
163
|
+
|
|
164
|
+
## Content Writing
|
|
165
|
+
|
|
166
|
+
Write your documentation using Markdown with Markdoc enhancements:
|
|
167
|
+
|
|
168
|
+
```markdown
|
|
169
|
+
---
|
|
170
|
+
title: My Page Title
|
|
171
|
+
description: Page description for SEO
|
|
172
|
+
order: 1
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
# My Page Title
|
|
176
|
+
|
|
177
|
+
Your content here...
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Frontmatter
|
|
181
|
+
|
|
182
|
+
Each markdown file supports frontmatter for metadata:
|
|
183
|
+
|
|
184
|
+
- `title` - Page title
|
|
185
|
+
- `description` - Page description (for SEO)
|
|
186
|
+
- `order` - Sort order in navigation
|
|
187
|
+
- `draft` - Mark as draft (excluded unless `--drafts` flag used)
|
|
188
|
+
|
|
189
|
+
For complete documentation on content writing, Markdoc syntax, and custom components, visit the [Mordoc Documentation](#) *(coming soon)*.
|
|
190
|
+
|
|
191
|
+
## Development Workflow
|
|
192
|
+
|
|
193
|
+
1. **Write content** - Add or edit markdown files in `content/`
|
|
194
|
+
2. **Build** - Run `npm run build` to generate the static site
|
|
195
|
+
3. **Preview** - Run `npm run dev` to preview locally
|
|
196
|
+
4. **Iterate** - Make changes and rebuild
|
|
197
|
+
|
|
198
|
+
## Deployment
|
|
199
|
+
|
|
200
|
+
Mordoc generates a fully static site in the `dist/` directory. Deploy it to any static hosting service:
|
|
201
|
+
|
|
202
|
+
- **Netlify** - Drag and drop the `dist/` folder or connect your git repo
|
|
203
|
+
- **Vercel** - Import your project and set build command to `npm run build`
|
|
204
|
+
- **GitHub Pages** - Push the `dist/` folder to your gh-pages branch
|
|
205
|
+
- **AWS S3** - Upload the `dist/` folder to an S3 bucket
|
|
206
|
+
- **Any static host** - Upload the `dist/` folder contents
|
|
207
|
+
|
|
208
|
+
Build command: `npm run build`
|
|
209
|
+
Output directory: `dist`
|
|
210
|
+
|
|
211
|
+
## Requirements
|
|
212
|
+
|
|
213
|
+
- **Node.js** >= 18.0.0
|
|
214
|
+
- **npm** >= 9.0.0 (or yarn/pnpm equivalent)
|
|
215
|
+
|
|
216
|
+
## Technology Stack
|
|
217
|
+
|
|
218
|
+
Mordoc is built with modern web technologies:
|
|
219
|
+
|
|
220
|
+
- [Markdoc](https://markdoc.dev/) - Markdown authoring framework
|
|
221
|
+
- [React 19](https://react.dev/) - UI rendering
|
|
222
|
+
- [React Router](https://reactrouter.com/) - Client-side routing
|
|
223
|
+
- [Pagefind](https://pagefind.app/) - Static search
|
|
224
|
+
- [esbuild](https://esbuild.github.io/) - Fast bundling
|
|
225
|
+
- [Prism.js](https://prismjs.com/) - Syntax highlighting
|
|
226
|
+
|
|
227
|
+
## Contributing
|
|
228
|
+
|
|
229
|
+
Contributions are welcome! Please feel free to submit issues and pull requests.
|
|
230
|
+
|
|
231
|
+
## License
|
|
232
|
+
|
|
233
|
+
MIT
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
**Documentation:** [https://mordoc.dev](#) *(coming soon)*
|
|
238
|
+
**Issues:** [GitHub Issues](#)
|
|
239
|
+
**NPM:** [mordoc](#) *(not yet published)*
|
|
240
|
+
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
|
|
6
|
+
// Get the command from arguments
|
|
7
|
+
const args = process.argv.slice(2);
|
|
8
|
+
const command = args[0];
|
|
9
|
+
const commandArgs = args.slice(1); // Arguments after the command
|
|
10
|
+
|
|
11
|
+
// Display help text
|
|
12
|
+
function showHelp() {
|
|
13
|
+
console.log(`
|
|
14
|
+
Mordoc - Static Site Generator for Documentation
|
|
15
|
+
|
|
16
|
+
Usage:
|
|
17
|
+
mordoc <command> [options]
|
|
18
|
+
|
|
19
|
+
Commands:
|
|
20
|
+
build Build the documentation site
|
|
21
|
+
dev Start the development server
|
|
22
|
+
|
|
23
|
+
Options:
|
|
24
|
+
--help Show this help message
|
|
25
|
+
|
|
26
|
+
Examples:
|
|
27
|
+
mordoc build
|
|
28
|
+
mordoc build --verbose --drafts
|
|
29
|
+
mordoc dev
|
|
30
|
+
mordoc dev --port 8080
|
|
31
|
+
`);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Main CLI logic
|
|
35
|
+
async function main() {
|
|
36
|
+
// Show help if no command or --help flag
|
|
37
|
+
if (!command || command === '--help' || command === '-h') {
|
|
38
|
+
showHelp();
|
|
39
|
+
process.exit(0);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Check if dist folder exists (TypeScript must be compiled first)
|
|
43
|
+
const distPath = path.join(__dirname, '../dist/cli');
|
|
44
|
+
if (!fs.existsSync(distPath)) {
|
|
45
|
+
console.error('Error: Mordoc is not built. Please run "tsc" first to compile TypeScript.');
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Route to appropriate command handler
|
|
50
|
+
try {
|
|
51
|
+
switch (command) {
|
|
52
|
+
case 'build': {
|
|
53
|
+
const buildHandler = require('../dist/cli/build.js');
|
|
54
|
+
const options = buildHandler.parseBuildArgs(commandArgs);
|
|
55
|
+
await buildHandler.build(options);
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
case 'dev': {
|
|
60
|
+
const devHandler = require('../dist/cli/dev.js');
|
|
61
|
+
const options = devHandler.parseDevArgs(commandArgs);
|
|
62
|
+
await devHandler.dev(options);
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
default:
|
|
67
|
+
console.error(`Unknown command: ${command}`);
|
|
68
|
+
showHelp();
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
} catch (error) {
|
|
72
|
+
console.error('Error:', error.message);
|
|
73
|
+
if (process.env.DEBUG) {
|
|
74
|
+
console.error(error.stack);
|
|
75
|
+
}
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Run the CLI
|
|
81
|
+
main();
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builder - Main build orchestrator for Mordoc
|
|
3
|
+
* Coordinates the entire static site generation process
|
|
4
|
+
*/
|
|
5
|
+
export interface BuilderOptions {
|
|
6
|
+
projectRoot: string;
|
|
7
|
+
outputDir?: string;
|
|
8
|
+
clean?: boolean;
|
|
9
|
+
includeDrafts?: boolean;
|
|
10
|
+
verbose?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare class Builder {
|
|
13
|
+
private projectRoot;
|
|
14
|
+
private outputDir;
|
|
15
|
+
private contentDir;
|
|
16
|
+
private configDir;
|
|
17
|
+
private publicDir;
|
|
18
|
+
private clean;
|
|
19
|
+
private includeDrafts;
|
|
20
|
+
private verbose;
|
|
21
|
+
constructor(options: BuilderOptions);
|
|
22
|
+
/**
|
|
23
|
+
* Execute the complete build process
|
|
24
|
+
*/
|
|
25
|
+
build(): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Load site configuration
|
|
28
|
+
*/
|
|
29
|
+
private loadConfig;
|
|
30
|
+
/**
|
|
31
|
+
* Load and process all content files
|
|
32
|
+
*/
|
|
33
|
+
private loadAndProcessContent;
|
|
34
|
+
/**
|
|
35
|
+
* Generate static HTML pages for all content
|
|
36
|
+
*/
|
|
37
|
+
private generateHtmlPages;
|
|
38
|
+
/**
|
|
39
|
+
* Write HTML file for a content page
|
|
40
|
+
*/
|
|
41
|
+
private writeHtmlFile;
|
|
42
|
+
/**
|
|
43
|
+
* Generate JSON data files for SPA navigation
|
|
44
|
+
*/
|
|
45
|
+
private generateContentDataFiles;
|
|
46
|
+
/**
|
|
47
|
+
* Generate theme CSS and component styles
|
|
48
|
+
*/
|
|
49
|
+
private generateThemeCSS;
|
|
50
|
+
/**
|
|
51
|
+
* Bundle client React application
|
|
52
|
+
*/
|
|
53
|
+
private bundleClientApp;
|
|
54
|
+
/**
|
|
55
|
+
* Copy static assets (logo, favicon, public/ folder, and MORDOC fonts)
|
|
56
|
+
*/
|
|
57
|
+
private copyStaticAssets;
|
|
58
|
+
/**
|
|
59
|
+
* Copy MORDOC's built-in assets (fonts, etc.)
|
|
60
|
+
*/
|
|
61
|
+
private copyMordocAssets;
|
|
62
|
+
/**
|
|
63
|
+
* Generate client configuration JSON
|
|
64
|
+
*/
|
|
65
|
+
private generateClientConfig;
|
|
66
|
+
/**
|
|
67
|
+
* Generate search index using Pagefind
|
|
68
|
+
*/
|
|
69
|
+
private generateSearchIndex;
|
|
70
|
+
/**
|
|
71
|
+
* Clean output directory
|
|
72
|
+
*/
|
|
73
|
+
private cleanOutputDir;
|
|
74
|
+
/**
|
|
75
|
+
* Ensure output directory exists
|
|
76
|
+
*/
|
|
77
|
+
private ensureOutputDir;
|
|
78
|
+
/**
|
|
79
|
+
* Copy directory recursively
|
|
80
|
+
*/
|
|
81
|
+
private copyDirectory;
|
|
82
|
+
/**
|
|
83
|
+
* Log message if verbose mode is enabled
|
|
84
|
+
*/
|
|
85
|
+
private log;
|
|
86
|
+
/**
|
|
87
|
+
* Print build statistics
|
|
88
|
+
*/
|
|
89
|
+
private printBuildStats;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=Builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Builder.d.ts","sourceRoot":"","sources":["../../src/build/Builder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAiBH,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,qBAAa,OAAO;IAClB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,KAAK,CAAU;IACvB,OAAO,CAAC,aAAa,CAAU;IAC/B,OAAO,CAAC,OAAO,CAAU;gBAEb,OAAO,EAAE,cAAc;IAWnC;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA2D5B;;OAEG;YACW,UAAU;IAKxB;;OAEG;YACW,qBAAqB;IAkBnC;;OAEG;YACW,iBAAiB;IAsB/B;;OAEG;IACH,OAAO,CAAC,aAAa;IAyBrB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAyDhC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAkBxB;;OAEG;YACW,eAAe;IAc7B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAwCxB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAkBxB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAc5B;;OAEG;YACW,mBAAmB;IAmBjC;;OAEG;IACH,OAAO,CAAC,cAAc;IAMtB;;OAEG;IACH,OAAO,CAAC,eAAe;IAMvB;;OAEG;IACH,OAAO,CAAC,aAAa;IAgBrB;;OAEG;IACH,OAAO,CAAC,GAAG;IAOX;;OAEG;IACH,OAAO,CAAC,eAAe;CAmBxB"}
|