@clidey/dory 0.23.0 โ†’ 0.27.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 (37) 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 +375 -0
  4. package/bin/dist/dory.js.map +1 -0
  5. package/bin/dory.ts +314 -121
  6. package/dist/index.html +2 -2
  7. package/package.json +6 -4
  8. package/src/components/search.tsx +5 -5
  9. package/src/components/store.ts +1 -1
  10. package/src/mdx/card.tsx +7 -7
  11. package/src/mdx/step.tsx +6 -4
  12. package/src/plugins/docs-assets.ts +79 -0
  13. package/src/theme.scss +5 -1
  14. package/src/ui/header.tsx +1 -1
  15. package/src/ui/table-of-content.tsx +1 -1
  16. package/src/utils/colors.ts +1 -1
  17. package/src/utils/fonts.ts +1 -1
  18. package/tsconfig.app.json +2 -1
  19. package/tsconfig.bin.json +11 -7
  20. package/tsconfig.node.json +2 -1
  21. package/vite.config.ts +6 -1
  22. package/dist/api-playground-demo.mdx +0 -119
  23. package/dist/api-reference/asyncapi.json +0 -324
  24. package/dist/api-reference/openapi.json +0 -366
  25. package/dist/api-reference/operations/create.mdx +0 -5
  26. package/dist/api-reference/operations/delete.mdx +0 -5
  27. package/dist/api-reference/operations/get.mdx +0 -5
  28. package/dist/api-reference/operations/update.mdx +0 -5
  29. package/dist/api-reference/websocket-operations/receive-chat-message.mdx +0 -5
  30. package/dist/api-reference/websocket-operations/receive-notifications.mdx +0 -5
  31. package/dist/api-reference/websocket-operations/receive-presence-update.mdx +0 -5
  32. package/dist/api-reference/websocket-operations/send-chat-message.mdx +0 -5
  33. package/dist/api-reference/websocket-operations/send-presence-update.mdx +0 -5
  34. package/dist/dory.json +0 -64
  35. package/dist/features.mdx +0 -440
  36. package/dist/introduction.mdx +0 -44
  37. package/dist/websocket-playground-demo.mdx +0 -135
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,96 +10,262 @@ 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 docsBackupDir = resolve(doryRoot, '.docs-backup');
47
+ const doryDistDir = resolve(doryRoot, 'dist');
48
+ const userDistDir = resolve(userRoot, 'dist');
49
+
50
+ // Step 1: Validate prerequisites before making any changes
51
+ console.log('๐Ÿ” Validating project structure...');
52
+
29
53
  if (!existsSync(doryConfigPath)) {
30
- console.error('โŒ Oops! dory.json is missing from your project');
54
+ console.error('โŒ dory.json not found in current directory');
55
+ console.error(` Looking for: ${doryConfigPath}`);
56
+ console.error(' Create a dory.json file to configure your documentation site');
31
57
  process.exit(1);
32
58
  }
33
-
59
+
34
60
  // Read and validate dory.json
61
+ let config: DoryConfig;
35
62
  try {
36
- const config = JSON.parse(readFileSync(doryConfigPath, 'utf8'));
37
- console.log(`๐Ÿ“‹ Building: ${config.name || 'Your awesome project'}`);
63
+ const configContent = readFileSync(doryConfigPath, 'utf8');
64
+ config = JSON.parse(configContent) as DoryConfig;
65
+ validateDoryConfig(config);
66
+ console.log(`๐Ÿ“‹ Building: ${config.name || 'Documentation'}`);
38
67
  } 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);
68
+ console.error('โŒ Failed to parse dory.json:');
69
+ if (error instanceof Error) {
70
+ console.error(` ${error.message}`);
66
71
  }
72
+ process.exit(1);
67
73
  }
68
-
69
- console.log('โœ… All files gathered successfully!');
70
-
71
- // Run the build command
72
- console.log('โšก Magic is happening...');
74
+
75
+ // Check if pnpm is available
73
76
  try {
74
- execSync('npm run build', { stdio: 'inherit', cwd: __dirname });
75
- } catch (error) {
76
- console.error('โŒ Build failed:', error.message);
77
+ execSync('pnpm --version', { stdio: 'ignore' });
78
+ } catch {
79
+ console.error('โŒ pnpm is not installed');
80
+ console.error(' Install it with: npm install -g pnpm');
77
81
  process.exit(1);
78
82
  }
79
-
80
- // Check if dist folder was created
81
- const distDir = resolve(__dirname, '..', 'dist');
82
- if (existsSync(distDir)) {
83
+
84
+ // Step 2: Backup existing docs directory if it exists
85
+ console.log('๐Ÿงน Preparing workspace...');
86
+ const docsExistedBefore = existsSync(tempDocsDir);
87
+
88
+ if (docsExistedBefore) {
89
+ console.log('๐Ÿ’พ Backing up existing docs directory...');
90
+ if (existsSync(docsBackupDir)) {
91
+ rmSync(docsBackupDir, { recursive: true, force: true });
92
+ }
93
+ cpSync(tempDocsDir, docsBackupDir, { recursive: true, force: true });
94
+ rmSync(tempDocsDir, { recursive: true, force: true });
95
+ }
96
+
97
+ try {
98
+ // Step 3: Copy user files to temp docs directory
99
+ mkdirSync(tempDocsDir, { recursive: true });
100
+
101
+ console.log('๐Ÿ“ Gathering project files...');
102
+
103
+ // Define files/dirs to exclude
104
+ const excludeItems = new Set([
105
+ 'node_modules',
106
+ 'dist',
107
+ '.git',
108
+ '.github',
109
+ 'docs',
110
+ '.DS_Store',
111
+ '.env',
112
+ '.env.local',
113
+ 'pnpm-lock.yaml',
114
+ 'package-lock.json',
115
+ 'yarn.lock'
116
+ ]);
117
+
118
+ const items = readdirSync(userRoot);
119
+ let copiedCount = 0;
120
+
121
+ for (const item of items) {
122
+ if (excludeItems.has(item)) {
123
+ continue;
124
+ }
125
+
126
+ const srcPath = resolve(userRoot, item);
127
+ const destPath = resolve(tempDocsDir, item);
128
+
129
+ try {
130
+ cpSync(srcPath, destPath, { recursive: true, force: true });
131
+ copiedCount++;
132
+ } catch (error) {
133
+ console.warn(`โš ๏ธ Could not copy ${item}: ${error instanceof Error ? error.message : 'unknown error'}`);
134
+ }
135
+ }
136
+
137
+ console.log(`โœ… Copied ${copiedCount} items`);
138
+
139
+ // Verify critical files exist
140
+ const doryJsonPath = resolve(tempDocsDir, 'dory.json');
141
+ if (!existsSync(doryJsonPath)) {
142
+ console.error('โŒ dory.json was not copied to docs directory');
143
+ console.error(` Expected: ${doryJsonPath}`);
144
+ console.error(' This file is required for the build');
145
+ process.exit(1);
146
+ }
147
+
148
+ // Step 4: Run the build
149
+ console.log('โšก Building documentation...');
150
+
151
+ try {
152
+ execSync('pnpm run build', {
153
+ stdio: 'inherit',
154
+ cwd: doryRoot,
155
+ env: { ...process.env }
156
+ });
157
+ } catch (error) {
158
+ console.error('โŒ Build failed');
159
+ console.error(' Check the error messages above for details');
160
+ throw error;
161
+ }
162
+
163
+ // Step 5: Verify build output
164
+ console.log('๐Ÿ” Verifying build output...');
165
+
166
+ if (!existsSync(doryDistDir)) {
167
+ console.error('โŒ Build completed but dist folder was not created');
168
+ console.error(` Expected: ${doryDistDir}`);
169
+ process.exit(1);
170
+ }
171
+
172
+ const indexHtml = resolve(doryDistDir, 'index.html');
173
+ if (!existsSync(indexHtml)) {
174
+ console.error('โŒ Build incomplete: index.html not found');
175
+ console.error(' The build may have failed silently');
176
+ process.exit(1);
177
+ }
178
+
179
+ // Check if dist has content
180
+ const distFiles = readdirSync(doryDistDir);
181
+ if (distFiles.length === 0) {
182
+ console.error('โŒ Build completed but dist folder is empty');
183
+ process.exit(1);
184
+ }
185
+
83
186
  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');
187
+
188
+ // Step 6: Copy dist to user's directory
189
+ console.log('๐Ÿ“ฆ Copying build output...');
190
+
191
+ // Only copy if they're different directories
192
+ if (doryDistDir !== userDistDir) {
193
+ if (existsSync(userDistDir)) {
194
+ rmSync(userDistDir, { recursive: true, force: true });
195
+ }
196
+ cpSync(doryDistDir, userDistDir, { recursive: true, force: true });
197
+ }
198
+
199
+ console.log('โœจ Documentation ready in dist/');
200
+
201
+ } finally {
202
+ // Step 7: Always clean up temp directories and restore backup
203
+ console.log('๐Ÿงน Cleaning up...');
204
+
205
+ try {
206
+ // Remove the temporary docs directory
207
+ if (existsSync(tempDocsDir)) {
208
+ rmSync(tempDocsDir, { recursive: true, force: true });
209
+ }
210
+
211
+ // Restore the original docs directory if it existed before
212
+ if (docsExistedBefore && existsSync(docsBackupDir)) {
213
+ console.log('๐Ÿ“ฆ Restoring original docs directory...');
214
+ cpSync(docsBackupDir, tempDocsDir, { recursive: true, force: true });
215
+ rmSync(docsBackupDir, { recursive: true, force: true });
216
+ }
217
+
218
+ // Only clean up doryDistDir if it's different from userDistDir
219
+ // (in production they're different, in dev they might be the same)
220
+ if (doryDistDir !== userDistDir && existsSync(doryDistDir)) {
221
+ rmSync(doryDistDir, { recursive: true, force: true });
222
+ }
223
+ } catch (error) {
224
+ console.warn('โš ๏ธ Could not clean up temp directories');
225
+ // Try to restore backup even if cleanup failed
226
+ if (docsExistedBefore && existsSync(docsBackupDir)) {
227
+ console.log('๐Ÿ”„ Attempting to restore backup...');
228
+ try {
229
+ if (existsSync(tempDocsDir)) {
230
+ rmSync(tempDocsDir, { recursive: true, force: true });
231
+ }
232
+ cpSync(docsBackupDir, tempDocsDir, { recursive: true, force: true });
233
+ rmSync(docsBackupDir, { recursive: true, force: true });
234
+ } catch (restoreError) {
235
+ console.error('โŒ Failed to restore docs backup!');
236
+ console.error(` Backup location: ${docsBackupDir}`);
237
+ console.error(' You may need to manually restore your docs directory');
238
+ }
239
+ }
240
+ }
241
+
242
+ console.log('โœ… Done!');
89
243
  }
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
244
  },
97
245
 
98
246
  preview: () => {
99
- console.log('๐Ÿ‘€ Starting your docs preview...');
100
- const currentDir = process.cwd();
101
- const distDir = resolve(currentDir, 'dist');
247
+ console.log('๐Ÿ‘€ Starting docs preview...');
248
+
249
+ const userRoot = getUserRoot();
250
+ const distDir = resolve(userRoot, 'dist');
102
251
  let port = parseInt(process.env.PORT || '3000', 10);
103
252
 
253
+ // Validate dist folder exists
254
+ if (!existsSync(distDir)) {
255
+ console.error('โŒ dist folder not found');
256
+ console.error(` Looking for: ${distDir}`);
257
+ console.error(' Run "dory build" first to generate the documentation');
258
+ process.exit(1);
259
+ }
260
+
261
+ // Check if dist has content
262
+ const distFiles = readdirSync(distDir);
263
+ if (distFiles.length === 0) {
264
+ console.error('โŒ dist folder is empty');
265
+ console.error(' Run "dory build" to generate documentation');
266
+ process.exit(1);
267
+ }
268
+
104
269
  const serve = sirv(distDir, {
105
270
  dev: false,
106
271
  single: true,
@@ -113,14 +278,15 @@ const commands = {
113
278
  serve(req, res);
114
279
  });
115
280
 
116
- const tryPort = (currentPort: number) => {
281
+ const tryPort = (currentPort: number): void => {
117
282
  server.listen(currentPort)
118
283
  .on('listening', () => {
119
- console.log(`๐Ÿš€ Your docs are live at http://localhost:${currentPort}`);
284
+ console.log(`๐Ÿš€ Documentation live at http://localhost:${currentPort}`);
285
+ console.log(' Press Ctrl+C to stop the server');
120
286
  })
121
- .on('error', (err: any) => {
287
+ .on('error', (err: NodeJS.ErrnoException) => {
122
288
  if (err.code === 'EADDRINUSE') {
123
- console.log(`โš ๏ธ Port ${currentPort} is busy, trying ${currentPort + 1}...`);
289
+ console.log(`โš ๏ธ Port ${currentPort} in use, trying ${currentPort + 1}...`);
124
290
  tryPort(currentPort + 1);
125
291
  } else {
126
292
  console.error('โŒ Failed to start server:', err.message);
@@ -136,16 +302,16 @@ const commands = {
136
302
  const args = process.argv.slice(3);
137
303
  let content = '';
138
304
  let fileName = '';
139
-
305
+
140
306
  // Parse arguments
141
307
  for (let i = 0; i < args.length; i++) {
142
308
  if (args[i] === '--content' && i + 1 < args.length) {
143
309
  content = args[i + 1];
144
310
  break;
145
311
  } else if (args[i] === '--file' && i + 1 < args.length) {
146
- const filePath = args[i + 1];
312
+ const filePath = resolve(getUserRoot(), args[i + 1]);
147
313
  if (!existsSync(filePath)) {
148
- console.error(`โŒ Error: File not found: ${filePath}`);
314
+ console.error(`โŒ File not found: ${filePath}`);
149
315
  process.exit(1);
150
316
  }
151
317
  content = readFileSync(filePath, 'utf8');
@@ -153,88 +319,115 @@ const commands = {
153
319
  break;
154
320
  }
155
321
  }
156
-
322
+
157
323
  if (!content) {
158
- console.error('โŒ Error: --content or --file argument is required');
159
- console.log('Usage: dory verify:content --content "<mdx-content>" | --file <path-to-mdx-file>');
324
+ console.error('โŒ --content or --file argument is required');
325
+ console.log('Usage:');
326
+ console.log(' dory verify:content --content "<mdx-content>"');
327
+ console.log(' dory verify:content --file <path-to-mdx-file>');
160
328
  process.exit(1);
161
329
  }
162
-
330
+
163
331
  try {
332
+ const doryRoot = getDoryRoot();
333
+ const processorPath = resolve(doryRoot, 'src', 'mdx', 'processor.ts');
334
+
335
+ if (!existsSync(processorPath)) {
336
+ console.error('โŒ MDX processor not found');
337
+ console.error(' This feature requires Dory source files');
338
+ process.exit(1);
339
+ }
340
+
164
341
  // Use the shared MDX processor that matches the main build exactly
165
- const { verifyMdxContent } = await import('../src/mdx/processor.ts');
342
+ const { verifyMdxContent } = await import(processorPath);
166
343
  const result = await verifyMdxContent(content, fileName);
167
-
344
+
168
345
  if (!result.valid) {
169
346
  throw result.error;
170
347
  }
171
-
348
+
172
349
  // Silent success - no output means no errors
173
-
350
+
174
351
  } catch (error) {
175
352
  console.error('โŒ MDX compilation failed:');
176
- console.error(error.message);
177
-
178
- // Provide more detailed error information if available
179
- if (error.line !== undefined && error.column !== undefined) {
180
- console.error(` at line ${error.line}, column ${error.column}`);
181
- }
182
- if (error.source) {
183
- console.error(' Source:', error.source);
353
+ if (error instanceof Error) {
354
+ console.error(` ${error.message}`);
355
+
356
+ // Provide more detailed error information if available
357
+ const errorWithPosition = error as Error & { line?: number; column?: number; source?: string };
358
+ if (errorWithPosition.line !== undefined && errorWithPosition.column !== undefined) {
359
+ console.error(` at line ${errorWithPosition.line}, column ${errorWithPosition.column}`);
360
+ }
361
+ if (errorWithPosition.source) {
362
+ console.error(' Source:', errorWithPosition.source);
363
+ }
184
364
  }
185
-
365
+
186
366
  process.exit(1);
187
367
  }
188
368
  },
189
369
 
190
370
  help: () => {
191
371
  console.log(`
192
- ๐ŸŸ Dory CLI - Your Friendly Documentation Builder
372
+ ๐ŸŸ Dory CLI - Documentation Builder
193
373
 
194
374
  Usage:
195
- dory <command>
375
+ dory <command> [options]
196
376
 
197
377
  Commands:
198
- build Build your documentation site
199
- - Needs dory.json in your project
200
- - Creates a beautiful dist folder
201
-
202
- verify:content Verify that MDX content compiles without errors
203
- - Silent on success, shows errors on failure
204
- - Uses the same preprocessing as the main build
205
- - Accepts --content or --file arguments
206
-
207
- preview Preview your built documentation
208
- - Shows your docs in the browser
209
- - Run build first!
210
-
211
- help Show this help message
378
+ build Build your documentation site
379
+ Requirements: dory.json in current directory
380
+ Output: dist/ folder with static site
381
+
382
+ preview Preview built documentation
383
+ Requirements: dist/ folder (run build first)
384
+ Starts local server on port 3000
385
+
386
+ verify:content Verify MDX content compilation
387
+ Options: --content "<mdx>" or --file <path>
388
+ Silent on success, shows errors on failure
389
+
390
+ help Show this help message
212
391
 
213
392
  Examples:
214
- dory build # Build your docs
215
- dory verify:content --content "# Hello World" # Verify MDX content
216
- dory verify:content --file content.mdx # Verify MDX from file
217
- dory preview # Preview your docs
393
+ dory build
394
+ dory preview
395
+ dory verify:content --content "# Hello World"
396
+ dory verify:content --file docs/intro.mdx
397
+
398
+ For more information, visit: https://github.com/clidey/dory
218
399
  `);
219
400
  }
220
401
  };
221
402
 
403
+ type CommandName = keyof typeof commands;
404
+
222
405
  // Parse command line arguments
223
406
  const command = process.argv[2];
224
407
 
225
- async function runCommand() {
408
+ async function runCommand(): Promise<void> {
226
409
  if (!command || command === 'help' || command === '--help' || command === '-h') {
227
410
  commands.help();
228
- } else if (commands[command]) {
229
- await commands[command]();
411
+ return;
412
+ }
413
+
414
+ if (command in commands) {
415
+ await commands[command as CommandName]();
230
416
  } else {
231
417
  console.error(`โŒ Unknown command: ${command}`);
232
- console.log('Run "dory help" for usage information');
418
+ console.log(' Run "dory help" for available commands');
233
419
  process.exit(1);
234
420
  }
235
421
  }
236
422
 
237
- runCommand().catch((error) => {
238
- console.error('โŒ Command failed:', error.message);
423
+ runCommand().catch((error: unknown) => {
424
+ console.error('โŒ Command failed');
425
+ if (error instanceof Error) {
426
+ console.error(` ${error.message}`);
427
+ if (error.stack && process.env.DEBUG) {
428
+ console.error('\nStack trace:');
429
+ console.error(error.stack);
430
+ }
431
+ }
239
432
  process.exit(1);
240
433
  });
package/dist/index.html CHANGED
@@ -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-CrsN5P5J.js"></script>
49
- <link rel="stylesheet" crossorigin href="/assets/index-DfQ0BTd7.css">
48
+ <script type="module" crossorigin src="/assets/index-CPVd_vt1.js"></script>
49
+ <link rel="stylesheet" crossorigin href="/assets/index-Btb13Da-.css">
50
50
  </head>
51
51
  <body>
52
52
  <noscript>You need to enable JavaScript to run this app.</noscript>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@clidey/dory",
3
3
  "private": false,
4
- "version": "0.23.0",
4
+ "version": "0.27.0",
5
5
  "type": "module",
6
6
  "description": "A CLI tool for building and previewing documentation sites",
7
7
  "keywords": [
@@ -12,7 +12,7 @@
12
12
  "static-site"
13
13
  ],
14
14
  "bin": {
15
- "dory": "./bin/dory.ts"
15
+ "dory": "./bin/dist/dory.js"
16
16
  },
17
17
  "repository": {
18
18
  "type": "git",
@@ -26,9 +26,11 @@
26
26
  },
27
27
  "scripts": {
28
28
  "dev": "vite",
29
- "build": "tsc -b && vite build",
29
+ "build": "npm run build:cli && tsc -b && vite build",
30
+ "build:cli": "tsc -p tsconfig.bin.json",
30
31
  "preview": "vite preview",
31
- "publish": "npm publish --access public"
32
+ "publish": "npm run build && npm publish --access public",
33
+ "prepublishOnly": "npm run build"
32
34
  },
33
35
  "dependencies": {
34
36
  "@algolia/autocomplete-core": "^1.19.2",
@@ -93,7 +93,7 @@ function useAutocomplete({ onNavigate }: { onNavigate: () => void }) {
93
93
  function HighlightQuery({ text, query }: { text: string; query: string }) {
94
94
  return (
95
95
  <Highlighter
96
- highlightClassName="underline bg-transparent text-emerald-500"
96
+ highlightClassName="underline bg-transparent text-brand-foreground"
97
97
  searchWords={[query]}
98
98
  autoEscape={true}
99
99
  textToHighlight={text}
@@ -146,7 +146,7 @@ function SearchResult({
146
146
  <div
147
147
  id={`${id}-title`}
148
148
  aria-hidden="true"
149
- className="text-sm font-medium text-zinc-900 group-aria-selected:text-emerald-500 dark:text-white"
149
+ className="text-sm font-medium text-brand-foreground group-aria-selected:text-brand-foreground"
150
150
  >
151
151
  <HighlightQuery text={result.title} query={query} />
152
152
  </div>
@@ -195,9 +195,9 @@ function SearchResults({
195
195
  d="M12.01 12a4.237 4.237 0 0 0 1.24-3c0-.62-.132-1.207-.37-1.738M12.01 12A4.237 4.237 0 0 1 9 13.25c-.635 0-1.237-.14-1.777-.388M12.01 12l3.24 3.25m-3.715-9.661a4.25 4.25 0 0 0-5.975 5.908M4.5 15.5l11-11"
196
196
  />
197
197
  </svg>
198
- <p className="mt-2 text-xs text-zinc-700 dark:text-zinc-400">
198
+ <p className="mt-2 text-xs">
199
199
  Nothing found for{' '}
200
- <strong className="font-semibold break-words text-zinc-900 dark:text-white">
200
+ <strong className="font-semibold break-words">
201
201
  &lsquo;{query}&rsquo;
202
202
  </strong>
203
203
  . Please try again.
@@ -261,7 +261,7 @@ const SearchInput = forwardRef<
261
261
  />
262
262
  {autocompleteState.status === 'stalled' && (
263
263
  <div className="absolute inset-y-0 right-3 flex items-center">
264
- <Spinner className="h-5 w-5 animate-spin stroke-zinc-200 text-zinc-900 dark:stroke-zinc-800 dark:text-emerald-400" />
264
+ <Spinner className="h-5 w-5 animate-spin text-brand-foreground" />
265
265
  </div>
266
266
  )}
267
267
  </div>
@@ -1,6 +1,6 @@
1
1
  import type { ComponentType } from 'preact';
2
2
  import { type RouteComponentProps } from 'wouter-preact';
3
- import docsConfig from '../../docs/dory.json';
3
+ import docsConfig from '../../docs/dory.json' with { type: 'json' };
4
4
  import type { DoryConfig } from '../types/config';
5
5
  import { searchIndex } from './search-index';
6
6
 
package/src/mdx/card.tsx CHANGED
@@ -29,18 +29,18 @@ export function Card({
29
29
  icon,
30
30
  children,
31
31
  }: {
32
- title: string
33
- description: string
34
- href: string
35
- icon: string
32
+ title?: string
33
+ description?: string
34
+ href?: string
35
+ icon?: string
36
36
  children?: ComponentChildren
37
37
  }) {
38
38
  return (
39
- <UXCard className="group relative">
40
- <a href={href} className="absolute inset-0 z-10" aria-label={title} />
39
+ <UXCard className="group relative border-ring border-1 border-black/10 dark:border-white/10">
40
+ {href && <a href={href} className="absolute inset-0 z-10" aria-label={title} />}
41
41
  <CardHeader>
42
42
  <div className="flex items-center gap-3">
43
- <Icon icon={icon} className="h-8 w-8" />
43
+ {icon && <Icon icon={icon} className="h-8 w-8" />}
44
44
  <CardTitle className="text-base">{title}</CardTitle>
45
45
  </div>
46
46
  </CardHeader>
package/src/mdx/step.tsx CHANGED
@@ -40,10 +40,12 @@ export function Steps({ children }: { children: preact.ComponentChildren }) {
40
40
  )
41
41
  }
42
42
 
43
- export function Step({
44
- children
45
- }: {
46
- children: preact.ComponentChildren
43
+ export function Step({
44
+ title: _title,
45
+ children
46
+ }: {
47
+ title?: string;
48
+ children: preact.ComponentChildren
47
49
  }) {
48
50
  return <p className='text-sm'>{children}</p>
49
51
  }