@knowcode/doc-builder 1.1.6 → 1.1.8

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 CHANGED
@@ -5,6 +5,31 @@ 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.8] - 2025-07-19
9
+
10
+ ### Changed
11
+ - Deploy command now always builds documentation first
12
+ - Removed `--no-build` option to ensure fresh builds before deployment
13
+ - Simplified deployment workflow - `deploy` now automatically includes build step
14
+
15
+ ### Improved
16
+ - Guaranteed that deployed documentation is always up-to-date
17
+ - Eliminated confusion about when to build vs when to deploy
18
+ - Streamlined user experience with single deploy command
19
+
20
+ ## [1.1.7] - 2025-07-19
21
+
22
+ ### Fixed
23
+ - Fixed CSS and JS assets not loading on deployed Vercel sites
24
+ - Changed all asset paths from relative to absolute URLs (/css/, /js/)
25
+ - Fixed missing styling on deployed documentation
26
+ - Corrected asset path resolution for Vercel's static hosting
27
+
28
+ ### Changed
29
+ - All HTML templates now use absolute paths for CSS and JS files
30
+ - Logo links now use absolute paths for consistent navigation
31
+ - Index.html generation uses absolute asset paths
32
+
8
33
  ## [1.1.6] - 2025-01-19
9
34
 
10
35
  ### Fixed
package/cli.js CHANGED
@@ -124,13 +124,11 @@ program
124
124
  .description('Deploy documentation to Vercel production (requires Vercel CLI)')
125
125
  .option('-c, --config <path>', 'path to config file (default: doc-builder.config.js)')
126
126
  .option('--no-prod', 'deploy as preview instead of production')
127
- .option('--no-build', 'skip building before deployment')
128
127
  .option('--force', 'force deployment without confirmation')
129
128
  .addHelpText('after', `
130
129
  ${chalk.yellow('Examples:')}
131
130
  ${chalk.gray('$')} doc-builder deploy ${chalk.gray('# Deploy to production')}
132
131
  ${chalk.gray('$')} doc-builder deploy --no-prod ${chalk.gray('# Deploy preview only')}
133
- ${chalk.gray('$')} doc-builder deploy --no-build ${chalk.gray('# Deploy existing build')}
134
132
 
135
133
  ${chalk.yellow('First-time Vercel Setup:')}
136
134
 
@@ -269,14 +267,11 @@ ${chalk.yellow('Troubleshooting:')}
269
267
  process.exit(1);
270
268
  }
271
269
 
272
- // Check if we need to build first
273
- const outputPath = path.join(process.cwd(), config.outputDir || 'html');
274
- if (!fs.existsSync(outputPath) || !options.noBuild) {
275
- spinner.stop();
276
- console.log(chalk.blue('\nšŸ“¦ Building documentation first...\n'));
277
- await build(config);
278
- spinner.start('Deploying to Vercel...');
279
- }
270
+ // Always build first
271
+ spinner.stop();
272
+ console.log(chalk.blue('\nšŸ“¦ Building documentation first...\n'));
273
+ await build(config);
274
+ spinner.start('Deploying to Vercel...');
280
275
 
281
276
  // Prepare deployment files
282
277
  await prepareDeployment(config);
@@ -82,7 +82,8 @@ function generateHTML(title, content, navigation, currentPath = '', config = {})
82
82
  <script src="https://cdn.jsdelivr.net/npm/mermaid@10.6.1/dist/mermaid.min.js"></script>
83
83
 
84
84
  <!-- Styles -->
85
- <link rel="stylesheet" href="${relativePath}css/notion-style.css">
85
+ <link rel="stylesheet" href="/css/notion-style.css">
86
+ <link rel="stylesheet" href="/css/style.css">
86
87
 
87
88
  <!-- Favicon -->
88
89
  <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>šŸ“š</text></svg>">
@@ -91,7 +92,7 @@ function generateHTML(title, content, navigation, currentPath = '', config = {})
91
92
  <!-- Header -->
92
93
  <header class="header">
93
94
  <div class="header-content">
94
- <a href="${relativePath}index.html" class="logo">${siteName}</a>
95
+ <a href="/index.html" class="logo">${siteName}</a>
95
96
 
96
97
  <div class="header-actions">
97
98
  <div class="deployment-info">
@@ -138,8 +139,8 @@ function generateHTML(title, content, navigation, currentPath = '', config = {})
138
139
  </div>
139
140
 
140
141
  <!-- Scripts -->
141
- <script src="${relativePath}js/main.js"></script>
142
- ${config.features?.authentication ? `<script src="${relativePath}js/auth.js"></script>` : ''}
142
+ <script src="/js/main.js"></script>
143
+ ${config.features?.authentication ? `<script src="/js/auth.js"></script>` : ''}
143
144
  </body>
144
145
  </html>`;
145
146
  }
package/lib/deploy.js CHANGED
@@ -186,6 +186,17 @@ async function deployToVercel(config, isProd = false) {
186
186
  throw new Error(`Output directory ${outputPath} does not exist. Run 'doc-builder build' first.`);
187
187
  }
188
188
 
189
+ // Check if CSS files exist
190
+ const cssPath = path.join(outputPath, 'css', 'style.css');
191
+ if (!fs.existsSync(cssPath)) {
192
+ console.log(chalk.yellow('\nāš ļø Warning: CSS files not found in output directory!'));
193
+ console.log(chalk.yellow(' Your documentation may appear without styling.'));
194
+ console.log(chalk.cyan('\nšŸ’” To fix this:'));
195
+ console.log(chalk.white(' 1. Update to latest version: ') + chalk.gray('npm update @knowcode/doc-builder'));
196
+ console.log(chalk.white(' 2. Rebuild your docs: ') + chalk.gray('npx @knowcode/doc-builder build'));
197
+ console.log(chalk.white(' 3. Then deploy again: ') + chalk.gray('npx @knowcode/doc-builder deploy\n'));
198
+ }
199
+
189
200
  // Simple deployment message
190
201
  console.log(chalk.blue('\nšŸš€ Starting deployment to Vercel...'));
191
202
  console.log(chalk.gray('This will take a few seconds...\n'));
@@ -343,7 +354,7 @@ async function prepareDeployment(config) {
343
354
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
344
355
  <meta http-equiv="refresh" content="0; url=README.html">
345
356
  <title>Redirecting...</title>
346
- <link rel="stylesheet" href="css/style.css">
357
+ <link rel="stylesheet" href="/css/style.css">
347
358
  </head>
348
359
  <body>
349
360
  <div style="text-align: center; margin-top: 50px;">
@@ -367,8 +378,8 @@ async function prepareDeployment(config) {
367
378
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
368
379
  <title>Documentation</title>
369
380
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
370
- <link rel="stylesheet" href="css/style.css">
371
- <link rel="stylesheet" href="css/notion-style.css">
381
+ <link rel="stylesheet" href="/css/style.css">
382
+ <link rel="stylesheet" href="/css/notion-style.css">
372
383
  </head>
373
384
  <body>
374
385
  <div class="navigation">
@@ -407,7 +418,7 @@ async function prepareDeployment(config) {
407
418
  </div>
408
419
  </div>
409
420
  </div>
410
- <script src="js/main.js"></script>
421
+ <script src="/js/main.js"></script>
411
422
  <style>
412
423
  .doc-card:hover {
413
424
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
@@ -418,6 +429,7 @@ async function prepareDeployment(config) {
418
429
  </html>`;
419
430
  fs.writeFileSync(indexPath, indexHtml);
420
431
  console.log(chalk.green('āœ… Created index.html with file listing'));
432
+ console.log(chalk.yellow('šŸ“Œ Remember to rebuild before deploying to see styling!'));
421
433
  }
422
434
  }
423
435
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowcode/doc-builder",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "Reusable documentation builder for markdown-based sites with Vercel deployment support",
5
5
  "main": "index.js",
6
6
  "bin": {