@knowcode/doc-builder 1.5.9 → 1.5.11

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.
@@ -25,7 +25,8 @@
25
25
  "Bash(vercel alias:*)",
26
26
  "Bash(find:*)",
27
27
  "Bash(diff:*)",
28
- "Bash(git log:*)"
28
+ "Bash(git log:*)",
29
+ "Bash(mkdir:*)"
29
30
  ],
30
31
  "deny": []
31
32
  }
package/CHANGELOG.md CHANGED
@@ -5,6 +5,38 @@ 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.5.11] - 2025-07-22
9
+
10
+ ### Fixed
11
+ - Fixed Vercel deployment error: "routes cannot be present with rewrites"
12
+ - Replaced deprecated `routes` configuration with modern `rewrites` in vercel.json
13
+ - Deployment now works correctly with Vercel's latest API
14
+
15
+ ### Improved
16
+ - Dramatically simplified deployment prompts and warnings
17
+ - Reduced verbosity of console output during deployment
18
+ - Made setup instructions clearer and less intimidating
19
+ - Removed redundant and scary "CRITICAL WARNING" messages
20
+ - Streamlined the first-time deployment experience
21
+
22
+ ### Changed
23
+ - vercel.json now uses `rewrites` instead of deprecated `routes` property
24
+ - Cleaner, more professional console output throughout deployment process
25
+ - Better error messages that are helpful rather than alarming
26
+
27
+ ## [1.5.10] - 2025-07-22
28
+
29
+ ### Fixed
30
+ - Automatically create missing docs directory when running build, dev, or deploy commands
31
+ - No longer fails with "ENOENT: no such file or directory" when docs folder is missing
32
+ - Creates placeholder README.md in newly created docs directory
33
+ - Removed duplicate warning messages about missing docs directory
34
+
35
+ ### Improved
36
+ - Better handling of empty projects - just run `doc-builder build` and it creates everything needed
37
+ - Cleaner console output without redundant warnings
38
+ - Ensures output directory exists before building
39
+
8
40
  ## [1.5.9] - 2025-07-22
9
41
 
10
42
  ### Added
package/cli.js CHANGED
@@ -83,7 +83,7 @@ ${chalk.yellow('Examples:')}
83
83
  const spinner = ora('Building documentation...').start();
84
84
 
85
85
  try {
86
- const config = await loadConfig(options.config || 'doc-builder.config.js', options);
86
+ const config = await loadConfig(options.config || 'doc-builder.config.js', { ...options, command: 'build' });
87
87
  await build(config);
88
88
  spinner.succeed('Documentation built successfully!');
89
89
  } catch (error) {
@@ -112,7 +112,7 @@ ${chalk.yellow('Examples:')}
112
112
  `)
113
113
  .action(async (options) => {
114
114
  try {
115
- const config = await loadConfig(options.config, options);
115
+ const config = await loadConfig(options.config, { ...options, command: 'dev' });
116
116
  await startDevServer(config, options.port);
117
117
  } catch (error) {
118
118
  console.error(chalk.red(error.message));
@@ -645,7 +645,7 @@ ${chalk.yellow('Troubleshooting:')}
645
645
  const spinner = ora('Deploying to Vercel...').start();
646
646
 
647
647
  try {
648
- const config = await loadConfig(options.config || 'doc-builder.config.js', options);
648
+ const config = await loadConfig(options.config || 'doc-builder.config.js', { ...options, command: 'deploy' });
649
649
 
650
650
  // First check if Vercel CLI is installed
651
651
  try {
@@ -683,20 +683,12 @@ ${chalk.yellow('Troubleshooting:')}
683
683
  const vercelProjectPath = path.join(outputPath, '.vercel', 'project.json');
684
684
  if (!fs.existsSync(vercelProjectPath)) {
685
685
  spinner.stop();
686
- console.log(chalk.yellow('\nšŸš€ First time deploying to Vercel!\n'));
687
-
688
- // Show critical warning about Root Directory
689
- console.log(chalk.bgRed.white.bold('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
690
- console.log(chalk.bgRed.white.bold(' āš ļø CRITICAL WARNING - READ BEFORE CONTINUING! '));
691
- console.log(chalk.bgRed.white.bold('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
686
+ console.log(chalk.blue('\nšŸš€ First time deploying to Vercel!\n'));
692
687
 
693
- console.log(chalk.yellow.bold('During setup, if Vercel asks about Root Directory:'));
694
- console.log(chalk.red.bold('• LEAVE IT EMPTY (blank)'));
695
- console.log(chalk.red.bold('• DO NOT ENTER "html"'));
696
- console.log(chalk.red.bold('• We are ALREADY deploying from the html folder!\n'));
697
-
698
- console.log(chalk.white('Setting Root Directory to "html" will cause errors.'));
699
- console.log(chalk.white('You\'ll need to fix it in project settings later.\n'));
688
+ console.log(chalk.yellow('šŸ“ Important: When asked about settings:'));
689
+ console.log(chalk.gray(' • Root Directory: ') + chalk.green('leave empty'));
690
+ console.log(chalk.gray(' • We handle the build process for you'));
691
+ console.log();
700
692
 
701
693
  const setupConfirm = await prompts({
702
694
  type: 'confirm',
package/html/README.html CHANGED
@@ -61,8 +61,8 @@
61
61
  "name": "Knowcode Ltd",
62
62
  "url": "https://knowcode.tech"
63
63
  },
64
- "datePublished": "2025-07-22T08:28:44.971Z",
65
- "dateModified": "2025-07-22T08:28:44.971Z",
64
+ "datePublished": "2025-07-22T08:32:13.098Z",
65
+ "dateModified": "2025-07-22T08:32:13.098Z",
66
66
  "mainEntityOfPage": {
67
67
  "@type": "WebPage",
68
68
  "@id": "https://doc-builder-delta.vercel.app/README.html"
@@ -95,7 +95,7 @@
95
95
 
96
96
  <div class="header-actions">
97
97
  <div class="deployment-info">
98
- <span class="deployment-date" title="Built with doc-builder v1.5.8">Last updated: Jul 22, 2025, 08:28 AM UTC</span>
98
+ <span class="deployment-date" title="Built with doc-builder v1.5.9">Last updated: Jul 22, 2025, 08:32 AM UTC</span>
99
99
  </div>
100
100
 
101
101
 
@@ -61,8 +61,8 @@
61
61
  "name": "Knowcode Ltd",
62
62
  "url": "https://knowcode.tech"
63
63
  },
64
- "datePublished": "2025-07-22T08:28:44.983Z",
65
- "dateModified": "2025-07-22T08:28:44.983Z",
64
+ "datePublished": "2025-07-22T08:32:13.109Z",
65
+ "dateModified": "2025-07-22T08:32:13.109Z",
66
66
  "mainEntityOfPage": {
67
67
  "@type": "WebPage",
68
68
  "@id": "https://doc-builder-delta.vercel.app/documentation-index.html"
@@ -95,7 +95,7 @@
95
95
 
96
96
  <div class="header-actions">
97
97
  <div class="deployment-info">
98
- <span class="deployment-date" title="Built with doc-builder v1.5.8">Last updated: Jul 22, 2025, 08:28 AM UTC</span>
98
+ <span class="deployment-date" title="Built with doc-builder v1.5.9">Last updated: Jul 22, 2025, 08:32 AM UTC</span>
99
99
  </div>
100
100
 
101
101
 
@@ -61,8 +61,8 @@
61
61
  "name": "Knowcode Ltd",
62
62
  "url": "https://knowcode.tech"
63
63
  },
64
- "datePublished": "2025-07-22T08:28:44.986Z",
65
- "dateModified": "2025-07-22T08:28:44.986Z",
64
+ "datePublished": "2025-07-22T08:32:13.111Z",
65
+ "dateModified": "2025-07-22T08:32:13.111Z",
66
66
  "mainEntityOfPage": {
67
67
  "@type": "WebPage",
68
68
  "@id": "https://doc-builder-delta.vercel.app/guides/authentication-guide.html"
@@ -101,7 +101,7 @@
101
101
 
102
102
  <div class="header-actions">
103
103
  <div class="deployment-info">
104
- <span class="deployment-date" title="Built with doc-builder v1.5.8">Last updated: Jul 22, 2025, 08:28 AM UTC</span>
104
+ <span class="deployment-date" title="Built with doc-builder v1.5.9">Last updated: Jul 22, 2025, 08:32 AM UTC</span>
105
105
  </div>
106
106
 
107
107
 
@@ -61,8 +61,8 @@
61
61
  "name": "Knowcode Ltd",
62
62
  "url": "https://knowcode.tech"
63
63
  },
64
- "datePublished": "2025-07-22T08:28:44.989Z",
65
- "dateModified": "2025-07-22T08:28:44.989Z",
64
+ "datePublished": "2025-07-22T08:32:13.114Z",
65
+ "dateModified": "2025-07-22T08:32:13.114Z",
66
66
  "mainEntityOfPage": {
67
67
  "@type": "WebPage",
68
68
  "@id": "https://doc-builder-delta.vercel.app/guides/claude-workflow-guide.html"
@@ -101,7 +101,7 @@
101
101
 
102
102
  <div class="header-actions">
103
103
  <div class="deployment-info">
104
- <span class="deployment-date" title="Built with doc-builder v1.5.8">Last updated: Jul 22, 2025, 08:28 AM UTC</span>
104
+ <span class="deployment-date" title="Built with doc-builder v1.5.9">Last updated: Jul 22, 2025, 08:32 AM UTC</span>
105
105
  </div>
106
106
 
107
107
 
@@ -61,8 +61,8 @@
61
61
  "name": "Knowcode Ltd",
62
62
  "url": "https://knowcode.tech"
63
63
  },
64
- "datePublished": "2025-07-22T08:28:44.992Z",
65
- "dateModified": "2025-07-22T08:28:44.992Z",
64
+ "datePublished": "2025-07-22T08:32:13.118Z",
65
+ "dateModified": "2025-07-22T08:32:13.118Z",
66
66
  "mainEntityOfPage": {
67
67
  "@type": "WebPage",
68
68
  "@id": "https://doc-builder-delta.vercel.app/guides/documentation-standards.html"
@@ -101,7 +101,7 @@
101
101
 
102
102
  <div class="header-actions">
103
103
  <div class="deployment-info">
104
- <span class="deployment-date" title="Built with doc-builder v1.5.8">Last updated: Jul 22, 2025, 08:28 AM UTC</span>
104
+ <span class="deployment-date" title="Built with doc-builder v1.5.9">Last updated: Jul 22, 2025, 08:32 AM UTC</span>
105
105
  </div>
106
106
 
107
107
 
@@ -61,8 +61,8 @@
61
61
  "name": "Knowcode Ltd",
62
62
  "url": "https://knowcode.tech"
63
63
  },
64
- "datePublished": "2025-07-22T08:28:45.000Z",
65
- "dateModified": "2025-07-22T08:28:45.000Z",
64
+ "datePublished": "2025-07-22T08:32:13.126Z",
65
+ "dateModified": "2025-07-22T08:32:13.126Z",
66
66
  "mainEntityOfPage": {
67
67
  "@type": "WebPage",
68
68
  "@id": "https://doc-builder-delta.vercel.app/guides/google-site-verification-guide.html"
@@ -101,7 +101,7 @@
101
101
 
102
102
  <div class="header-actions">
103
103
  <div class="deployment-info">
104
- <span class="deployment-date" title="Built with doc-builder v1.5.8">Last updated: Jul 22, 2025, 08:28 AM UTC</span>
104
+ <span class="deployment-date" title="Built with doc-builder v1.5.9">Last updated: Jul 22, 2025, 08:32 AM UTC</span>
105
105
  </div>
106
106
 
107
107
 
@@ -61,8 +61,8 @@
61
61
  "name": "Knowcode Ltd",
62
62
  "url": "https://knowcode.tech"
63
63
  },
64
- "datePublished": "2025-07-22T08:28:45.004Z",
65
- "dateModified": "2025-07-22T08:28:45.004Z",
64
+ "datePublished": "2025-07-22T08:32:13.130Z",
65
+ "dateModified": "2025-07-22T08:32:13.130Z",
66
66
  "mainEntityOfPage": {
67
67
  "@type": "WebPage",
68
68
  "@id": "https://doc-builder-delta.vercel.app/guides/seo-guide.html"
@@ -101,7 +101,7 @@
101
101
 
102
102
  <div class="header-actions">
103
103
  <div class="deployment-info">
104
- <span class="deployment-date" title="Built with doc-builder v1.5.8">Last updated: Jul 22, 2025, 08:28 AM UTC</span>
104
+ <span class="deployment-date" title="Built with doc-builder v1.5.9">Last updated: Jul 22, 2025, 08:32 AM UTC</span>
105
105
  </div>
106
106
 
107
107
 
@@ -61,8 +61,8 @@
61
61
  "name": "Knowcode Ltd",
62
62
  "url": "https://knowcode.tech"
63
63
  },
64
- "datePublished": "2025-07-22T08:28:45.018Z",
65
- "dateModified": "2025-07-22T08:28:45.018Z",
64
+ "datePublished": "2025-07-22T08:32:13.137Z",
65
+ "dateModified": "2025-07-22T08:32:13.137Z",
66
66
  "mainEntityOfPage": {
67
67
  "@type": "WebPage",
68
68
  "@id": "https://doc-builder-delta.vercel.app/guides/seo-optimization-guide.html"
@@ -101,7 +101,7 @@
101
101
 
102
102
  <div class="header-actions">
103
103
  <div class="deployment-info">
104
- <span class="deployment-date" title="Built with doc-builder v1.5.8">Last updated: Jul 22, 2025, 08:28 AM UTC</span>
104
+ <span class="deployment-date" title="Built with doc-builder v1.5.9">Last updated: Jul 22, 2025, 08:32 AM UTC</span>
105
105
  </div>
106
106
 
107
107
 
@@ -61,8 +61,8 @@
61
61
  "name": "Knowcode Ltd",
62
62
  "url": "https://knowcode.tech"
63
63
  },
64
- "datePublished": "2025-07-22T08:28:45.026Z",
65
- "dateModified": "2025-07-22T08:28:45.026Z",
64
+ "datePublished": "2025-07-22T08:32:13.141Z",
65
+ "dateModified": "2025-07-22T08:32:13.141Z",
66
66
  "mainEntityOfPage": {
67
67
  "@type": "WebPage",
68
68
  "@id": "https://doc-builder-delta.vercel.app/guides/troubleshooting-guide.html"
@@ -101,7 +101,7 @@
101
101
 
102
102
  <div class="header-actions">
103
103
  <div class="deployment-info">
104
- <span class="deployment-date" title="Built with doc-builder v1.5.8">Last updated: Jul 22, 2025, 08:28 AM UTC</span>
104
+ <span class="deployment-date" title="Built with doc-builder v1.5.9">Last updated: Jul 22, 2025, 08:32 AM UTC</span>
105
105
  </div>
106
106
 
107
107
 
package/html/index.html CHANGED
@@ -61,8 +61,8 @@
61
61
  "name": "Knowcode Ltd",
62
62
  "url": "https://knowcode.tech"
63
63
  },
64
- "datePublished": "2025-07-22T08:28:44.971Z",
65
- "dateModified": "2025-07-22T08:28:44.971Z",
64
+ "datePublished": "2025-07-22T08:32:13.098Z",
65
+ "dateModified": "2025-07-22T08:32:13.098Z",
66
66
  "mainEntityOfPage": {
67
67
  "@type": "WebPage",
68
68
  "@id": "https://doc-builder-delta.vercel.app/README.html"
@@ -95,7 +95,7 @@
95
95
 
96
96
  <div class="header-actions">
97
97
  <div class="deployment-info">
98
- <span class="deployment-date" title="Built with doc-builder v1.5.8">Last updated: Jul 22, 2025, 08:28 AM UTC</span>
98
+ <span class="deployment-date" title="Built with doc-builder v1.5.9">Last updated: Jul 22, 2025, 08:32 AM UTC</span>
99
99
  </div>
100
100
 
101
101
 
package/html/sitemap.xml CHANGED
@@ -2,91 +2,91 @@
2
2
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
3
3
  <url>
4
4
  <loc>https://doc-builder-delta.vercel.app/404.html</loc>
5
- <lastmod>2025-07-22T08:28:45.043Z</lastmod>
5
+ <lastmod>2025-07-22T08:32:13.156Z</lastmod>
6
6
  <changefreq>monthly</changefreq>
7
7
  <priority>0.6</priority>
8
8
  </url>
9
9
  <url>
10
10
  <loc>https://doc-builder-delta.vercel.app/README.html</loc>
11
- <lastmod>2025-07-22T08:28:45.043Z</lastmod>
11
+ <lastmod>2025-07-22T08:32:13.156Z</lastmod>
12
12
  <changefreq>monthly</changefreq>
13
13
  <priority>0.6</priority>
14
14
  </url>
15
15
  <url>
16
16
  <loc>https://doc-builder-delta.vercel.app/claude-workflow-guide.html</loc>
17
- <lastmod>2025-07-22T08:28:45.043Z</lastmod>
17
+ <lastmod>2025-07-22T08:32:13.156Z</lastmod>
18
18
  <changefreq>monthly</changefreq>
19
19
  <priority>0.8</priority>
20
20
  </url>
21
21
  <url>
22
22
  <loc>https://doc-builder-delta.vercel.app/documentation-index.html</loc>
23
- <lastmod>2025-07-22T08:28:45.043Z</lastmod>
23
+ <lastmod>2025-07-22T08:32:13.156Z</lastmod>
24
24
  <changefreq>monthly</changefreq>
25
25
  <priority>0.6</priority>
26
26
  </url>
27
27
  <url>
28
28
  <loc>https://doc-builder-delta.vercel.app/guides/authentication-guide.html</loc>
29
- <lastmod>2025-07-22T08:28:45.043Z</lastmod>
29
+ <lastmod>2025-07-22T08:32:13.156Z</lastmod>
30
30
  <changefreq>monthly</changefreq>
31
31
  <priority>0.8</priority>
32
32
  </url>
33
33
  <url>
34
34
  <loc>https://doc-builder-delta.vercel.app/guides/claude-workflow-guide.html</loc>
35
- <lastmod>2025-07-22T08:28:45.043Z</lastmod>
35
+ <lastmod>2025-07-22T08:32:13.156Z</lastmod>
36
36
  <changefreq>monthly</changefreq>
37
37
  <priority>0.8</priority>
38
38
  </url>
39
39
  <url>
40
40
  <loc>https://doc-builder-delta.vercel.app/guides/document-standards.html</loc>
41
- <lastmod>2025-07-22T08:28:45.043Z</lastmod>
41
+ <lastmod>2025-07-22T08:32:13.156Z</lastmod>
42
42
  <changefreq>monthly</changefreq>
43
43
  <priority>0.8</priority>
44
44
  </url>
45
45
  <url>
46
46
  <loc>https://doc-builder-delta.vercel.app/guides/documentation-standards.html</loc>
47
- <lastmod>2025-07-22T08:28:45.043Z</lastmod>
47
+ <lastmod>2025-07-22T08:32:13.156Z</lastmod>
48
48
  <changefreq>monthly</changefreq>
49
49
  <priority>0.8</priority>
50
50
  </url>
51
51
  <url>
52
52
  <loc>https://doc-builder-delta.vercel.app/guides/google-site-verification-guide.html</loc>
53
- <lastmod>2025-07-22T08:28:45.043Z</lastmod>
53
+ <lastmod>2025-07-22T08:32:13.156Z</lastmod>
54
54
  <changefreq>monthly</changefreq>
55
55
  <priority>0.8</priority>
56
56
  </url>
57
57
  <url>
58
58
  <loc>https://doc-builder-delta.vercel.app/guides/seo-guide.html</loc>
59
- <lastmod>2025-07-22T08:28:45.043Z</lastmod>
59
+ <lastmod>2025-07-22T08:32:13.156Z</lastmod>
60
60
  <changefreq>monthly</changefreq>
61
61
  <priority>0.8</priority>
62
62
  </url>
63
63
  <url>
64
64
  <loc>https://doc-builder-delta.vercel.app/guides/seo-optimization-guide.html</loc>
65
- <lastmod>2025-07-22T08:28:45.043Z</lastmod>
65
+ <lastmod>2025-07-22T08:32:13.156Z</lastmod>
66
66
  <changefreq>monthly</changefreq>
67
67
  <priority>0.8</priority>
68
68
  </url>
69
69
  <url>
70
70
  <loc>https://doc-builder-delta.vercel.app/guides/troubleshooting-guide.html</loc>
71
- <lastmod>2025-07-22T08:28:45.043Z</lastmod>
71
+ <lastmod>2025-07-22T08:32:13.156Z</lastmod>
72
72
  <changefreq>monthly</changefreq>
73
73
  <priority>0.8</priority>
74
74
  </url>
75
75
  <url>
76
76
  <loc>https://doc-builder-delta.vercel.app/index.html</loc>
77
- <lastmod>2025-07-22T08:28:45.043Z</lastmod>
77
+ <lastmod>2025-07-22T08:32:13.156Z</lastmod>
78
78
  <changefreq>weekly</changefreq>
79
79
  <priority>1.0</priority>
80
80
  </url>
81
81
  <url>
82
82
  <loc>https://doc-builder-delta.vercel.app/vercel-cli-setup-guide.html</loc>
83
- <lastmod>2025-07-22T08:28:45.043Z</lastmod>
83
+ <lastmod>2025-07-22T08:32:13.156Z</lastmod>
84
84
  <changefreq>monthly</changefreq>
85
85
  <priority>0.8</priority>
86
86
  </url>
87
87
  <url>
88
88
  <loc>https://doc-builder-delta.vercel.app/vercel-first-time-setup-guide.html</loc>
89
- <lastmod>2025-07-22T08:28:45.043Z</lastmod>
89
+ <lastmod>2025-07-22T08:32:13.156Z</lastmod>
90
90
  <changefreq>monthly</changefreq>
91
91
  <priority>0.8</priority>
92
92
  </url>
@@ -61,8 +61,8 @@
61
61
  "name": "Knowcode Ltd",
62
62
  "url": "https://knowcode.tech"
63
63
  },
64
- "datePublished": "2025-07-22T08:28:45.030Z",
65
- "dateModified": "2025-07-22T08:28:45.030Z",
64
+ "datePublished": "2025-07-22T08:32:13.144Z",
65
+ "dateModified": "2025-07-22T08:32:13.144Z",
66
66
  "mainEntityOfPage": {
67
67
  "@type": "WebPage",
68
68
  "@id": "https://doc-builder-delta.vercel.app/vercel-cli-setup-guide.html"
@@ -95,7 +95,7 @@
95
95
 
96
96
  <div class="header-actions">
97
97
  <div class="deployment-info">
98
- <span class="deployment-date" title="Built with doc-builder v1.5.8">Last updated: Jul 22, 2025, 08:28 AM UTC</span>
98
+ <span class="deployment-date" title="Built with doc-builder v1.5.9">Last updated: Jul 22, 2025, 08:32 AM UTC</span>
99
99
  </div>
100
100
 
101
101
 
@@ -61,8 +61,8 @@
61
61
  "name": "Knowcode Ltd",
62
62
  "url": "https://knowcode.tech"
63
63
  },
64
- "datePublished": "2025-07-22T08:28:45.034Z",
65
- "dateModified": "2025-07-22T08:28:45.034Z",
64
+ "datePublished": "2025-07-22T08:32:13.147Z",
65
+ "dateModified": "2025-07-22T08:32:13.147Z",
66
66
  "mainEntityOfPage": {
67
67
  "@type": "WebPage",
68
68
  "@id": "https://doc-builder-delta.vercel.app/vercel-first-time-setup-guide.html"
@@ -95,7 +95,7 @@
95
95
 
96
96
  <div class="header-actions">
97
97
  <div class="deployment-info">
98
- <span class="deployment-date" title="Built with doc-builder v1.5.8">Last updated: Jul 22, 2025, 08:28 AM UTC</span>
98
+ <span class="deployment-date" title="Built with doc-builder v1.5.9">Last updated: Jul 22, 2025, 08:32 AM UTC</span>
99
99
  </div>
100
100
 
101
101
 
package/lib/config.js CHANGED
@@ -251,11 +251,15 @@ async function loadConfig(configPath, options = {}) {
251
251
  }
252
252
  }
253
253
 
254
- // Validate paths - but be lenient for deploy command
254
+ // Validate paths - but be lenient for commands that will create directories
255
255
  const docsPath = path.join(process.cwd(), config.docsDir);
256
256
  if (!fs.existsSync(docsPath)) {
257
- console.warn(chalk.yellow(`Warning: Documentation directory not found: ${config.docsDir}`));
258
- console.log(chalk.gray(`Create it with: mkdir ${config.docsDir} && echo "# Documentation" > ${config.docsDir}/README.md`));
257
+ // Only show warning for commands that don't auto-create the directory
258
+ // The build command will create it automatically
259
+ if (!options || !['build', 'dev', 'deploy'].includes(options.command)) {
260
+ console.warn(chalk.yellow(`Warning: Documentation directory not found: ${config.docsDir}`));
261
+ console.log(chalk.gray(`Create it with: mkdir ${config.docsDir} && echo "# Documentation" > ${config.docsDir}/README.md`));
262
+ }
259
263
  // Don't throw error - let commands handle missing directories appropriately
260
264
  }
261
265
 
@@ -672,6 +672,9 @@ async function buildDocumentation(config) {
672
672
  const packageJson = require('../package.json');
673
673
  console.log(chalk.blue(`šŸ“¦ Using @knowcode/doc-builder v${packageJson.version}`));
674
674
 
675
+ // Ensure output directory exists
676
+ await fs.ensureDir(outputDir);
677
+
675
678
  // Check and create placeholder README.md if missing
676
679
  console.log(chalk.blue('šŸ“‹ Checking documentation structure...'));
677
680
  const readmeGenerated = await createPlaceholderReadme(docsDir, config);
@@ -867,6 +870,17 @@ async function buildDocumentation(config) {
867
870
 
868
871
  // Create placeholder README.md if missing
869
872
  async function createPlaceholderReadme(docsDir, config) {
873
+ // Create docs directory if it doesn't exist
874
+ if (!fs.existsSync(docsDir)) {
875
+ try {
876
+ await fs.ensureDir(docsDir);
877
+ console.log(chalk.yellow(`šŸ“ Created missing docs directory: ${docsDir}`));
878
+ } catch (error) {
879
+ console.error(chalk.red(`Error creating docs directory: ${error.message}`));
880
+ throw error;
881
+ }
882
+ }
883
+
870
884
  const readmePath = path.join(docsDir, 'README.md');
871
885
  const indexPath = path.join(docsDir, 'index.md');
872
886
 
package/lib/deploy.js CHANGED
@@ -94,14 +94,10 @@ async function setupVercelProject(config) {
94
94
  ]
95
95
  }
96
96
  ],
97
- "routes": [
97
+ "rewrites": [
98
98
  {
99
- "handle": "filesystem"
100
- },
101
- {
102
- "src": "/(.*)",
103
- "status": 404,
104
- "dest": "/404.html"
99
+ "source": "/(.*)",
100
+ "destination": "/404.html"
105
101
  }
106
102
  ]
107
103
  };
@@ -130,41 +126,17 @@ async function setupVercelProject(config) {
130
126
  }
131
127
  }
132
128
 
133
- // Run Vercel setup with prominent instructions
134
- console.log(chalk.blue('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
135
- console.log(chalk.blue('šŸ”— Linking to Vercel - IMPORTANT INSTRUCTIONS'));
136
- console.log(chalk.blue('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
137
-
138
- console.log(chalk.yellow('āš ļø FOLLOW THESE ANSWERS CAREFULLY:\n'));
139
-
140
- console.log(chalk.white('1ļøāƒ£ ') + chalk.green('Set up "~/Documents/.../html"?'));
141
- console.log(chalk.white(' šŸ‘‰ Answer: ') + chalk.yellow.bold('YES') + '\n');
142
-
143
- console.log(chalk.white('2ļøāƒ£ ') + chalk.green('Which scope should contain your project?'));
144
- console.log(chalk.white(' šŸ‘‰ Answer: ') + chalk.yellow.bold('Select your account') + ' (usually your username)\n');
145
-
146
- console.log(chalk.white('3ļøāƒ£ ') + chalk.green('Found project "username/html". Link to it?'));
147
- console.log(chalk.white(' šŸ‘‰ Answer: ') + chalk.red.bold('NO') + ' (this is NOT your project!)\n');
148
-
149
- console.log(chalk.white('4ļøāƒ£ ') + chalk.green('Link to different existing project?'));
150
- console.log(chalk.white(' šŸ‘‰ Answer: ') + chalk.yellow.bold('YES') + ' if you have an existing project');
151
- console.log(chalk.white(' šŸ‘‰ Answer: ') + chalk.yellow.bold('NO') + ' to create new project\n');
152
-
153
- console.log(chalk.white('5ļøāƒ£ ') + chalk.yellow('If you answered YES to #4:'));
154
- console.log(chalk.white(' ') + chalk.green('What\'s the name of your existing project?'));
155
- console.log(chalk.white(' šŸ‘‰ Answer: ') + chalk.yellow.bold(answers.projectName) + ' (your existing project name)\n');
156
-
157
- console.log(chalk.white('5ļøāƒ£ ') + chalk.yellow('If you answered NO to #4:'));
158
- console.log(chalk.white(' ') + chalk.green('What is your project name?'));
159
- console.log(chalk.white(' šŸ‘‰ Answer: ') + chalk.yellow.bold(answers.projectName) + ' (e.g., "my-docs" or "gasworld")\n');
160
-
161
- console.log(chalk.red.bold('āš ļø CRITICAL WARNING ABOUT ROOT DIRECTORY:\n'));
162
- console.log(chalk.bgRed.white.bold(' If Vercel asks about Root Directory or shows it in settings: '));
163
- console.log(chalk.bgRed.white.bold(' LEAVE IT COMPLETELY EMPTY! DO NOT ENTER "html"! '));
164
- console.log(chalk.white('\nWe are already in the html folder - setting Root Directory'));
165
- console.log(chalk.white('to "html" will cause "html/html does not exist" errors!\n'));
129
+ // Run Vercel setup with simplified instructions
130
+ console.log(chalk.blue('\nšŸ”— Linking to Vercel...\n'));
166
131
 
167
- console.log(chalk.blue('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
132
+ console.log(chalk.yellow('When Vercel CLI asks:'));
133
+ console.log(chalk.gray('• Set up and deploy: ') + chalk.green('YES'));
134
+ console.log(chalk.gray('• Which scope: ') + chalk.green('Select your account'));
135
+ console.log(chalk.gray('• Link to existing project: ') + chalk.green('YES/NO') + chalk.gray(' (your choice)'));
136
+ console.log(chalk.gray('• Project name: ') + chalk.green(answers.projectName));
137
+ console.log(chalk.gray('• Directory with code: ') + chalk.yellow('./') + chalk.gray(' (current directory)'));
138
+ console.log(chalk.gray('• Modify settings: ') + chalk.red('NO'));
139
+ console.log();
168
140
 
169
141
  try {
170
142
  // Run vercel link from the output directory
@@ -177,37 +149,19 @@ async function setupVercelProject(config) {
177
149
  process.exit(1);
178
150
  }
179
151
 
180
- // Important reminders for Vercel settings
181
- console.log(chalk.red('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
182
- console.log(chalk.red.bold('🚨 CRITICAL POST-SETUP STEP - DO THIS NOW!'));
183
- console.log(chalk.red('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
184
-
185
- console.log(chalk.yellow.bold('Vercel may have set Root Directory incorrectly!\n'));
186
-
187
- console.log(chalk.white.bold('1. GO TO YOUR PROJECT SETTINGS NOW:'));
188
- console.log(chalk.cyan(` https://vercel.com/${answers.projectName}/settings\n`));
189
-
190
- console.log(chalk.white.bold('2. Find "Root Directory" under "Build & Development Settings"\n'));
191
-
192
- console.log(chalk.white.bold('3. CHECK THE VALUE:'));
193
- console.log(chalk.green(' āœ… CORRECT: ') + chalk.green.bold('Empty (blank) or "./"'));
194
- console.log(chalk.red(' āŒ WRONG: ') + chalk.red.bold('"html" or any other value\n'));
195
-
196
- console.log(chalk.white.bold('4. IF IT SAYS "html":'));
197
- console.log(chalk.yellow(' • DELETE the value completely'));
198
- console.log(chalk.yellow(' • Leave it EMPTY'));
199
- console.log(chalk.yellow(' • Click SAVE\n'));
200
-
201
- console.log(chalk.bgRed.white.bold(' Failure to do this will cause deployment errors! '));
202
- console.log();
203
- console.log(chalk.yellow('šŸ” For Public Access:'));
204
- console.log(chalk.white('1. Navigate to Project Settings > General'));
205
- console.log(chalk.white('2. Under "Security", find "Deployment Protection"'));
206
- console.log(chalk.white('3. Set "Deployment Protection" to ') + chalk.yellow.bold('Disabled'));
207
- console.log();
208
- console.log(chalk.cyan('Dashboard URL: https://vercel.com/dashboard'));
152
+ // Post-setup reminder
153
+ console.log(chalk.yellow('\nšŸ“ Quick Setup Check:'));
154
+ console.log(chalk.gray(`1. Visit: https://vercel.com/${answers.projectName}/settings`));
155
+ console.log(chalk.gray('2. Under "Build & Development Settings":'));
156
+ console.log(chalk.gray(' - Root Directory should be ') + chalk.green('empty'));
157
+ console.log(chalk.gray(' - If it shows "html", delete it'));
209
158
  console.log();
210
159
 
160
+ if (answers.publicAccess) {
161
+ console.log(chalk.gray('3. For public access, disable "Deployment Protection"'));
162
+ console.log();
163
+ }
164
+
211
165
  // Add .vercel to .gitignore if not already there
212
166
  const gitignorePath = path.join(process.cwd(), '.gitignore');
213
167
  if (fs.existsSync(gitignorePath)) {
@@ -276,14 +230,10 @@ async function deployToVercel(config, isProd = false) {
276
230
  ]
277
231
  }
278
232
  ],
279
- "routes": [
233
+ "rewrites": [
280
234
  {
281
- "handle": "filesystem"
282
- },
283
- {
284
- "src": "/(.*)",
285
- "status": 404,
286
- "dest": "/404.html"
235
+ "source": "/(.*)",
236
+ "destination": "/404.html"
287
237
  }
288
238
  ]
289
239
  };
@@ -466,33 +416,14 @@ async function deployToVercel(config, isProd = false) {
466
416
  async function prepareDeployment(config) {
467
417
  const outputDir = path.join(process.cwd(), config.outputDir || 'html');
468
418
 
469
- // Log version for debugging
470
- const packageJson = require('../package.json');
471
- console.log(chalk.blue(`\nšŸ“¦ Preparing deployment with @knowcode/doc-builder v${packageJson.version}`));
472
-
473
419
  // Create index.html from README.html if needed
474
- console.log(chalk.blue('\nšŸ“ Deployment preparation - index.html check:'));
475
420
  const indexPath = path.join(outputDir, 'index.html');
476
421
  const readmePath = path.join(outputDir, 'README.html');
477
422
 
478
- console.log(chalk.gray(` - Output directory: ${outputDir}`));
479
- console.log(chalk.gray(` - Output dir exists: ${fs.existsSync(outputDir)}`));
480
-
481
- if (fs.existsSync(outputDir)) {
482
- const files = fs.readdirSync(outputDir);
483
- const htmlFiles = files.filter(f => f.endsWith('.html'));
484
- console.log(chalk.gray(` - Total files: ${files.length}`));
485
- console.log(chalk.gray(` - HTML files: [${htmlFiles.slice(0, 5).join(', ')}${htmlFiles.length > 5 ? '...' : ''}]`));
486
- }
487
-
488
- console.log(chalk.gray(` - Checking index.html: ${fs.existsSync(indexPath) ? 'exists' : 'missing'}`));
489
- console.log(chalk.gray(` - Index path: ${indexPath}`));
490
-
491
423
  // Check if we need to create/replace index.html
492
424
  let shouldCreateIndex = false;
493
425
 
494
426
  if (!fs.existsSync(indexPath)) {
495
- console.log(chalk.yellow(' āš ļø index.html is missing, attempting to create...'));
496
427
  shouldCreateIndex = true;
497
428
  } else {
498
429
  // Check if existing index.html needs replacement
@@ -500,47 +431,25 @@ async function prepareDeployment(config) {
500
431
  const indexContent = fs.readFileSync(indexPath, 'utf8');
501
432
 
502
433
  if (indexStats.size < 3000 || (indexContent.includes('<title>Documentation</title>') && indexContent.includes('<ul>') && !indexContent.includes('class="navigation"'))) {
503
- console.log(chalk.yellow(` āš ļø Existing index.html appears to be a directory listing (${indexStats.size} bytes), will replace`));
504
434
  shouldCreateIndex = true;
505
435
  } else if (!indexContent.includes('@knowcode/doc-builder')) {
506
- console.log(chalk.yellow(' āš ļø Existing index.html was not created by doc-builder, will replace'));
507
436
  shouldCreateIndex = true;
508
437
  }
509
438
  }
510
439
 
511
440
  if (shouldCreateIndex) {
512
- console.log(chalk.gray(` - Checking README.html: ${fs.existsSync(readmePath) ? 'exists' : 'missing'}`));
513
- console.log(chalk.gray(` - README path: ${readmePath}`));
441
+ // Check for README.html
514
442
 
515
443
  if (fs.existsSync(readmePath)) {
516
444
  // Copy README.html to index.html for proper root page
517
- console.log(chalk.blue(' → Copying README.html to index.html...'));
518
445
  try {
519
446
  fs.copyFileSync(readmePath, indexPath);
520
- console.log(chalk.green(' āœ… Successfully copied README.html to index.html'));
521
-
522
- // Verify the copy
523
- if (fs.existsSync(indexPath)) {
524
- const readmeStats = fs.statSync(readmePath);
525
- const indexStats = fs.statSync(indexPath);
526
- console.log(chalk.gray(` - README.html size: ${readmeStats.size} bytes`));
527
- console.log(chalk.gray(` - index.html size: ${indexStats.size} bytes`));
528
-
529
- if (readmeStats.size === indexStats.size) {
530
- console.log(chalk.green(' āœ… File sizes match - copy successful'));
531
- } else {
532
- console.log(chalk.yellow(' āš ļø File sizes do not match!'));
533
- }
534
- } else {
535
- console.log(chalk.red(' āŒ ERROR: index.html was not created after copy!'));
536
- }
537
447
  } catch (error) {
538
- console.log(chalk.red(` āŒ ERROR copying file: ${error.message}`));
539
- console.log(chalk.red(` - Error stack: ${error.stack}`));
448
+ console.error(chalk.red(`Error creating index.html: ${error.message}`));
540
449
  }
541
450
  } else {
542
451
  // If no README.html, find first available HTML file or create informative page
543
- console.log(chalk.yellow('āš ļø No README.html found, looking for other HTML files...'));
452
+ // No README.html, look for other HTML files
544
453
 
545
454
  // Find first available HTML file
546
455
  const htmlFiles = fs.readdirSync(outputDir)
@@ -550,7 +459,7 @@ async function prepareDeployment(config) {
550
459
  if (htmlFiles.length > 0) {
551
460
  // Redirect to first HTML file
552
461
  const firstFile = htmlFiles[0];
553
- console.log(chalk.green(`āœ… Creating index.html redirect to ${firstFile}`));
462
+ // Create index.html redirect
554
463
  const redirectIndex = `<!DOCTYPE html>
555
464
  <html>
556
465
  <head>
@@ -569,48 +478,27 @@ async function prepareDeployment(config) {
569
478
  </body>
570
479
  </html>`;
571
480
  fs.writeFileSync(indexPath, redirectIndex);
572
- console.log(chalk.green(`āœ… Created index.html redirect to ${firstFile}`));
481
+ // Created redirect
573
482
  } else {
574
483
  // No HTML files at all - this should never happen after build
575
- console.log(chalk.red('āŒ No HTML files found in output directory!'));
576
- console.log(chalk.yellow('šŸ“Œ This indicates a build issue. Please run: npx @knowcode/doc-builder build'));
484
+ console.error(chalk.red('No HTML files found. Run: npx @knowcode/doc-builder build'));
577
485
 
578
486
  // Create emergency fallback page
579
487
  const { createDefaultIndexPage } = require('./core-builder');
580
488
  const fallbackIndex = await createDefaultIndexPage(outputDir, config, packageJson.version);
581
489
  fs.writeFileSync(indexPath, fallbackIndex);
582
- console.log(chalk.green('āœ… Created fallback index.html with instructions'));
490
+ // Created fallback index.html
583
491
  }
584
492
  }
585
493
  } else {
586
- console.log(chalk.gray(' āœ“ index.html already exists and appears valid'));
587
- const stats = fs.statSync(indexPath);
588
- console.log(chalk.gray(` - Keeping existing index.html (${stats.size} bytes)`));
494
+ // index.html already exists and is valid
589
495
  }
590
496
 
591
- // Final check - log what files exist
592
- console.log(chalk.blue('\nšŸ“ Final deployment state:'));
593
-
594
- // Double-check index.html one more time
497
+ // Final check
595
498
  const finalIndexExists = fs.existsSync(indexPath);
596
- console.log(chalk[finalIndexExists ? 'green' : 'red'](` - index.html: ${finalIndexExists ? 'EXISTS' : 'MISSING'}`));
597
-
598
- if (finalIndexExists) {
599
- const stats = fs.statSync(indexPath);
600
- console.log(chalk.gray(` - index.html size: ${stats.size} bytes`));
601
- console.log(chalk.gray(` - index.html modified: ${stats.mtime.toISOString()}`));
602
- }
603
-
604
- const finalFiles = fs.readdirSync(outputDir)
605
- .filter(file => file.endsWith('.html'))
606
- .slice(0, 5); // Show first 5 HTML files
607
- console.log(chalk.gray(`\n HTML files in ${outputDir}:`));
608
- finalFiles.forEach(file => {
609
- const size = fs.statSync(path.join(outputDir, file)).size;
610
- console.log(chalk.gray(` - ${file} (${size} bytes)`));
611
- });
612
- if (fs.readdirSync(outputDir).filter(f => f.endsWith('.html')).length > 5) {
613
- console.log(chalk.gray(` - ... and ${fs.readdirSync(outputDir).filter(f => f.endsWith('.html')).length - 5} more HTML files`));
499
+ if (!finalIndexExists) {
500
+ console.error(chalk.red('Failed to create index.html'));
501
+ throw new Error('Deployment preparation failed');
614
502
  }
615
503
  }
616
504
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowcode/doc-builder",
3
- "version": "1.5.9",
3
+ "version": "1.5.11",
4
4
  "description": "Reusable documentation builder for markdown-based sites with Vercel deployment support",
5
5
  "main": "index.js",
6
6
  "bin": {