@knowcode/doc-builder 1.0.10 → 1.1.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/CHANGELOG.md +31 -0
- package/cli.js +49 -12
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,37 @@ All notable changes to @knowcode/doc-builder will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.1.0] - 2025-01-19
|
|
9
|
+
|
|
10
|
+
### Changed (BREAKING)
|
|
11
|
+
- **Deploy command now defaults to production deployment**
|
|
12
|
+
- Use `--no-prod` flag for preview deployments
|
|
13
|
+
- Default action (no command) deploys to production
|
|
14
|
+
- This ensures documentation is always published to main URL
|
|
15
|
+
|
|
16
|
+
### Updated
|
|
17
|
+
- All help text and examples reflect production default
|
|
18
|
+
- CLI description clarifies production deployment
|
|
19
|
+
- Example files use simplified deploy command
|
|
20
|
+
|
|
21
|
+
### Migration
|
|
22
|
+
- Previous: `npx @knowcode/doc-builder deploy --prod`
|
|
23
|
+
- Now: `npx @knowcode/doc-builder deploy`
|
|
24
|
+
- For preview: `npx @knowcode/doc-builder deploy --no-prod`
|
|
25
|
+
|
|
26
|
+
## [1.0.11] - 2025-01-19
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
- Comprehensive troubleshooting for "buildCommand" errors in help
|
|
30
|
+
- Troubleshooting for "Project was deleted" errors
|
|
31
|
+
- "Delete and Start Fresh" section in deployment help
|
|
32
|
+
- Enhanced reset-vercel command documentation
|
|
33
|
+
|
|
34
|
+
### Improved
|
|
35
|
+
- Clearer instructions for handling deleted projects
|
|
36
|
+
- Better organization of troubleshooting scenarios
|
|
37
|
+
- Added specific commands for each error type
|
|
38
|
+
|
|
8
39
|
## [1.0.10] - 2025-01-19
|
|
9
40
|
|
|
10
41
|
### Fixed
|
package/cli.js
CHANGED
|
@@ -45,7 +45,7 @@ ${chalk.yellow('Quick Start:')}
|
|
|
45
45
|
${chalk.gray('$')} echo "# My Documentation" > docs/README.md
|
|
46
46
|
|
|
47
47
|
${chalk.cyan('2. Build and deploy:')}
|
|
48
|
-
${chalk.gray('$')} npx @knowcode/doc-builder ${chalk.gray('# Build and deploy to
|
|
48
|
+
${chalk.gray('$')} npx @knowcode/doc-builder ${chalk.gray('# Build and deploy to production')}
|
|
49
49
|
${chalk.gray(' or')}
|
|
50
50
|
${chalk.gray('$')} npx @knowcode/doc-builder build ${chalk.gray('# Build HTML files only')}
|
|
51
51
|
${chalk.gray('$')} npx @knowcode/doc-builder dev ${chalk.gray('# Start development server')}
|
|
@@ -116,15 +116,15 @@ ${chalk.yellow('Examples:')}
|
|
|
116
116
|
// Deploy command
|
|
117
117
|
program
|
|
118
118
|
.command('deploy')
|
|
119
|
-
.description('Deploy documentation to Vercel (requires Vercel CLI)')
|
|
119
|
+
.description('Deploy documentation to Vercel production (requires Vercel CLI)')
|
|
120
120
|
.option('-c, --config <path>', 'path to config file (default: doc-builder.config.js)')
|
|
121
|
-
.option('--prod', 'deploy
|
|
121
|
+
.option('--no-prod', 'deploy as preview instead of production')
|
|
122
122
|
.option('--no-build', 'skip building before deployment')
|
|
123
123
|
.option('--force', 'force deployment without confirmation')
|
|
124
124
|
.addHelpText('after', `
|
|
125
125
|
${chalk.yellow('Examples:')}
|
|
126
|
-
${chalk.gray('$')} doc-builder deploy ${chalk.gray('# Deploy
|
|
127
|
-
${chalk.gray('$')} doc-builder deploy --prod
|
|
126
|
+
${chalk.gray('$')} doc-builder deploy ${chalk.gray('# Deploy to production')}
|
|
127
|
+
${chalk.gray('$')} doc-builder deploy --no-prod ${chalk.gray('# Deploy preview only')}
|
|
128
128
|
${chalk.gray('$')} doc-builder deploy --no-build ${chalk.gray('# Deploy existing build')}
|
|
129
129
|
|
|
130
130
|
${chalk.yellow('First-time Vercel Setup:')}
|
|
@@ -184,8 +184,20 @@ ${chalk.yellow('First-time Vercel Setup:')}
|
|
|
184
184
|
• This allows public access to your docs
|
|
185
185
|
|
|
186
186
|
${chalk.yellow('Subsequent Deployments:')}
|
|
187
|
-
${chalk.gray('$')} npx @knowcode/doc-builder ${chalk.gray('#
|
|
188
|
-
${chalk.gray('$')} npx @knowcode/doc-builder deploy
|
|
187
|
+
${chalk.gray('$')} npx @knowcode/doc-builder ${chalk.gray('# Build and deploy to production')}
|
|
188
|
+
${chalk.gray('$')} npx @knowcode/doc-builder deploy ${chalk.gray('# Deploy to production')}
|
|
189
|
+
${chalk.gray('$')} npx @knowcode/doc-builder deploy --no-prod ${chalk.gray('# Deploy preview only')}
|
|
190
|
+
|
|
191
|
+
${chalk.yellow('When All Else Fails - Delete and Start Fresh:')}
|
|
192
|
+
Sometimes the cleanest solution is to delete the Vercel project:
|
|
193
|
+
|
|
194
|
+
1. Go to your project settings on Vercel
|
|
195
|
+
2. Scroll to bottom and click ${chalk.red('"Delete Project"')}
|
|
196
|
+
3. Run: ${chalk.gray('npx @knowcode/doc-builder reset-vercel')}
|
|
197
|
+
4. Run: ${chalk.gray('npx @knowcode/doc-builder deploy')}
|
|
198
|
+
5. Create a NEW project with correct settings
|
|
199
|
+
|
|
200
|
+
This removes all conflicting configurations!
|
|
189
201
|
|
|
190
202
|
${chalk.yellow('Troubleshooting:')}
|
|
191
203
|
• ${chalk.cyan('Command not found:')} Install Vercel CLI globally
|
|
@@ -209,6 +221,25 @@ ${chalk.yellow('Troubleshooting:')}
|
|
|
209
221
|
2. Run deployment again
|
|
210
222
|
3. When asked "Link to existing project?" say ${chalk.red.bold('NO')}
|
|
211
223
|
4. Create a new project with your actual name
|
|
224
|
+
|
|
225
|
+
${chalk.red.bold('• "buildCommand should be string,null" error:')}
|
|
226
|
+
${chalk.yellow('Your Vercel project has conflicting build settings.')}
|
|
227
|
+
|
|
228
|
+
${chalk.green('Fix:')}
|
|
229
|
+
1. Go to project settings > Build & Development Settings
|
|
230
|
+
2. Clear ALL fields (Build Command, Output Directory, etc.)
|
|
231
|
+
3. Save and try again
|
|
232
|
+
${chalk.gray('OR')}
|
|
233
|
+
Delete the project and start fresh (see below)
|
|
234
|
+
|
|
235
|
+
${chalk.red.bold('• "Project was deleted or you don\'t have access" error:')}
|
|
236
|
+
${chalk.yellow('The Vercel project was deleted but local config remains.')}
|
|
237
|
+
|
|
238
|
+
${chalk.green('Fix:')}
|
|
239
|
+
${chalk.gray('$')} npx @knowcode/doc-builder reset-vercel
|
|
240
|
+
${chalk.gray('$')} npx @knowcode/doc-builder deploy
|
|
241
|
+
|
|
242
|
+
This removes old project references and starts fresh
|
|
212
243
|
`)
|
|
213
244
|
.action(async (options) => {
|
|
214
245
|
const spinner = ora('Deploying to Vercel...').start();
|
|
@@ -278,7 +309,9 @@ ${chalk.yellow('Troubleshooting:')}
|
|
|
278
309
|
}
|
|
279
310
|
|
|
280
311
|
spinner.start('Deploying to Vercel...');
|
|
281
|
-
|
|
312
|
+
// Default to production deployment
|
|
313
|
+
const isProduction = options.prod !== false; // Default true unless explicitly --no-prod
|
|
314
|
+
const url = await deployToVercel(config, isProduction);
|
|
282
315
|
spinner.succeed(`Deployed successfully! ${chalk.cyan(url)}`);
|
|
283
316
|
|
|
284
317
|
} catch (error) {
|
|
@@ -307,6 +340,9 @@ ${chalk.yellow('When to use:')}
|
|
|
307
340
|
• After "html/html does not exist" error
|
|
308
341
|
• When linked to wrong project (e.g., username/html)
|
|
309
342
|
• When Root Directory settings are incorrect
|
|
343
|
+
• After deleting a Vercel project
|
|
344
|
+
• When you get "Project was deleted" errors
|
|
345
|
+
• Any time you want to start fresh with deployment
|
|
310
346
|
`)
|
|
311
347
|
.action(async (options) => {
|
|
312
348
|
try {
|
|
@@ -389,7 +425,7 @@ ${chalk.yellow('What gets created:')}
|
|
|
389
425
|
// Create example files
|
|
390
426
|
const exampleFiles = {
|
|
391
427
|
'README.md': `# Welcome to Your Documentation\n\nThis is an example documentation site created with @knowcode/doc-builder.\n\n## Features\n\n- 📝 Write in Markdown\n- 🎨 Beautiful Notion-inspired design\n- 📊 Mermaid diagram support\n- 🌙 Dark mode\n- 🚀 Deploy to Vercel\n\n## Getting Started\n\n1. Edit this file and add your content\n2. Create new markdown files\n3. Run \`npx @knowcode/doc-builder\` to build and deploy\n\n## Example Diagram\n\n\`\`\`mermaid\ngraph TD\n A[Write Docs] --> B[Build]\n B --> C[Deploy]\n C --> D[Share]\n\`\`\`\n`,
|
|
392
|
-
'getting-started.md': `# Getting Started\n\n**Generated**: ${new Date().toISOString().split('T')[0]}\n**Status**: Draft\n**Verified**: ❓\n\n## Overview\n\nThis guide will help you get started with your documentation.\n\n## Installation\n\nNo installation required! Just use:\n\n\`\`\`bash\nnpx @knowcode/doc-builder\n\`\`\`\n\n## Writing Documentation\n\n1. Create markdown files in the \`docs\` folder\n2. Use folders to organize your content\n3. Add front matter for metadata\n\n## Building\n\nTo build your documentation:\n\n\`\`\`bash\nnpx @knowcode/doc-builder build\n\`\`\`\n\n## Deployment\n\nDeploy to Vercel:\n\n\`\`\`bash\nnpx @knowcode/doc-builder deploy
|
|
428
|
+
'getting-started.md': `# Getting Started\n\n**Generated**: ${new Date().toISOString().split('T')[0]}\n**Status**: Draft\n**Verified**: ❓\n\n## Overview\n\nThis guide will help you get started with your documentation.\n\n## Installation\n\nNo installation required! Just use:\n\n\`\`\`bash\nnpx @knowcode/doc-builder\n\`\`\`\n\n## Writing Documentation\n\n1. Create markdown files in the \`docs\` folder\n2. Use folders to organize your content\n3. Add front matter for metadata\n\n## Building\n\nTo build your documentation:\n\n\`\`\`bash\nnpx @knowcode/doc-builder build\n\`\`\`\n\n## Deployment\n\nDeploy to Vercel:\n\n\`\`\`bash\nnpx @knowcode/doc-builder deploy\n\`\`\`\n`,
|
|
393
429
|
'guides/configuration.md': `# Configuration Guide\n\n**Generated**: ${new Date().toISOString().split('T')[0]}\n**Status**: Draft\n**Verified**: ❓\n\n## Overview\n\n@knowcode/doc-builder works with zero configuration, but you can customize it.\n\n## Configuration File\n\nCreate \`doc-builder.config.js\`:\n\n\`\`\`javascript\nmodule.exports = {\n siteName: 'My Documentation',\n siteDescription: 'Documentation for my project',\n \n features: {\n authentication: false,\n changelog: true,\n mermaid: true,\n darkMode: true\n }\n};\n\`\`\`\n\n## Options\n\n### Site Information\n\n- \`siteName\`: Your documentation site name\n- \`siteDescription\`: Brief description\n\n### Directories\n\n- \`docsDir\`: Input directory (default: 'docs')\n- \`outputDir\`: Output directory (default: 'html')\n\n### Features\n\n- \`authentication\`: Enable password protection\n- \`changelog\`: Generate changelog automatically\n- \`mermaid\`: Support for diagrams\n- \`darkMode\`: Dark theme support\n`
|
|
394
430
|
};
|
|
395
431
|
|
|
@@ -419,8 +455,8 @@ ${chalk.yellow('What gets created:')}
|
|
|
419
455
|
// Add a default command handler for when doc-builder is run without arguments
|
|
420
456
|
program
|
|
421
457
|
.action(async () => {
|
|
422
|
-
// Default action is build + deploy
|
|
423
|
-
console.log(chalk.cyan('\n🚀 Building and deploying your documentation...\n'));
|
|
458
|
+
// Default action is build + deploy to production
|
|
459
|
+
console.log(chalk.cyan('\n🚀 Building and deploying your documentation to production...\n'));
|
|
424
460
|
|
|
425
461
|
try {
|
|
426
462
|
// Build first
|
|
@@ -465,7 +501,8 @@ program
|
|
|
465
501
|
deploySpinner.start('Deploying to Vercel...');
|
|
466
502
|
}
|
|
467
503
|
|
|
468
|
-
|
|
504
|
+
// Default to production deployment
|
|
505
|
+
const url = await deployToVercel(config, true);
|
|
469
506
|
deploySpinner.succeed(`Deployed successfully! ${chalk.cyan(url)}`);
|
|
470
507
|
|
|
471
508
|
} catch (error) {
|