@clidey/dory 0.34.1 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.html +0 -7
- package/package.json +41 -41
- package/src/components/error-boundary.tsx +59 -0
- package/src/components/routes.tsx +20 -3
- package/src/components/search-index.ts +34 -23
- package/src/components/store.ts +22 -22
- package/src/embed/loader.ts +2 -1
- package/src/embed/widget-iframe.ts +0 -3
- package/src/main.tsx +4 -1
- package/src/mdx/latex.tsx +63 -6
- package/src/mdx/mdx.tsx +17 -2
- package/src/plugins/analytics-injector.ts +43 -0
- package/src/plugins/csp-generator.ts +68 -0
- package/src/plugins/docs-assets.ts +1 -6
- package/src/plugins/frontmatter-dev-server.ts +8 -1
- package/src/plugins/frontmatter-generator.ts +12 -7
- package/src/plugins/llm-txt-dev-server.ts +8 -1
- package/src/plugins/llm-txt-generator.ts +8 -1
- package/src/plugins/prerender.ts +119 -0
- package/src/plugins/robots-generator.ts +37 -0
- package/src/plugins/sitemap-generator.ts +73 -0
- package/src/types/config.ts +9 -0
- package/src/ui/header.tsx +3 -8
- package/src/ui/layout.tsx +63 -5
- package/vite.config.embed-widget.ts +11 -8
- package/vite.config.ts +23 -4
- package/bin/dist/dory.d.ts +0 -3
- package/bin/dist/dory.d.ts.map +0 -1
- package/bin/dist/dory.js +0 -486
- package/bin/dist/dory.js.map +0 -1
- package/src/plugins/manifest-generator.ts +0 -57
package/bin/dist/dory.js
DELETED
|
@@ -1,486 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { execSync } from 'child_process';
|
|
3
|
-
import { existsSync, rmSync, mkdirSync, cpSync, readFileSync, readdirSync } from 'fs';
|
|
4
|
-
import { resolve, dirname } from 'path';
|
|
5
|
-
import { fileURLToPath } from 'url';
|
|
6
|
-
import { createServer } from 'http';
|
|
7
|
-
import sirv from 'sirv';
|
|
8
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
-
const __dirname = dirname(__filename);
|
|
10
|
-
// Get the root directory of the Dory package
|
|
11
|
-
const getDoryRoot = () => {
|
|
12
|
-
// In development: bin/dory.ts -> root is parent
|
|
13
|
-
// In production (local): bin/dist/dory.js -> root is parent of parent
|
|
14
|
-
// In production (installed): node_modules/@clidey/dory/bin/dist/dory.js -> root is parent of parent
|
|
15
|
-
const isDevelopment = __dirname.endsWith('bin');
|
|
16
|
-
const isLocalDist = __dirname.endsWith(resolve('bin', 'dist'));
|
|
17
|
-
if (isDevelopment) {
|
|
18
|
-
return resolve(__dirname, '..');
|
|
19
|
-
}
|
|
20
|
-
else if (isLocalDist) {
|
|
21
|
-
return resolve(__dirname, '..', '..');
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
// Installed package: node_modules/@clidey/dory/bin/dist/dory.js
|
|
25
|
-
return resolve(__dirname, '..', '..');
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
// Get the user's current working directory
|
|
29
|
-
const getUserRoot = () => process.cwd();
|
|
30
|
-
// Detect which package manager is available (prefer pnpm for speed, fallback to npm)
|
|
31
|
-
const getPackageManager = () => {
|
|
32
|
-
try {
|
|
33
|
-
execSync('pnpm --version', { stdio: 'ignore' });
|
|
34
|
-
return { run: 'pnpm run', exec: 'pnpm exec' };
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
try {
|
|
38
|
-
execSync('npm --version', { stdio: 'ignore' });
|
|
39
|
-
return { run: 'npm run', exec: 'npx' };
|
|
40
|
-
}
|
|
41
|
-
catch {
|
|
42
|
-
console.error('❌ No package manager found');
|
|
43
|
-
console.error(' Install npm or pnpm to use Dory');
|
|
44
|
-
console.error(' npm: https://nodejs.org/');
|
|
45
|
-
console.error(' pnpm: npm install -g pnpm');
|
|
46
|
-
process.exit(1);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
const validateDoryConfig = (config) => {
|
|
51
|
-
if (!config || typeof config !== 'object') {
|
|
52
|
-
throw new Error('Configuration must be a valid object');
|
|
53
|
-
}
|
|
54
|
-
// Add more validation as needed
|
|
55
|
-
};
|
|
56
|
-
const commands = {
|
|
57
|
-
build: () => {
|
|
58
|
-
console.log('🐟 Dory is ready to build your docs!');
|
|
59
|
-
const userRoot = getUserRoot();
|
|
60
|
-
const doryRoot = getDoryRoot();
|
|
61
|
-
const doryConfigPath = resolve(userRoot, 'dory.json');
|
|
62
|
-
const tempDocsDir = resolve(doryRoot, 'docs');
|
|
63
|
-
const docsBackupDir = resolve(doryRoot, '.docs-backup');
|
|
64
|
-
const doryDistDir = resolve(doryRoot, 'dist');
|
|
65
|
-
const userDistDir = resolve(userRoot, 'dist');
|
|
66
|
-
// Step 1: Validate prerequisites before making any changes
|
|
67
|
-
console.log('🔍 Validating project structure...');
|
|
68
|
-
if (!existsSync(doryConfigPath)) {
|
|
69
|
-
console.error('❌ dory.json not found in current directory');
|
|
70
|
-
console.error(` Looking for: ${doryConfigPath}`);
|
|
71
|
-
console.error(' Create a dory.json file to configure your documentation site');
|
|
72
|
-
process.exit(1);
|
|
73
|
-
}
|
|
74
|
-
// Read and validate dory.json
|
|
75
|
-
let config;
|
|
76
|
-
try {
|
|
77
|
-
const configContent = readFileSync(doryConfigPath, 'utf8');
|
|
78
|
-
config = JSON.parse(configContent);
|
|
79
|
-
validateDoryConfig(config);
|
|
80
|
-
console.log(`📋 Building: ${config.name || 'Documentation'}`);
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
console.error('❌ Failed to parse dory.json:');
|
|
84
|
-
if (error instanceof Error) {
|
|
85
|
-
console.error(` ${error.message}`);
|
|
86
|
-
}
|
|
87
|
-
process.exit(1);
|
|
88
|
-
}
|
|
89
|
-
// Detect package manager
|
|
90
|
-
const pm = getPackageManager();
|
|
91
|
-
// Step 2: Backup existing docs directory if it exists
|
|
92
|
-
console.log('🧹 Preparing workspace...');
|
|
93
|
-
const docsExistedBefore = existsSync(tempDocsDir);
|
|
94
|
-
if (docsExistedBefore) {
|
|
95
|
-
console.log('💾 Backing up existing docs directory...');
|
|
96
|
-
if (existsSync(docsBackupDir)) {
|
|
97
|
-
rmSync(docsBackupDir, { recursive: true, force: true });
|
|
98
|
-
}
|
|
99
|
-
cpSync(tempDocsDir, docsBackupDir, { recursive: true, force: true });
|
|
100
|
-
rmSync(tempDocsDir, { recursive: true, force: true });
|
|
101
|
-
}
|
|
102
|
-
try {
|
|
103
|
-
// Step 3: Copy user files to temp docs directory
|
|
104
|
-
mkdirSync(tempDocsDir, { recursive: true });
|
|
105
|
-
console.log('📁 Gathering project files...');
|
|
106
|
-
// Define files/dirs to exclude
|
|
107
|
-
const excludeItems = new Set([
|
|
108
|
-
'node_modules',
|
|
109
|
-
'dist',
|
|
110
|
-
'.git',
|
|
111
|
-
'.github',
|
|
112
|
-
'docs',
|
|
113
|
-
'.DS_Store',
|
|
114
|
-
'.env',
|
|
115
|
-
'.env.local',
|
|
116
|
-
'pnpm-lock.yaml',
|
|
117
|
-
'package-lock.json',
|
|
118
|
-
'yarn.lock'
|
|
119
|
-
]);
|
|
120
|
-
const items = readdirSync(userRoot);
|
|
121
|
-
let copiedCount = 0;
|
|
122
|
-
for (const item of items) {
|
|
123
|
-
if (excludeItems.has(item)) {
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
const srcPath = resolve(userRoot, item);
|
|
127
|
-
const destPath = resolve(tempDocsDir, item);
|
|
128
|
-
try {
|
|
129
|
-
cpSync(srcPath, destPath, { recursive: true, force: true });
|
|
130
|
-
copiedCount++;
|
|
131
|
-
}
|
|
132
|
-
catch (error) {
|
|
133
|
-
console.warn(`⚠️ Could not copy ${item}: ${error instanceof Error ? error.message : 'unknown error'}`);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
console.log(`✅ Copied ${copiedCount} items`);
|
|
137
|
-
// Verify critical files exist
|
|
138
|
-
const doryJsonPath = resolve(tempDocsDir, 'dory.json');
|
|
139
|
-
if (!existsSync(doryJsonPath)) {
|
|
140
|
-
console.error('❌ dory.json was not copied to docs directory');
|
|
141
|
-
console.error(` Expected: ${doryJsonPath}`);
|
|
142
|
-
console.error(' This file is required for the build');
|
|
143
|
-
process.exit(1);
|
|
144
|
-
}
|
|
145
|
-
// Step 4: Run the build
|
|
146
|
-
console.log('⚡ Building documentation...');
|
|
147
|
-
try {
|
|
148
|
-
// Use vite build directly - no TypeScript compilation needed for installed package
|
|
149
|
-
execSync(`${pm.exec} vite build`, {
|
|
150
|
-
stdio: 'inherit',
|
|
151
|
-
cwd: doryRoot,
|
|
152
|
-
env: { ...process.env }
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
catch (error) {
|
|
156
|
-
console.error('❌ Build failed');
|
|
157
|
-
console.error(' Check the error messages above for details');
|
|
158
|
-
throw error;
|
|
159
|
-
}
|
|
160
|
-
// Step 5: Verify build output
|
|
161
|
-
console.log('🔍 Verifying build output...');
|
|
162
|
-
if (!existsSync(doryDistDir)) {
|
|
163
|
-
console.error('❌ Build completed but dist folder was not created');
|
|
164
|
-
console.error(` Expected: ${doryDistDir}`);
|
|
165
|
-
process.exit(1);
|
|
166
|
-
}
|
|
167
|
-
const indexHtml = resolve(doryDistDir, 'index.html');
|
|
168
|
-
if (!existsSync(indexHtml)) {
|
|
169
|
-
console.error('❌ Build incomplete: index.html not found');
|
|
170
|
-
console.error(' The build may have failed silently');
|
|
171
|
-
process.exit(1);
|
|
172
|
-
}
|
|
173
|
-
// Check if dist has content
|
|
174
|
-
const distFiles = readdirSync(doryDistDir);
|
|
175
|
-
if (distFiles.length === 0) {
|
|
176
|
-
console.error('❌ Build completed but dist folder is empty');
|
|
177
|
-
process.exit(1);
|
|
178
|
-
}
|
|
179
|
-
console.log('🎉 Build completed successfully!');
|
|
180
|
-
// Step 6: Copy dist to user's directory
|
|
181
|
-
console.log('📦 Copying build output...');
|
|
182
|
-
// Only copy if they're different directories
|
|
183
|
-
if (doryDistDir !== userDistDir) {
|
|
184
|
-
if (existsSync(userDistDir)) {
|
|
185
|
-
rmSync(userDistDir, { recursive: true, force: true });
|
|
186
|
-
}
|
|
187
|
-
cpSync(doryDistDir, userDistDir, { recursive: true, force: true });
|
|
188
|
-
}
|
|
189
|
-
console.log('✨ Documentation ready in dist/');
|
|
190
|
-
// Step 6.5: Build embed files
|
|
191
|
-
console.log('📦 Building embed files...');
|
|
192
|
-
try {
|
|
193
|
-
// Build embed loader
|
|
194
|
-
console.log(' Building embed loader...');
|
|
195
|
-
execSync(`${pm.exec} vite build -c vite.config.embed-loader.ts`, {
|
|
196
|
-
stdio: 'inherit',
|
|
197
|
-
cwd: doryRoot,
|
|
198
|
-
env: { ...process.env }
|
|
199
|
-
});
|
|
200
|
-
// Build embed widget
|
|
201
|
-
console.log(' Building embed widget...');
|
|
202
|
-
execSync(`${pm.exec} vite build -c vite.config.embed-widget.ts`, {
|
|
203
|
-
stdio: 'inherit',
|
|
204
|
-
cwd: doryRoot,
|
|
205
|
-
env: { ...process.env }
|
|
206
|
-
});
|
|
207
|
-
// Copy embed files to user's dist if different
|
|
208
|
-
if (doryDistDir !== userDistDir) {
|
|
209
|
-
const embedFiles = ['embed.js', 'embed-widget.js', 'embed.css'];
|
|
210
|
-
embedFiles.forEach(file => {
|
|
211
|
-
const srcPath = resolve(doryDistDir, file);
|
|
212
|
-
const destPath = resolve(userDistDir, file);
|
|
213
|
-
if (existsSync(srcPath)) {
|
|
214
|
-
cpSync(srcPath, destPath, { force: true });
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
// Copy any chunk files (embed-*.js)
|
|
218
|
-
const files = readdirSync(doryDistDir);
|
|
219
|
-
files.forEach(file => {
|
|
220
|
-
if (file.startsWith('embed-') && file.endsWith('.js')) {
|
|
221
|
-
const srcPath = resolve(doryDistDir, file);
|
|
222
|
-
const destPath = resolve(userDistDir, file);
|
|
223
|
-
cpSync(srcPath, destPath, { force: true });
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
console.log('✨ Embed files built successfully!');
|
|
228
|
-
console.log('');
|
|
229
|
-
console.log(' 📝 Add to your site:');
|
|
230
|
-
console.log(' <script src="https://your-docs.com/embed.js"></script>');
|
|
231
|
-
console.log(' <button onclick="DoryDocs.open()">Help</button>');
|
|
232
|
-
console.log('');
|
|
233
|
-
}
|
|
234
|
-
catch (error) {
|
|
235
|
-
console.warn('⚠️ Embed build failed, but main build succeeded');
|
|
236
|
-
console.warn(' Your documentation site is still available at dist/');
|
|
237
|
-
if (error instanceof Error) {
|
|
238
|
-
console.warn(` Error: ${error.message}`);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
finally {
|
|
243
|
-
// Step 7: Always clean up temp directories and restore backup
|
|
244
|
-
console.log('🧹 Cleaning up...');
|
|
245
|
-
// First priority: Restore the original docs directory if it existed
|
|
246
|
-
if (docsExistedBefore && existsSync(docsBackupDir)) {
|
|
247
|
-
console.log('📦 Restoring original docs directory...');
|
|
248
|
-
let restoredSuccessfully = false;
|
|
249
|
-
try {
|
|
250
|
-
// Remove the temporary docs directory
|
|
251
|
-
if (existsSync(tempDocsDir)) {
|
|
252
|
-
rmSync(tempDocsDir, { recursive: true, force: true });
|
|
253
|
-
}
|
|
254
|
-
// Restore from backup
|
|
255
|
-
cpSync(docsBackupDir, tempDocsDir, { recursive: true, force: true });
|
|
256
|
-
restoredSuccessfully = true;
|
|
257
|
-
// Only delete the backup after successful restoration
|
|
258
|
-
rmSync(docsBackupDir, { recursive: true, force: true });
|
|
259
|
-
}
|
|
260
|
-
catch (error) {
|
|
261
|
-
console.error('❌ Failed to restore docs directory!');
|
|
262
|
-
console.error(` Backup is preserved at: ${docsBackupDir}`);
|
|
263
|
-
console.error(' You can manually restore by running:');
|
|
264
|
-
console.error(` cp -r "${docsBackupDir}" "${tempDocsDir}"`);
|
|
265
|
-
if (error instanceof Error) {
|
|
266
|
-
console.error(` Error: ${error.message}`);
|
|
267
|
-
}
|
|
268
|
-
// Critical: Don't delete the backup if restoration failed
|
|
269
|
-
if (!restoredSuccessfully) {
|
|
270
|
-
console.error(' ⚠️ Your original docs are safe in the backup directory');
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
else if (docsExistedBefore && !existsSync(docsBackupDir)) {
|
|
275
|
-
console.warn('⚠️ Warning: Original docs directory existed but backup not found');
|
|
276
|
-
console.warn(` Expected backup at: ${docsBackupDir}`);
|
|
277
|
-
}
|
|
278
|
-
else {
|
|
279
|
-
// No docs existed before, just clean up the temporary directory
|
|
280
|
-
try {
|
|
281
|
-
if (existsSync(tempDocsDir)) {
|
|
282
|
-
rmSync(tempDocsDir, { recursive: true, force: true });
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
catch (error) {
|
|
286
|
-
console.warn('⚠️ Could not remove temporary docs directory');
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
// Clean up doryDistDir if it's different from userDistDir
|
|
290
|
-
try {
|
|
291
|
-
if (doryDistDir !== userDistDir && existsSync(doryDistDir)) {
|
|
292
|
-
rmSync(doryDistDir, { recursive: true, force: true });
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
catch (error) {
|
|
296
|
-
console.warn('⚠️ Could not clean up dory dist directory');
|
|
297
|
-
}
|
|
298
|
-
console.log('✅ Done!');
|
|
299
|
-
}
|
|
300
|
-
},
|
|
301
|
-
preview: () => {
|
|
302
|
-
console.log('👀 Starting docs preview...');
|
|
303
|
-
const userRoot = getUserRoot();
|
|
304
|
-
const distDir = resolve(userRoot, 'dist');
|
|
305
|
-
let port = parseInt(process.env.PORT || '3000', 10);
|
|
306
|
-
// Validate dist folder exists
|
|
307
|
-
if (!existsSync(distDir)) {
|
|
308
|
-
console.error('❌ dist folder not found');
|
|
309
|
-
console.error(` Looking for: ${distDir}`);
|
|
310
|
-
console.error(' Run "dory build" first to generate the documentation');
|
|
311
|
-
process.exit(1);
|
|
312
|
-
}
|
|
313
|
-
// Check if dist has content
|
|
314
|
-
const distFiles = readdirSync(distDir);
|
|
315
|
-
if (distFiles.length === 0) {
|
|
316
|
-
console.error('❌ dist folder is empty');
|
|
317
|
-
console.error(' Run "dory build" to generate documentation');
|
|
318
|
-
process.exit(1);
|
|
319
|
-
}
|
|
320
|
-
const serve = sirv(distDir, {
|
|
321
|
-
dev: false,
|
|
322
|
-
single: true,
|
|
323
|
-
etag: true,
|
|
324
|
-
gzip: true,
|
|
325
|
-
brotli: true,
|
|
326
|
-
});
|
|
327
|
-
const server = createServer((req, res) => {
|
|
328
|
-
serve(req, res);
|
|
329
|
-
});
|
|
330
|
-
const tryPort = (currentPort) => {
|
|
331
|
-
server.listen(currentPort)
|
|
332
|
-
.on('listening', () => {
|
|
333
|
-
console.log(`🚀 Documentation live at http://localhost:${currentPort}`);
|
|
334
|
-
console.log(' Press Ctrl+C to stop the server');
|
|
335
|
-
})
|
|
336
|
-
.on('error', (err) => {
|
|
337
|
-
if (err.code === 'EADDRINUSE') {
|
|
338
|
-
console.log(`⚠️ Port ${currentPort} in use, trying ${currentPort + 1}...`);
|
|
339
|
-
tryPort(currentPort + 1);
|
|
340
|
-
}
|
|
341
|
-
else {
|
|
342
|
-
console.error('❌ Failed to start server:', err.message);
|
|
343
|
-
process.exit(1);
|
|
344
|
-
}
|
|
345
|
-
});
|
|
346
|
-
};
|
|
347
|
-
tryPort(port);
|
|
348
|
-
},
|
|
349
|
-
'verify:content': async () => {
|
|
350
|
-
const args = process.argv.slice(3);
|
|
351
|
-
let content = '';
|
|
352
|
-
let fileName = '';
|
|
353
|
-
// Parse arguments
|
|
354
|
-
for (let i = 0; i < args.length; i++) {
|
|
355
|
-
if (args[i] === '--content' && i + 1 < args.length) {
|
|
356
|
-
content = args[i + 1];
|
|
357
|
-
break;
|
|
358
|
-
}
|
|
359
|
-
else if (args[i] === '--file' && i + 1 < args.length) {
|
|
360
|
-
const filePath = resolve(getUserRoot(), args[i + 1]);
|
|
361
|
-
if (!existsSync(filePath)) {
|
|
362
|
-
console.error(`❌ File not found: ${filePath}`);
|
|
363
|
-
process.exit(1);
|
|
364
|
-
}
|
|
365
|
-
content = readFileSync(filePath, 'utf8');
|
|
366
|
-
fileName = filePath;
|
|
367
|
-
break;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
if (!content) {
|
|
371
|
-
console.error('❌ --content or --file argument is required');
|
|
372
|
-
console.log('Usage:');
|
|
373
|
-
console.log(' dory verify:content --content "<mdx-content>"');
|
|
374
|
-
console.log(' dory verify:content --file <path-to-mdx-file>');
|
|
375
|
-
process.exit(1);
|
|
376
|
-
}
|
|
377
|
-
try {
|
|
378
|
-
const doryRoot = getDoryRoot();
|
|
379
|
-
const processorPath = resolve(doryRoot, 'src', 'mdx', 'processor.ts');
|
|
380
|
-
if (!existsSync(processorPath)) {
|
|
381
|
-
console.error('❌ MDX processor not found');
|
|
382
|
-
console.error(' This feature requires Dory source files');
|
|
383
|
-
process.exit(1);
|
|
384
|
-
}
|
|
385
|
-
// Use the shared MDX processor that matches the main build exactly
|
|
386
|
-
const { verifyMdxContent } = await import(processorPath);
|
|
387
|
-
const result = await verifyMdxContent(content, fileName);
|
|
388
|
-
if (!result.valid) {
|
|
389
|
-
throw result.error;
|
|
390
|
-
}
|
|
391
|
-
// Silent success - no output means no errors
|
|
392
|
-
}
|
|
393
|
-
catch (error) {
|
|
394
|
-
console.error('❌ MDX compilation failed:');
|
|
395
|
-
if (error instanceof Error) {
|
|
396
|
-
console.error(` ${error.message}`);
|
|
397
|
-
// Provide more detailed error information if available
|
|
398
|
-
const errorWithPosition = error;
|
|
399
|
-
if (errorWithPosition.line !== undefined && errorWithPosition.column !== undefined) {
|
|
400
|
-
console.error(` at line ${errorWithPosition.line}, column ${errorWithPosition.column}`);
|
|
401
|
-
}
|
|
402
|
-
if (errorWithPosition.source) {
|
|
403
|
-
console.error(' Source:', errorWithPosition.source);
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
process.exit(1);
|
|
407
|
-
}
|
|
408
|
-
},
|
|
409
|
-
version: () => {
|
|
410
|
-
const doryRoot = getDoryRoot();
|
|
411
|
-
const packageJsonPath = resolve(doryRoot, 'package.json');
|
|
412
|
-
try {
|
|
413
|
-
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
|
|
414
|
-
console.log(`🐟 Dory v${packageJson.version}`);
|
|
415
|
-
}
|
|
416
|
-
catch (error) {
|
|
417
|
-
console.error('❌ Failed to read version information');
|
|
418
|
-
if (error instanceof Error) {
|
|
419
|
-
console.error(` ${error.message}`);
|
|
420
|
-
}
|
|
421
|
-
process.exit(1);
|
|
422
|
-
}
|
|
423
|
-
},
|
|
424
|
-
help: () => {
|
|
425
|
-
console.log(`
|
|
426
|
-
🐟 Dory CLI - Documentation Builder
|
|
427
|
-
|
|
428
|
-
Usage:
|
|
429
|
-
dory <command> [options]
|
|
430
|
-
|
|
431
|
-
Commands:
|
|
432
|
-
build Build your documentation site
|
|
433
|
-
Requirements: dory.json in current directory
|
|
434
|
-
Output: dist/ folder with static site
|
|
435
|
-
|
|
436
|
-
preview Preview built documentation
|
|
437
|
-
Requirements: dist/ folder (run build first)
|
|
438
|
-
Starts local server on port 3000
|
|
439
|
-
|
|
440
|
-
verify:content Verify MDX content compilation
|
|
441
|
-
Options: --content "<mdx>" or --file <path>
|
|
442
|
-
Silent on success, shows errors on failure
|
|
443
|
-
|
|
444
|
-
version Show Dory version
|
|
445
|
-
|
|
446
|
-
help Show this help message
|
|
447
|
-
|
|
448
|
-
Examples:
|
|
449
|
-
dory build
|
|
450
|
-
dory preview
|
|
451
|
-
dory verify:content --content "# Hello World"
|
|
452
|
-
dory verify:content --file docs/intro.mdx
|
|
453
|
-
dory version
|
|
454
|
-
|
|
455
|
-
For more information, visit: https://github.com/clidey/dory
|
|
456
|
-
`);
|
|
457
|
-
}
|
|
458
|
-
};
|
|
459
|
-
// Parse command line arguments
|
|
460
|
-
const command = process.argv[2];
|
|
461
|
-
async function runCommand() {
|
|
462
|
-
if (!command || command === 'help' || command === '--help' || command === '-h') {
|
|
463
|
-
commands.help();
|
|
464
|
-
return;
|
|
465
|
-
}
|
|
466
|
-
if (command in commands) {
|
|
467
|
-
await commands[command]();
|
|
468
|
-
}
|
|
469
|
-
else {
|
|
470
|
-
console.error(`❌ Unknown command: ${command}`);
|
|
471
|
-
console.log(' Run "dory help" for available commands');
|
|
472
|
-
process.exit(1);
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
runCommand().catch((error) => {
|
|
476
|
-
console.error('❌ Command failed');
|
|
477
|
-
if (error instanceof Error) {
|
|
478
|
-
console.error(` ${error.message}`);
|
|
479
|
-
if (error.stack && process.env.DEBUG) {
|
|
480
|
-
console.error('\nStack trace:');
|
|
481
|
-
console.error(error.stack);
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
process.exit(1);
|
|
485
|
-
});
|
|
486
|
-
//# sourceMappingURL=dory.js.map
|
package/bin/dist/dory.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dory.js","sourceRoot":"","sources":["../dory.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,6CAA6C;AAC7C,MAAM,WAAW,GAAG,GAAW,EAAE;IAC/B,gDAAgD;IAChD,sEAAsE;I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;QAC/C,OAAO,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC;QACzD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IACpC,OAAO,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAClC,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACrC,IAAI,KAAK,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;YACrC,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YAChC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { Plugin } from 'vite';
|
|
2
|
-
import { readFileSync, existsSync } from 'fs';
|
|
3
|
-
import { resolve } from 'path';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Plugin to generate manifest.json for PWA support
|
|
7
|
-
*/
|
|
8
|
-
export function manifestGenerator(): Plugin {
|
|
9
|
-
return {
|
|
10
|
-
name: 'manifest-generator',
|
|
11
|
-
generateBundle() {
|
|
12
|
-
const docsDir = resolve(process.cwd(), 'docs');
|
|
13
|
-
const doryJsonPath = resolve(docsDir, 'dory.json');
|
|
14
|
-
|
|
15
|
-
// Read dory.json to get site configuration
|
|
16
|
-
let config: any = {
|
|
17
|
-
name: 'Documentation',
|
|
18
|
-
description: 'Technical Documentation'
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
if (existsSync(doryJsonPath)) {
|
|
22
|
-
try {
|
|
23
|
-
config = JSON.parse(readFileSync(doryJsonPath, 'utf-8'));
|
|
24
|
-
} catch (error) {
|
|
25
|
-
console.warn('⚠️ Failed to parse dory.json for manifest generation');
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Generate manifest.json content
|
|
30
|
-
const manifest = {
|
|
31
|
-
name: config.name || 'Documentation',
|
|
32
|
-
short_name: config.name || 'Docs',
|
|
33
|
-
description: config.description || 'Technical Documentation',
|
|
34
|
-
start_url: '/',
|
|
35
|
-
display: 'standalone',
|
|
36
|
-
theme_color: '#000000',
|
|
37
|
-
background_color: '#ffffff',
|
|
38
|
-
icons: [
|
|
39
|
-
{
|
|
40
|
-
src: '/favicon.svg',
|
|
41
|
-
sizes: 'any',
|
|
42
|
-
type: 'image/svg+xml'
|
|
43
|
-
}
|
|
44
|
-
]
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
// Emit the manifest.json file
|
|
48
|
-
this.emitFile({
|
|
49
|
-
type: 'asset',
|
|
50
|
-
fileName: 'manifest.json',
|
|
51
|
-
source: JSON.stringify(manifest, null, 2)
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
console.log('✅ Generated manifest.json');
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
}
|