docsprout 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.
Files changed (39) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +224 -0
  3. package/dist/index.cjs +9725 -0
  4. package/dist/index.d.cts +1 -0
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.js +9730 -0
  7. package/package.json +36 -0
  8. package/templates/base/config.json +18 -0
  9. package/templates/base/content/index.md +10 -0
  10. package/templates/base/generated/pages.json +2 -0
  11. package/templates/base/generated/search-index.json +2 -0
  12. package/templates/base/sidebar.json +9 -0
  13. package/templates/base/themes/default.json +8 -0
  14. package/templates/web/app/(public)/docs/[[...slug]]/loading.tsx +9 -0
  15. package/templates/web/app/(public)/docs/[[...slug]]/page.tsx +74 -0
  16. package/templates/web/app/api/config/route.ts +47 -0
  17. package/templates/web/app/api/publish/route.ts +82 -0
  18. package/templates/web/app/api/search/route.ts +11 -0
  19. package/templates/web/app/docs-admin/loading.tsx +9 -0
  20. package/templates/web/app/docs-admin/page.tsx +237 -0
  21. package/templates/web/app/globals.css +141 -0
  22. package/templates/web/app/layout.tsx +46 -0
  23. package/templates/web/app/page.tsx +17 -0
  24. package/templates/web/components/markdown-content.tsx +100 -0
  25. package/templates/web/components/providers.tsx +12 -0
  26. package/templates/web/components/rich-editor.tsx +94 -0
  27. package/templates/web/components/search-box.tsx +43 -0
  28. package/templates/web/components/sidebar.tsx +36 -0
  29. package/templates/web/components/toc.tsx +53 -0
  30. package/templates/web/lib/content.ts +41 -0
  31. package/templates/web/lib/db.ts +9 -0
  32. package/templates/web/lib/types.ts +33 -0
  33. package/templates/web/next-env.d.ts +5 -0
  34. package/templates/web/next.config.mjs +16 -0
  35. package/templates/web/package.json +40 -0
  36. package/templates/web/postcss.config.cjs +8 -0
  37. package/templates/web/prisma/schema.prisma +21 -0
  38. package/templates/web/tailwind.config.cjs +10 -0
  39. package/templates/web/tsconfig.json +20 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Docsprout contributors
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 ADDED
@@ -0,0 +1,224 @@
1
+ # Docsprout
2
+
3
+ [![npm package][npm-img]][npm-url]
4
+ [![Downloads][downloads-img]][downloads-url]
5
+ [![Issues][issues-img]][issues-url]
6
+ ![ES Version][es-version]
7
+ ![Node Version][node-version]
8
+
9
+ [npm-img]: https://img.shields.io/npm/v/docsprout/latest
10
+ [npm-url]: https://www.npmjs.com/package/docsprout
11
+ [downloads-img]: https://img.shields.io/npm/dt/docsprout
12
+ [downloads-url]: https://www.npmtrends.com/docsprout
13
+ [issues-img]: https://img.shields.io/github/issues/moazzamgodil/docsprout
14
+ [issues-url]: https://github.com/moazzamgodil/docsprout/issues
15
+ [es-version]: https://img.shields.io/badge/ES-2020-yellow
16
+ [node-version]: https://img.shields.io/badge/node-20.x-green
17
+
18
+ Docsprout is a CLI that adds a documentation site and admin editor to an existing project using Markdown files.
19
+
20
+ After setup, your docs are available at:
21
+ - `/docs` (public docs)
22
+ - `/docs-admin` (admin editor)
23
+
24
+ ## Who This Is For
25
+
26
+ Use Docsprout if you want to:
27
+ - keep docs in Markdown inside your repo
28
+ - generate navigation/search automatically
29
+ - maintain draft vs published content
30
+
31
+ ## Requirements
32
+
33
+ - Node.js 18+
34
+ - npm 9+
35
+ - An existing JavaScript/TypeScript project
36
+
37
+ ## Install
38
+
39
+ ```bash
40
+ npm install -D docsprout
41
+ ```
42
+
43
+ You can also run commands directly with `npx` without adding scripts.
44
+
45
+ ## Quick Start
46
+
47
+ From your project root:
48
+
49
+ ```bash
50
+ npx docsprout init
51
+ npx docsprout dev
52
+ ```
53
+
54
+ Then open:
55
+ - `http://localhost:3000/docs`
56
+ - `http://localhost:3000/docs-admin`
57
+
58
+ ## Recommended npm Scripts
59
+
60
+ ```json
61
+ {
62
+ "scripts": {
63
+ "docs:init": "docsprout init",
64
+ "docs:upgrade": "docsprout upgrade",
65
+ "docs:scan": "docsprout scan",
66
+ "docs:dev": "docsprout dev",
67
+ "docs:build": "docsprout build",
68
+ "docs:publish": "docsprout publish"
69
+ }
70
+ }
71
+ ```
72
+
73
+ ## CLI Commands
74
+
75
+ ### `docsprout init`
76
+ Initializes Docsprout in your repository.
77
+
78
+ Creates/updates the `docsprout/` workspace used by the docs runtime.
79
+
80
+ ### `docsprout upgrade`
81
+ Upgrades generated docs runtime files to the latest scaffold template.
82
+
83
+ ### `docsprout scan`
84
+ Rescans Markdown sources and regenerates docs data (pages, sidebar, search).
85
+
86
+ ### `docsprout dev`
87
+ Runs docs + admin in development mode with file watching.
88
+
89
+ ### `docsprout build`
90
+ Builds production assets.
91
+
92
+ ### `docsprout publish`
93
+ Builds a production-ready output that excludes draft content.
94
+
95
+ Note: `docsprout publish` is a content build command, not `npm publish`.
96
+
97
+ ## Markdown Discovery
98
+
99
+ By default, Docsprout scans configured content roots for:
100
+ - `README.md`
101
+ - `*.md`
102
+ - `*.mdx`
103
+
104
+ Default ignore patterns include:
105
+ - `node_modules`
106
+ - `dist`
107
+ - `build`
108
+ - `coverage`
109
+ - `.next`
110
+ - hidden folders
111
+
112
+ ## Configuration
113
+
114
+ Edit `docsprout/config.json`:
115
+
116
+ ```json
117
+ {
118
+ "projectName": "My Project",
119
+ "contentRoots": [".", "packages/*", "apps/*"],
120
+ "ignore": [
121
+ "**/node_modules/**",
122
+ "**/dist/**",
123
+ "**/build/**",
124
+ "**/coverage/**",
125
+ "**/.next/**",
126
+ "**/.*/**"
127
+ ],
128
+ "theme": "default",
129
+ "basePath": "/docs",
130
+ "adminPath": "/docs-admin",
131
+ "outputDir": "docsprout",
132
+ "includeDraftsInDev": true
133
+ }
134
+ ```
135
+
136
+ Field notes:
137
+ - `contentRoots`: where Markdown is discovered
138
+ - `basePath`: URL path for public docs
139
+ - `adminPath`: URL path for admin editor
140
+ - `includeDraftsInDev`: include draft pages during local development
141
+
142
+ ## Draft vs Published Content
143
+
144
+ Use frontmatter:
145
+
146
+ ```md
147
+ ---
148
+ title: API Overview
149
+ status: draft
150
+ order: 3
151
+ tags: [api, backend]
152
+ ---
153
+ ```
154
+
155
+ Rules:
156
+ - `status: draft` appears in admin/dev workflows
157
+ - `status: published` is included in production/publish output
158
+
159
+ ## Admin Panel Guide
160
+
161
+ The admin panel is available at `/docs-admin` when running `docsprout dev`.
162
+
163
+ Typical workflow:
164
+ 1. Open `/docs-admin`
165
+ 2. Create a new page or open an existing one
166
+ 3. Edit content in the Markdown editor and preview
167
+ 4. Save changes
168
+ 5. Set frontmatter `status` to `published` for pages that should appear in production
169
+ 6. Run `docsprout publish` for production-ready output
170
+
171
+ What the admin panel is for:
172
+ - create/edit Markdown pages
173
+ - update page metadata (title/order/status/tags)
174
+ - preview rendered content before publishing
175
+ - update project config values used by the docs runtime
176
+
177
+ ## Diagram Support
178
+
179
+ Docs and preview support Mermaid and common diagram syntaxes via fenced code blocks.
180
+
181
+ Example:
182
+
183
+ <pre>
184
+ ```mermaid
185
+ flowchart LR
186
+ A[Start] --> B[Done]
187
+ ```
188
+ </pre>
189
+
190
+ ## Monorepo Support
191
+
192
+ Docsprout works with:
193
+ - npm workspaces
194
+ - Turborepo
195
+ - Nx
196
+
197
+ Run commands from your repository root.
198
+
199
+ ## Troubleshooting
200
+
201
+ ### Docs changes not appearing
202
+
203
+ Run:
204
+
205
+ ```bash
206
+ npx docsprout scan
207
+ ```
208
+
209
+ ### Page missing in production output
210
+
211
+ Confirm frontmatter:
212
+ - `status` must be `published`
213
+
214
+ ### Runtime scaffold is outdated
215
+
216
+ Run:
217
+
218
+ ```bash
219
+ npx docsprout upgrade
220
+ ```
221
+
222
+ ## License
223
+
224
+ MIT