@clidey/dory 0.22.0 → 0.24.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.
Files changed (188) hide show
  1. package/bin/dist/dory.d.ts +3 -0
  2. package/bin/dist/dory.d.ts.map +1 -0
  3. package/bin/dist/dory.js +337 -0
  4. package/bin/dist/dory.js.map +1 -0
  5. package/bin/dory.ts +287 -121
  6. package/dist/dory.json +5 -0
  7. package/dist/favicon.svg +1 -1
  8. package/dist/index.html +6 -6
  9. package/dist/introduction.mdx +2 -2
  10. package/dist/llms.txt +2 -2
  11. package/docs/dory.json +5 -0
  12. package/docs/favicon.svg +1 -1
  13. package/docs/introduction.mdx +2 -2
  14. package/package.json +16 -11
  15. package/src/app.css +2 -0
  16. package/src/components/dropdown.tsx +30 -26
  17. package/src/components/loading.tsx +6 -8
  18. package/src/components/navigation.tsx +8 -6
  19. package/src/components/notification.tsx +9 -93
  20. package/src/components/routes.tsx +1 -1
  21. package/src/components/search.tsx +31 -104
  22. package/src/components/store.ts +4 -1
  23. package/src/main.tsx +9 -5
  24. package/src/mdx/accordion.tsx +21 -28
  25. package/src/mdx/api-playground.tsx +68 -83
  26. package/src/mdx/api.tsx +21 -21
  27. package/src/mdx/async-api.tsx +15 -31
  28. package/src/mdx/callout.tsx +27 -43
  29. package/src/mdx/card.tsx +20 -14
  30. package/src/mdx/code.tsx +26 -26
  31. package/src/mdx/expandable.tsx +21 -25
  32. package/src/mdx/fence.tsx +2 -2
  33. package/src/mdx/list.tsx +2 -2
  34. package/src/mdx/open-api.tsx +31 -45
  35. package/src/mdx/table.tsx +8 -3
  36. package/src/mdx/tag.tsx +27 -40
  37. package/src/mdx/text.tsx +3 -2
  38. package/src/mdx/websocket-playground.tsx +150 -81
  39. package/src/theme.scss +50 -106
  40. package/src/types/config.ts +47 -0
  41. package/src/ui/header.tsx +12 -9
  42. package/src/ui/layout.tsx +5 -4
  43. package/src/ui/mobile-navigation.tsx +36 -63
  44. package/src/ui/table-of-content.tsx +3 -3
  45. package/src/utils/colors.ts +54 -0
  46. package/src/utils/fonts.ts +4 -1
  47. package/tsconfig.app.json +2 -1
  48. package/tsconfig.bin.json +11 -7
  49. package/tsconfig.node.json +2 -1
  50. package/vite.config.ts +2 -0
  51. package/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  52. package/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  53. package/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  54. package/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  55. package/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  56. package/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  57. package/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  58. package/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  59. package/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  60. package/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  61. package/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  62. package/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  63. package/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  64. package/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  65. package/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  66. package/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  67. package/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  68. package/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  69. package/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  70. package/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  71. package/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  72. package/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  73. package/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  74. package/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  75. package/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  76. package/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  77. package/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  78. package/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  79. package/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  80. package/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  81. package/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  82. package/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  83. package/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  84. package/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  85. package/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  86. package/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  87. package/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  88. package/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  89. package/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  90. package/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  91. package/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  92. package/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  93. package/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  94. package/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  95. package/dist/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  96. package/dist/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  97. package/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  98. package/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  99. package/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  100. package/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  101. package/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  102. package/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  103. package/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  104. package/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  105. package/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  106. package/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  107. package/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  108. package/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  109. package/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  110. package/dist/assets/__vite-browser-external-BIHI7g3E.js +0 -1
  111. package/dist/assets/_basePickBy-CsnA5_xx.js +0 -1
  112. package/dist/assets/_baseUniq-COwFna6s.js +0 -1
  113. package/dist/assets/api-playground-demo-Ct5XK2u1.js +0 -45
  114. package/dist/assets/api-playground-demo-vBae5R-d.js +0 -119
  115. package/dist/assets/arc-Dy4kITED.js +0 -1
  116. package/dist/assets/architectureDiagram-IEHRJDOE-BiaWQpzt.js +0 -36
  117. package/dist/assets/blockDiagram-JOT3LUYC-7LfUOsM7.js +0 -121
  118. package/dist/assets/c4Diagram-VJAJSXHY-Ca-3deDF.js +0 -10
  119. package/dist/assets/channel-j6jMzwSu.js +0 -1
  120. package/dist/assets/chunk-4BMEZGHF-Cln31Q_z.js +0 -1
  121. package/dist/assets/chunk-A2AXSNBT-Cj4U7K4I.js +0 -164
  122. package/dist/assets/chunk-AEK57VVT-1kn9120k.js +0 -220
  123. package/dist/assets/chunk-D6G4REZN-DMgQaOLS.js +0 -1
  124. package/dist/assets/chunk-RZ5BOZE2-DDd-DrSb.js +0 -1
  125. package/dist/assets/chunk-XZIHB7SX-sVdgMrEr.js +0 -1
  126. package/dist/assets/classDiagram-GIVACNV2-B9ObtIrc.js +0 -1
  127. package/dist/assets/classDiagram-v2-COTLJTTW-B9ObtIrc.js +0 -1
  128. package/dist/assets/clone-UOttdbrS.js +0 -1
  129. package/dist/assets/create-D-Wjvs-T.js +0 -6
  130. package/dist/assets/create-DpzlgYHc.js +0 -4
  131. package/dist/assets/cytoscape.esm-BY7v1xhs.js +0 -331
  132. package/dist/assets/dagre-OKDRZEBW-C4q12sCc.js +0 -4
  133. package/dist/assets/delete-DwAmDeAN.js +0 -4
  134. package/dist/assets/delete-cbziNMWs.js +0 -5
  135. package/dist/assets/diagram-SSKATNLV-BxNC6sGs.js +0 -43
  136. package/dist/assets/diagram-VNBRO52H-CukGDk3b.js +0 -24
  137. package/dist/assets/dory.jpeg +0 -0
  138. package/dist/assets/erDiagram-Q7BY3M3F-TiiVq0dv.js +0 -60
  139. package/dist/assets/favicon-Z67lNtJu.svg +0 -75
  140. package/dist/assets/features-6EEoDloV.js +0 -269
  141. package/dist/assets/features-EZwrzTnN.js +0 -441
  142. package/dist/assets/flowDiagram-4HSFHLVR-DykkGbol.js +0 -161
  143. package/dist/assets/ganttDiagram-APWFNJXF-Bqp95-S3.js +0 -257
  144. package/dist/assets/get-BeAg4Qrr.js +0 -5
  145. package/dist/assets/get-Dj1eDs2i.js +0 -4
  146. package/dist/assets/gitGraphDiagram-7IBYFJ6S-BiYVs9VI.js +0 -65
  147. package/dist/assets/graph-LkKKMaDZ.js +0 -1
  148. package/dist/assets/index-CGd7uPvh.css +0 -1
  149. package/dist/assets/index-vOROtq-e.js +0 -9596
  150. package/dist/assets/infoDiagram-PH2N3AL5-EA7h3wZa.js +0 -2
  151. package/dist/assets/init-Gi6I4Gst.js +0 -1
  152. package/dist/assets/introduction-CzXlzjWa.js +0 -38
  153. package/dist/assets/introduction-ylYJcPz3.js +0 -45
  154. package/dist/assets/journeyDiagram-U35MCT3I-BZiVuCZu.js +0 -138
  155. package/dist/assets/kanban-definition-NDS4AKOZ-SCdQ8OjR.js +0 -88
  156. package/dist/assets/layout-C9-9-M2q.js +0 -1
  157. package/dist/assets/linear-CTbdhYd1.js +0 -1
  158. package/dist/assets/mermaid.core-DUFqLK_I.js +0 -213
  159. package/dist/assets/mindmap-definition-ALO5MXBD-BPbKEbjk.js +0 -95
  160. package/dist/assets/ordinal-Cboi1Yqb.js +0 -1
  161. package/dist/assets/pieDiagram-IB7DONF6-DPg1sNm8.js +0 -30
  162. package/dist/assets/quadrantDiagram-7GDLP6J5-DmtJM50d.js +0 -7
  163. package/dist/assets/radar-MK3ICKWK-DnO5LA4B.js +0 -128
  164. package/dist/assets/receive-chat-message-B2jsY1P6.js +0 -4
  165. package/dist/assets/receive-chat-message-BeaC4eqS.js +0 -5
  166. package/dist/assets/receive-notifications-BouRLPFj.js +0 -4
  167. package/dist/assets/receive-notifications-DYnXRRBz.js +0 -5
  168. package/dist/assets/receive-presence-update-CRgeSUpk.js +0 -5
  169. package/dist/assets/receive-presence-update-UEm47KAG.js +0 -4
  170. package/dist/assets/requirementDiagram-KVF5MWMF-iNwUJLq2.js +0 -64
  171. package/dist/assets/sankeyDiagram-QLVOVGJD-DWLyAD59.js +0 -10
  172. package/dist/assets/send-chat-message-Bvf2XJiv.js +0 -5
  173. package/dist/assets/send-chat-message-FDmVETeD.js +0 -4
  174. package/dist/assets/send-presence-update-26clGQ0z.js +0 -5
  175. package/dist/assets/send-presence-update-DeywSKYu.js +0 -4
  176. package/dist/assets/sequenceDiagram-X6HHIX6F-HyRN2_g-.js +0 -122
  177. package/dist/assets/stateDiagram-DGXRK772-DdMr0V93.js +0 -1
  178. package/dist/assets/stateDiagram-v2-YXO3MK2T-D6kpXRiR.js +0 -1
  179. package/dist/assets/timeline-definition-BDJGKUSR-CDf8nWgC.js +0 -61
  180. package/dist/assets/update-BEeNDeXY.js +0 -4
  181. package/dist/assets/update-CykJMYvN.js +0 -5
  182. package/dist/assets/websocket-playground-demo-4pj7mj19.js +0 -135
  183. package/dist/assets/websocket-playground-demo-F71LN60e.js +0 -61
  184. package/dist/assets/xychartDiagram-VJFVF3MP-BY_uTq9r.js +0 -7
  185. package/docs/assets/dory.jpeg +0 -0
  186. package/src/components/dark-mode-toggle.tsx +0 -25
  187. package/src/index.css +0 -24
  188. package/src/utils/hooks.ts +0 -46
package/bin/dory.ts CHANGED
@@ -1,6 +1,5 @@
1
- #!/usr/bin/env -S npx tsx
1
+ #!/usr/bin/env node
2
2
 
3
- // @ts-nocheck - gang
4
3
  import { execSync } from 'child_process';
5
4
  import { existsSync, rmSync, mkdirSync, cpSync, readFileSync, readdirSync } from 'fs';
6
5
  import { resolve, dirname } from 'path';
@@ -11,95 +10,220 @@ import sirv from 'sirv';
11
10
  const __filename = fileURLToPath(import.meta.url);
12
11
  const __dirname = dirname(__filename);
13
12
 
13
+ // Get the root directory of the Dory package
14
+ const getDoryRoot = (): string => {
15
+ // In development: bin/dory.ts -> root is parent
16
+ // In production: bin/dist/dory.js -> root is parent of parent
17
+ const isDevelopment = __dirname.endsWith('bin');
18
+ return isDevelopment ? resolve(__dirname, '..') : resolve(__dirname, '..', '..');
19
+ };
20
+
21
+ // Get the user's current working directory
22
+ const getUserRoot = (): string => process.cwd();
23
+
24
+ interface DoryConfig {
25
+ name?: string;
26
+ description?: string;
27
+ navigation?: unknown;
28
+ [key: string]: unknown;
29
+ }
30
+
31
+ const validateDoryConfig = (config: DoryConfig): void => {
32
+ if (!config || typeof config !== 'object') {
33
+ throw new Error('Configuration must be a valid object');
34
+ }
35
+ // Add more validation as needed
36
+ };
37
+
14
38
  const commands = {
15
39
  build: () => {
16
40
  console.log('🐟 Dory is ready to build your docs!');
17
-
18
- // Clear the docs folder if it exists
19
- const docsDir = resolve(__dirname, '..', 'docs');
20
- if (existsSync(docsDir)) {
21
- console.log('🧹 Tidying up the workspace...');
22
- rmSync(docsDir, { recursive: true, force: true });
23
- }
24
-
25
- // Check if dory.json exists in current directory
26
- const currentDir = process.cwd();
27
- const doryConfigPath = resolve(currentDir, 'dory.json');
28
-
41
+
42
+ const userRoot = getUserRoot();
43
+ const doryRoot = getDoryRoot();
44
+ const doryConfigPath = resolve(userRoot, 'dory.json');
45
+ const tempDocsDir = resolve(doryRoot, 'docs');
46
+ const doryDistDir = resolve(doryRoot, 'dist');
47
+ const userDistDir = resolve(userRoot, 'dist');
48
+
49
+ // Step 1: Validate prerequisites before making any changes
50
+ console.log('🔍 Validating project structure...');
51
+
29
52
  if (!existsSync(doryConfigPath)) {
30
- console.error('❌ Oops! dory.json is missing from your project');
53
+ console.error('❌ dory.json not found in current directory');
54
+ console.error(` Looking for: ${doryConfigPath}`);
55
+ console.error(' Create a dory.json file to configure your documentation site');
31
56
  process.exit(1);
32
57
  }
33
-
58
+
34
59
  // Read and validate dory.json
60
+ let config: DoryConfig;
35
61
  try {
36
- const config = JSON.parse(readFileSync(doryConfigPath, 'utf8'));
37
- console.log(`📋 Building: ${config.name || 'Your awesome project'}`);
62
+ const configContent = readFileSync(doryConfigPath, 'utf8');
63
+ config = JSON.parse(configContent) as DoryConfig;
64
+ validateDoryConfig(config);
65
+ console.log(`📋 Building: ${config.name || 'Documentation'}`);
38
66
  } catch (error) {
39
- console.error('❌ Your dory.json seems to have some issues:', error.message);
40
- process.exit(1);
41
- }
42
-
43
- mkdirSync(docsDir, { recursive: true });
44
-
45
- console.log('📁 Gathering your project files...');
46
- cpSync(doryConfigPath, resolve(docsDir, 'dory.json'));
47
-
48
- const copyFiles = (src, dest) => {
49
- if (existsSync(src)) {
50
- if (existsSync(dest)) {
51
- rmSync(dest, { recursive: true, force: true });
52
- }
53
- cpSync(src, dest, { recursive: true });
54
- }
55
- };
56
-
57
- // Copy all files and directories except node_modules, dist, and .git
58
- const excludeDirs = ['node_modules', 'dist', '.git', 'docs', 'pnpm-lock.yaml'];
59
-
60
- const items = readdirSync(currentDir);
61
- for (const item of items) {
62
- if (!excludeDirs.includes(item)) {
63
- const srcPath = resolve(currentDir, item);
64
- const destPath = resolve(docsDir, item);
65
- copyFiles(srcPath, destPath);
67
+ console.error('❌ Failed to parse dory.json:');
68
+ if (error instanceof Error) {
69
+ console.error(` ${error.message}`);
66
70
  }
71
+ process.exit(1);
67
72
  }
68
-
69
- console.log('✅ All files gathered successfully!');
70
-
71
- // Run the build command
72
- console.log('⚡ Magic is happening...');
73
+
74
+ // Check if pnpm is available
73
75
  try {
74
- execSync('npm run build', { stdio: 'inherit', cwd: __dirname });
75
- } catch (error) {
76
- console.error('❌ Build failed:', error.message);
76
+ execSync('pnpm --version', { stdio: 'ignore' });
77
+ } catch {
78
+ console.error('❌ pnpm is not installed');
79
+ console.error(' Install it with: npm install -g pnpm');
77
80
  process.exit(1);
78
81
  }
79
-
80
- // Check if dist folder was created
81
- const distDir = resolve(__dirname, '..', 'dist');
82
- if (existsSync(distDir)) {
82
+
83
+ // Step 2: Clean up temp directories
84
+ console.log('🧹 Preparing workspace...');
85
+ if (existsSync(tempDocsDir)) {
86
+ rmSync(tempDocsDir, { recursive: true, force: true });
87
+ }
88
+
89
+ try {
90
+ // Step 3: Copy user files to temp docs directory
91
+ mkdirSync(tempDocsDir, { recursive: true });
92
+
93
+ console.log('📁 Gathering project files...');
94
+
95
+ // Define files/dirs to exclude
96
+ const excludeItems = new Set([
97
+ 'node_modules',
98
+ 'dist',
99
+ '.git',
100
+ '.github',
101
+ 'docs',
102
+ '.DS_Store',
103
+ '.env',
104
+ '.env.local',
105
+ 'pnpm-lock.yaml',
106
+ 'package-lock.json',
107
+ 'yarn.lock'
108
+ ]);
109
+
110
+ const items = readdirSync(userRoot);
111
+ let copiedCount = 0;
112
+
113
+ for (const item of items) {
114
+ if (excludeItems.has(item)) {
115
+ continue;
116
+ }
117
+
118
+ const srcPath = resolve(userRoot, item);
119
+ const destPath = resolve(tempDocsDir, item);
120
+
121
+ try {
122
+ cpSync(srcPath, destPath, { recursive: true, force: true });
123
+ copiedCount++;
124
+ } catch (error) {
125
+ console.warn(`⚠️ Could not copy ${item}: ${error instanceof Error ? error.message : 'unknown error'}`);
126
+ }
127
+ }
128
+
129
+ console.log(`✅ Copied ${copiedCount} items`);
130
+
131
+ // Step 4: Run the build
132
+ console.log('⚡ Building documentation...');
133
+
134
+ try {
135
+ execSync('pnpm run build', {
136
+ stdio: 'inherit',
137
+ cwd: doryRoot,
138
+ env: { ...process.env }
139
+ });
140
+ } catch (error) {
141
+ console.error('❌ Build failed');
142
+ console.error(' Check the error messages above for details');
143
+ throw error;
144
+ }
145
+
146
+ // Step 5: Verify build output
147
+ console.log('🔍 Verifying build output...');
148
+
149
+ if (!existsSync(doryDistDir)) {
150
+ console.error('❌ Build completed but dist folder was not created');
151
+ console.error(` Expected: ${doryDistDir}`);
152
+ process.exit(1);
153
+ }
154
+
155
+ const indexHtml = resolve(doryDistDir, 'index.html');
156
+ if (!existsSync(indexHtml)) {
157
+ console.error('❌ Build incomplete: index.html not found');
158
+ console.error(' The build may have failed silently');
159
+ process.exit(1);
160
+ }
161
+
162
+ // Check if dist has content
163
+ const distFiles = readdirSync(doryDistDir);
164
+ if (distFiles.length === 0) {
165
+ console.error('❌ Build completed but dist folder is empty');
166
+ process.exit(1);
167
+ }
168
+
83
169
  console.log('🎉 Build completed successfully!');
84
- console.log('📦 Moving your docs to the right place...');
85
- cpSync(distDir, resolve(currentDir, 'dist'), { recursive: true });
86
- console.log('✨ Your docs are ready in the dist folder!');
87
- } else {
88
- console.log('⚠️ Build completed but no output found');
170
+
171
+ // Step 6: Copy dist to user's directory
172
+ console.log('📦 Copying build output...');
173
+
174
+ // Only copy if they're different directories
175
+ if (doryDistDir !== userDistDir) {
176
+ if (existsSync(userDistDir)) {
177
+ rmSync(userDistDir, { recursive: true, force: true });
178
+ }
179
+ cpSync(doryDistDir, userDistDir, { recursive: true, force: true });
180
+ }
181
+
182
+ console.log('✨ Documentation ready in dist/');
183
+
184
+ } finally {
185
+ // Step 7: Always clean up temp directories
186
+ console.log('🧹 Cleaning up...');
187
+
188
+ try {
189
+ if (existsSync(tempDocsDir)) {
190
+ rmSync(tempDocsDir, { recursive: true, force: true });
191
+ }
192
+ // Only clean up doryDistDir if it's different from userDistDir
193
+ // (in production they're different, in dev they might be the same)
194
+ if (doryDistDir !== userDistDir && existsSync(doryDistDir)) {
195
+ rmSync(doryDistDir, { recursive: true, force: true });
196
+ }
197
+ } catch (error) {
198
+ console.warn('⚠️ Could not clean up temp directories');
199
+ }
200
+
201
+ console.log('✅ Done!');
89
202
  }
90
- rmSync(distDir, { recursive: true, force: true });
91
-
92
- // Revert docs folder back to original state
93
- console.log('🧹 Cleaning up...');
94
- rmSync(docsDir, { recursive: true, force: true });
95
- console.log('✅ All done!');
96
203
  },
97
204
 
98
205
  preview: () => {
99
- console.log('👀 Starting your docs preview...');
100
- const currentDir = process.cwd();
101
- const distDir = resolve(currentDir, 'dist');
102
- const port = process.env.PORT || 3000;
206
+ console.log('👀 Starting docs preview...');
207
+
208
+ const userRoot = getUserRoot();
209
+ const distDir = resolve(userRoot, 'dist');
210
+ let port = parseInt(process.env.PORT || '3000', 10);
211
+
212
+ // Validate dist folder exists
213
+ if (!existsSync(distDir)) {
214
+ console.error('❌ dist folder not found');
215
+ console.error(` Looking for: ${distDir}`);
216
+ console.error(' Run "dory build" first to generate the documentation');
217
+ process.exit(1);
218
+ }
219
+
220
+ // Check if dist has content
221
+ const distFiles = readdirSync(distDir);
222
+ if (distFiles.length === 0) {
223
+ console.error('❌ dist folder is empty');
224
+ console.error(' Run "dory build" to generate documentation');
225
+ process.exit(1);
226
+ }
103
227
 
104
228
  const serve = sirv(distDir, {
105
229
  dev: false,
@@ -113,25 +237,40 @@ const commands = {
113
237
  serve(req, res);
114
238
  });
115
239
 
116
- server.listen(port, () => {
117
- console.log(`🚀 Your docs are live at http://localhost:${port}`);
118
- });
240
+ const tryPort = (currentPort: number): void => {
241
+ server.listen(currentPort)
242
+ .on('listening', () => {
243
+ console.log(`🚀 Documentation live at http://localhost:${currentPort}`);
244
+ console.log(' Press Ctrl+C to stop the server');
245
+ })
246
+ .on('error', (err: NodeJS.ErrnoException) => {
247
+ if (err.code === 'EADDRINUSE') {
248
+ console.log(`⚠️ Port ${currentPort} in use, trying ${currentPort + 1}...`);
249
+ tryPort(currentPort + 1);
250
+ } else {
251
+ console.error('❌ Failed to start server:', err.message);
252
+ process.exit(1);
253
+ }
254
+ });
255
+ };
256
+
257
+ tryPort(port);
119
258
  },
120
259
 
121
260
  'verify:content': async () => {
122
261
  const args = process.argv.slice(3);
123
262
  let content = '';
124
263
  let fileName = '';
125
-
264
+
126
265
  // Parse arguments
127
266
  for (let i = 0; i < args.length; i++) {
128
267
  if (args[i] === '--content' && i + 1 < args.length) {
129
268
  content = args[i + 1];
130
269
  break;
131
270
  } else if (args[i] === '--file' && i + 1 < args.length) {
132
- const filePath = args[i + 1];
271
+ const filePath = resolve(getUserRoot(), args[i + 1]);
133
272
  if (!existsSync(filePath)) {
134
- console.error(`❌ Error: File not found: ${filePath}`);
273
+ console.error(`❌ File not found: ${filePath}`);
135
274
  process.exit(1);
136
275
  }
137
276
  content = readFileSync(filePath, 'utf8');
@@ -139,88 +278,115 @@ const commands = {
139
278
  break;
140
279
  }
141
280
  }
142
-
281
+
143
282
  if (!content) {
144
- console.error('❌ Error: --content or --file argument is required');
145
- console.log('Usage: dory verify:content --content "<mdx-content>" | --file <path-to-mdx-file>');
283
+ console.error('❌ --content or --file argument is required');
284
+ console.log('Usage:');
285
+ console.log(' dory verify:content --content "<mdx-content>"');
286
+ console.log(' dory verify:content --file <path-to-mdx-file>');
146
287
  process.exit(1);
147
288
  }
148
-
289
+
149
290
  try {
291
+ const doryRoot = getDoryRoot();
292
+ const processorPath = resolve(doryRoot, 'src', 'mdx', 'processor.ts');
293
+
294
+ if (!existsSync(processorPath)) {
295
+ console.error('❌ MDX processor not found');
296
+ console.error(' This feature requires Dory source files');
297
+ process.exit(1);
298
+ }
299
+
150
300
  // Use the shared MDX processor that matches the main build exactly
151
- const { verifyMdxContent } = await import('../src/mdx/processor.ts');
301
+ const { verifyMdxContent } = await import(processorPath);
152
302
  const result = await verifyMdxContent(content, fileName);
153
-
303
+
154
304
  if (!result.valid) {
155
305
  throw result.error;
156
306
  }
157
-
307
+
158
308
  // Silent success - no output means no errors
159
-
309
+
160
310
  } catch (error) {
161
311
  console.error('❌ MDX compilation failed:');
162
- console.error(error.message);
163
-
164
- // Provide more detailed error information if available
165
- if (error.line !== undefined && error.column !== undefined) {
166
- console.error(` at line ${error.line}, column ${error.column}`);
167
- }
168
- if (error.source) {
169
- console.error(' Source:', error.source);
312
+ if (error instanceof Error) {
313
+ console.error(` ${error.message}`);
314
+
315
+ // Provide more detailed error information if available
316
+ const errorWithPosition = error as Error & { line?: number; column?: number; source?: string };
317
+ if (errorWithPosition.line !== undefined && errorWithPosition.column !== undefined) {
318
+ console.error(` at line ${errorWithPosition.line}, column ${errorWithPosition.column}`);
319
+ }
320
+ if (errorWithPosition.source) {
321
+ console.error(' Source:', errorWithPosition.source);
322
+ }
170
323
  }
171
-
324
+
172
325
  process.exit(1);
173
326
  }
174
327
  },
175
328
 
176
329
  help: () => {
177
330
  console.log(`
178
- 🐟 Dory CLI - Your Friendly Documentation Builder
331
+ 🐟 Dory CLI - Documentation Builder
179
332
 
180
333
  Usage:
181
- dory <command>
334
+ dory <command> [options]
182
335
 
183
336
  Commands:
184
- build Build your documentation site
185
- - Needs dory.json in your project
186
- - Creates a beautiful dist folder
187
-
188
- verify:content Verify that MDX content compiles without errors
189
- - Silent on success, shows errors on failure
190
- - Uses the same preprocessing as the main build
191
- - Accepts --content or --file arguments
192
-
193
- preview Preview your built documentation
194
- - Shows your docs in the browser
195
- - Run build first!
196
-
197
- help Show this help message
337
+ build Build your documentation site
338
+ Requirements: dory.json in current directory
339
+ Output: dist/ folder with static site
340
+
341
+ preview Preview built documentation
342
+ Requirements: dist/ folder (run build first)
343
+ Starts local server on port 3000
344
+
345
+ verify:content Verify MDX content compilation
346
+ Options: --content "<mdx>" or --file <path>
347
+ Silent on success, shows errors on failure
348
+
349
+ help Show this help message
198
350
 
199
351
  Examples:
200
- dory build # Build your docs
201
- dory verify:content --content "# Hello World" # Verify MDX content
202
- dory verify:content --file content.mdx # Verify MDX from file
203
- dory preview # Preview your docs
352
+ dory build
353
+ dory preview
354
+ dory verify:content --content "# Hello World"
355
+ dory verify:content --file docs/intro.mdx
356
+
357
+ For more information, visit: https://github.com/clidey/dory
204
358
  `);
205
359
  }
206
360
  };
207
361
 
362
+ type CommandName = keyof typeof commands;
363
+
208
364
  // Parse command line arguments
209
365
  const command = process.argv[2];
210
366
 
211
- async function runCommand() {
367
+ async function runCommand(): Promise<void> {
212
368
  if (!command || command === 'help' || command === '--help' || command === '-h') {
213
369
  commands.help();
214
- } else if (commands[command]) {
215
- await commands[command]();
370
+ return;
371
+ }
372
+
373
+ if (command in commands) {
374
+ await commands[command as CommandName]();
216
375
  } else {
217
376
  console.error(`❌ Unknown command: ${command}`);
218
- console.log('Run "dory help" for usage information');
377
+ console.log(' Run "dory help" for available commands');
219
378
  process.exit(1);
220
379
  }
221
380
  }
222
381
 
223
- runCommand().catch((error) => {
224
- console.error('❌ Command failed:', error.message);
382
+ runCommand().catch((error: unknown) => {
383
+ console.error('❌ Command failed');
384
+ if (error instanceof Error) {
385
+ console.error(` ${error.message}`);
386
+ if (error.stack && process.env.DEBUG) {
387
+ console.error('\nStack trace:');
388
+ console.error(error.stack);
389
+ }
390
+ }
225
391
  process.exit(1);
226
392
  });
package/dist/dory.json CHANGED
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "name": "Docucod",
3
3
  "favicon": "./favicon.svg",
4
+ "colors": {
5
+ "primary": "#0ea5e9",
6
+ "light": "#0C8BC6",
7
+ "dark": "#0284c7"
8
+ },
4
9
  "fonts": {
5
10
  "family": "Montserrat",
6
11
  "source": "https://fonts.gstatic.com/s/googlesansflex/v5/t5sJIQcYNIWbFgDgAAzZ34auoVyXkJCOvp3SFWJbN5hF8Ju1x6sKCyp0l9sI40swNJwGpVd4AZzz0v6lJ4qFXNZhGjLvDSkV4USKMo6qQzwliVdHAy9jxTDHg_ugnAakpwGc-cxgUqDCIUI.woff2",
package/dist/favicon.svg CHANGED
@@ -8,7 +8,7 @@
8
8
  version="1.1"
9
9
  id="svg1"
10
10
  inkscape:version="1.4 (e7c3feb1, 2024-10-09)"
11
- sodipodi:docname="docucod-logo.svg"
11
+ sodipodi:docname="dory-logo.svg"
12
12
  xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
13
13
  xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
14
14
  xmlns="http://www.w3.org/2000/svg"
package/dist/index.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="utf-8" />
5
- <link rel="icon" href="/assets/favicon-Z67lNtJu.svg" />
5
+ <link rel="icon" href="/assets/favicon-nLquwUQp.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1" />
7
7
  <meta name="theme-color" content="#000000" />
8
8
 
@@ -15,7 +15,7 @@
15
15
  <!-- Open Graph / Facebook -->
16
16
  <meta property="og:title" content="Docucod: Generate and Maintain Documentation With No Work" />
17
17
  <meta property="og:description" content="Docucod auto-generates and maintains up-to-date documentation from your codebase so your team can move fast, onboard quickly, and stay focused on building." />
18
- <meta property="og:image" content="/assets/favicon-Z67lNtJu.svg" />
18
+ <meta property="og:image" content="/assets/favicon-nLquwUQp.svg" />
19
19
  <meta property="og:url" content="https://docucod.com/" />
20
20
  <meta property="og:type" content="website" />
21
21
  <meta property="og:site_name" content="Docucod" />
@@ -25,11 +25,11 @@
25
25
  <meta name="twitter:card" content="summary_large_image" />
26
26
  <meta name="twitter:title" content="Docucod: Generate and Maintain Documentation With No Work" />
27
27
  <meta name="twitter:description" content="Docucod auto-generates and maintains up-to-date documentation from your codebase so your team can move fast, onboard quickly, and stay focused on building." />
28
- <meta name="twitter:image" content="/assets/favicon-Z67lNtJu.svg" />
28
+ <meta name="twitter:image" content="/assets/favicon-nLquwUQp.svg" />
29
29
  <meta name="twitter:site" content="@ClideyOfficial" />
30
30
  <meta name="twitter:creator" content="@ClideyOfficial" />
31
31
 
32
- <link rel="apple-touch-icon" href="/assets/favicon-Z67lNtJu.svg" />
32
+ <link rel="apple-touch-icon" href="/assets/favicon-nLquwUQp.svg" />
33
33
  <link rel="manifest" href="/manifest.json" />
34
34
 
35
35
  <title>Docucod - Instantly Generate and Maintain Your Documentation</title>
@@ -45,8 +45,8 @@
45
45
  person_profiles: 'identified_only', // or 'always' to create profiles for anonymous users as well
46
46
  })
47
47
  </script>
48
- <script type="module" crossorigin src="/assets/index-vOROtq-e.js"></script>
49
- <link rel="stylesheet" crossorigin href="/assets/index-CGd7uPvh.css">
48
+ <script type="module" crossorigin src="/assets/index-CrsN5P5J.js"></script>
49
+ <link rel="stylesheet" crossorigin href="/assets/index-DfQ0BTd7.css">
50
50
  </head>
51
51
  <body>
52
52
  <noscript>You need to enable JavaScript to run this app.</noscript>
@@ -10,7 +10,7 @@ description: 'Welcome to Docucod and Dory documentation'
10
10
  This documentation is powered by two complementary tools:
11
11
 
12
12
  1. **Docucod** - An AI-powered documentation assistant that automatically generates and maintains documentation
13
- 2. **Dory** - A lightweight static site generator specifically designed to deploy Docucod-generated documentation
13
+ 2. **Dory** - A lightweight static site generator specifically designed to deploy dory-generated documentation
14
14
 
15
15
  ## What is Docucod?
16
16
 
@@ -22,7 +22,7 @@ Docucod analyzes your codebase and automatically:
22
22
 
23
23
  ## What is Dory?
24
24
 
25
- Dory is a lightweight static site generator built for developers who want fast, clean, and customizable documentation. It was created specifically to deploy Docucod-generated documentation with:
25
+ Dory is a lightweight static site generator built for developers who want fast, clean, and customizable documentation. It was created specifically to deploy dory-generated documentation with:
26
26
 
27
27
  - 🧠 **Simple** — Drop in `.mdx` files and configure one `dory.json`
28
28
  - ⚡ **Fast** — Instant hot reload in dev, quick static builds for prod
package/dist/llms.txt CHANGED
@@ -10,7 +10,7 @@ Welcome to Docucod and Dory documentation
10
10
  This documentation is powered by two complementary tools:
11
11
 
12
12
  1. **Docucod** - An AI-powered documentation assistant that automatically generates and maintains documentation
13
- 2. **Dory** - A lightweight static site generator specifically designed to deploy Docucod-generated documentation
13
+ 2. **Dory** - A lightweight static site generator specifically designed to deploy dory-generated documentation
14
14
 
15
15
  ## What is Docucod?
16
16
 
@@ -22,7 +22,7 @@ Docucod analyzes your codebase and automatically:
22
22
 
23
23
  ## What is Dory?
24
24
 
25
- Dory is a lightweight static site generator built for developers who want fast, clean, and customizable documentation. It was created specifically to deploy Docucod-generated documentation with:
25
+ Dory is a lightweight static site generator built for developers who want fast, clean, and customizable documentation. It was created specifically to deploy dory-generated documentation with:
26
26
 
27
27
  - 🧠 **Simple** — Drop in `.mdx` files and configure one `dory.json`
28
28
  - ⚡ **Fast** — Instant hot reload in dev, quick static builds for prod
package/docs/dory.json CHANGED
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "name": "Docucod",
3
3
  "favicon": "./favicon.svg",
4
+ "colors": {
5
+ "primary": "#0ea5e9",
6
+ "light": "#0C8BC6",
7
+ "dark": "#0284c7"
8
+ },
4
9
  "fonts": {
5
10
  "family": "Montserrat",
6
11
  "source": "https://fonts.gstatic.com/s/googlesansflex/v5/t5sJIQcYNIWbFgDgAAzZ34auoVyXkJCOvp3SFWJbN5hF8Ju1x6sKCyp0l9sI40swNJwGpVd4AZzz0v6lJ4qFXNZhGjLvDSkV4USKMo6qQzwliVdHAy9jxTDHg_ugnAakpwGc-cxgUqDCIUI.woff2",
package/docs/favicon.svg CHANGED
@@ -8,7 +8,7 @@
8
8
  version="1.1"
9
9
  id="svg1"
10
10
  inkscape:version="1.4 (e7c3feb1, 2024-10-09)"
11
- sodipodi:docname="docucod-logo.svg"
11
+ sodipodi:docname="dory-logo.svg"
12
12
  xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
13
13
  xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
14
14
  xmlns="http://www.w3.org/2000/svg"
@@ -10,7 +10,7 @@ description: 'Welcome to Docucod and Dory documentation'
10
10
  This documentation is powered by two complementary tools:
11
11
 
12
12
  1. **Docucod** - An AI-powered documentation assistant that automatically generates and maintains documentation
13
- 2. **Dory** - A lightweight static site generator specifically designed to deploy Docucod-generated documentation
13
+ 2. **Dory** - A lightweight static site generator specifically designed to deploy dory-generated documentation
14
14
 
15
15
  ## What is Docucod?
16
16
 
@@ -22,7 +22,7 @@ Docucod analyzes your codebase and automatically:
22
22
 
23
23
  ## What is Dory?
24
24
 
25
- Dory is a lightweight static site generator built for developers who want fast, clean, and customizable documentation. It was created specifically to deploy Docucod-generated documentation with:
25
+ Dory is a lightweight static site generator built for developers who want fast, clean, and customizable documentation. It was created specifically to deploy dory-generated documentation with:
26
26
 
27
27
  - 🧠 **Simple** — Drop in `.mdx` files and configure one `dory.json`
28
28
  - ⚡ **Fast** — Instant hot reload in dev, quick static builds for prod