@knowcode/doc-builder 1.4.23 → 1.4.25

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.
@@ -20,7 +20,9 @@
20
20
  "Bash(ls:*)",
21
21
  "Bash(npm run build:*)",
22
22
  "Bash(npm view:*)",
23
- "Bash(npm:*)"
23
+ "Bash(npm:*)",
24
+ "Bash(vercel project:*)",
25
+ "Bash(vercel alias:*)"
24
26
  ],
25
27
  "deny": []
26
28
  }
package/CHANGELOG.md CHANGED
@@ -5,6 +5,30 @@ 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.4.25] - 2025-07-21
9
+
10
+ ### Fixed
11
+ - Improved production URL detection with multiple fallback methods
12
+ - Tries to extract project name and construct standard Vercel URL
13
+ - Better handling of different Vercel URL formats
14
+
15
+ ### Background
16
+ - Previous version didn't correctly parse Vercel's output
17
+ - Now uses multiple methods to determine the production URL
18
+ - Extracts project name from deployment URL as fallback
19
+
20
+ ## [1.4.24] - 2025-07-21
21
+
22
+ ### Fixed
23
+ - Deployment now shows the correct production URL from Vercel
24
+ - Uses Vercel CLI to fetch the actual production alias
25
+ - Shows clean URL like `doc-builder-delta.vercel.app` instead of deployment URL
26
+
27
+ ### Background
28
+ - Previously showed deployment URLs like `doc-builder-i02vs7dur-lindsay-1340s-projects.vercel.app`
29
+ - Now queries `vercel project ls` to get the actual production URL
30
+ - Falls back to deployment URL if production URL cannot be determined
31
+
8
32
  ## [1.4.23] - 2025-07-21
9
33
 
10
34
  ### Added
package/cli.js CHANGED
@@ -314,41 +314,38 @@ ${chalk.yellow('Troubleshooting:')}
314
314
  spinner.start('Deploying to Vercel...');
315
315
  // Default to production deployment
316
316
  const isProduction = options.prod !== false; // Default true unless explicitly --no-prod
317
- const url = await deployToVercel(config, isProduction);
317
+ const result = await deployToVercel(config, isProduction);
318
318
  spinner.succeed(`Deployed successfully!`);
319
319
 
320
- // Extract project name from URL
321
- // For production deployments, show the actual URL returned by Vercel
322
- // For preview deployments, extract the base project name
323
- let projectUrl = url;
324
- let displayUrl = url;
325
-
326
- // If this is a preview URL (has random suffix), try to extract base project name
327
- const urlMatch = url.match(/https:\/\/([^.]+)\.vercel\.app/);
328
- if (urlMatch && urlMatch[1]) {
329
- const fullDomain = urlMatch[1];
330
- // Check if this looks like a preview URL with random suffix
331
- if (fullDomain.match(/-[a-z0-9]{9}$/)) {
332
- // It's a preview URL, extract base project name
333
- const projectName = fullDomain.replace(/-[a-z0-9]{9}$/, '');
334
- projectUrl = `https://${projectName}.vercel.app`;
335
- }
320
+ // Handle both old and new return formats
321
+ let deployUrl, productionUrl;
322
+ if (typeof result === 'string') {
323
+ // Old format - just a URL string
324
+ deployUrl = result;
325
+ productionUrl = null;
326
+ } else {
327
+ // New format - object with deployUrl and productionUrl
328
+ deployUrl = result.deployUrl;
329
+ productionUrl = result.productionUrl;
336
330
  }
337
331
 
332
+ // Use the production URL if available, otherwise show the deployment URL
333
+ const displayUrl = productionUrl || deployUrl;
334
+
338
335
  console.log(chalk.green('\nāœ… Deployment Complete!\n'));
339
336
 
340
337
  if (isProduction) {
341
338
  console.log(chalk.yellow('🌐 Your documentation is live at:'));
342
- console.log(chalk.cyan.bold(` ${projectUrl}`) + chalk.gray(' (Production URL - share this!)'));
339
+ console.log(chalk.cyan.bold(` ${displayUrl}`) + chalk.gray(' (Production URL - share this!)'));
343
340
  console.log();
344
- if (projectUrl !== url) {
341
+ if (productionUrl && deployUrl && productionUrl !== deployUrl) {
345
342
  console.log(chalk.gray('This deployment also created a unique preview URL:'));
346
- console.log(chalk.gray(` ${url}`));
343
+ console.log(chalk.gray(` ${deployUrl}`));
347
344
  console.log(chalk.gray(' (This URL is specific to this deployment)'));
348
345
  }
349
346
  } else {
350
347
  console.log(chalk.yellow('šŸ” Preview deployment created at:'));
351
- console.log(chalk.cyan(` ${url}`));
348
+ console.log(chalk.cyan(` ${deployUrl}`));
352
349
  console.log();
353
350
  console.log(chalk.gray('To deploy to production, run:'));
354
351
  console.log(chalk.gray(' npx @knowcode/doc-builder deploy'));
package/html/README.html CHANGED
@@ -29,7 +29,7 @@
29
29
 
30
30
  <div class="header-actions">
31
31
  <div class="deployment-info">
32
- <span class="deployment-date" title="Built with doc-builder v1.4.21">Last updated: Jul 21, 2025, 07:39 PM UTC</span>
32
+ <span class="deployment-date" title="Built with doc-builder v1.4.24">Last updated: Jul 21, 2025, 07:50 PM UTC</span>
33
33
  </div>
34
34
 
35
35
 
@@ -29,7 +29,7 @@
29
29
 
30
30
  <div class="header-actions">
31
31
  <div class="deployment-info">
32
- <span class="deployment-date" title="Built with doc-builder v1.4.21">Last updated: Jul 21, 2025, 07:39 PM UTC</span>
32
+ <span class="deployment-date" title="Built with doc-builder v1.4.24">Last updated: Jul 21, 2025, 07:50 PM UTC</span>
33
33
  </div>
34
34
 
35
35
 
@@ -974,7 +974,7 @@ tr:hover {
974
974
 
975
975
  .content {
976
976
  margin-left: 0;
977
- padding: var(--space-6) var(--space-4);
977
+ padding: var(--space-3) var(--space-4); /* Reduced top/bottom padding on mobile */
978
978
  }
979
979
 
980
980
  .menu-toggle {
@@ -1596,7 +1596,7 @@ tr:hover {
1596
1596
  /* Sidebar positioning handled in earlier media query */
1597
1597
 
1598
1598
  .content {
1599
- padding: var(--space-4);
1599
+ padding: var(--space-3) var(--space-4); /* Consistent reduced padding on mobile */
1600
1600
  }
1601
1601
 
1602
1602
  .content-inner {
@@ -1609,10 +1609,7 @@ tr:hover {
1609
1609
  padding: 0 var(--space-4);
1610
1610
  }
1611
1611
 
1612
- .preview-banner {
1613
- position: relative;
1614
- top: 0;
1615
- }
1612
+ /* Keep preview banner fixed on mobile */
1616
1613
 
1617
1614
  /* Keep breadcrumbs fixed on mobile to prevent double spacing */
1618
1615
  }
@@ -29,7 +29,7 @@
29
29
 
30
30
  <div class="header-actions">
31
31
  <div class="deployment-info">
32
- <span class="deployment-date" title="Built with doc-builder v1.4.21">Last updated: Jul 21, 2025, 07:39 PM UTC</span>
32
+ <span class="deployment-date" title="Built with doc-builder v1.4.24">Last updated: Jul 21, 2025, 07:50 PM UTC</span>
33
33
  </div>
34
34
 
35
35
 
@@ -29,7 +29,7 @@
29
29
 
30
30
  <div class="header-actions">
31
31
  <div class="deployment-info">
32
- <span class="deployment-date" title="Built with doc-builder v1.4.21">Last updated: Jul 21, 2025, 07:39 PM UTC</span>
32
+ <span class="deployment-date" title="Built with doc-builder v1.4.24">Last updated: Jul 21, 2025, 07:50 PM UTC</span>
33
33
  </div>
34
34
 
35
35
 
@@ -29,7 +29,7 @@
29
29
 
30
30
  <div class="header-actions">
31
31
  <div class="deployment-info">
32
- <span class="deployment-date" title="Built with doc-builder v1.4.21">Last updated: Jul 21, 2025, 07:39 PM UTC</span>
32
+ <span class="deployment-date" title="Built with doc-builder v1.4.24">Last updated: Jul 21, 2025, 07:50 PM UTC</span>
33
33
  </div>
34
34
 
35
35
 
@@ -29,7 +29,7 @@
29
29
 
30
30
  <div class="header-actions">
31
31
  <div class="deployment-info">
32
- <span class="deployment-date" title="Built with doc-builder v1.4.21">Last updated: Jul 21, 2025, 07:39 PM UTC</span>
32
+ <span class="deployment-date" title="Built with doc-builder v1.4.24">Last updated: Jul 21, 2025, 07:50 PM UTC</span>
33
33
  </div>
34
34
 
35
35
 
package/html/index.html CHANGED
@@ -29,7 +29,7 @@
29
29
 
30
30
  <div class="header-actions">
31
31
  <div class="deployment-info">
32
- <span class="deployment-date" title="Built with doc-builder v1.4.21">Last updated: Jul 21, 2025, 07:39 PM UTC</span>
32
+ <span class="deployment-date" title="Built with doc-builder v1.4.24">Last updated: Jul 21, 2025, 07:50 PM UTC</span>
33
33
  </div>
34
34
 
35
35
 
package/lib/deploy.js CHANGED
@@ -280,9 +280,75 @@ async function deployToVercel(config, isProd = false) {
280
280
  process.stderr.write(data.toString());
281
281
  });
282
282
 
283
- vercelProcess.on('close', (code) => {
283
+ vercelProcess.on('close', async (code) => {
284
284
  if (code === 0) {
285
- resolve(deployUrl || 'Check Vercel dashboard');
285
+ // Try to get the production URL from Vercel
286
+ let productionUrl = null;
287
+
288
+ try {
289
+ const { execSync } = require('child_process');
290
+
291
+ // Method 1: Check for project domains
292
+ try {
293
+ const domainsOutput = execSync('vercel domains ls', {
294
+ cwd: outputPath,
295
+ encoding: 'utf8',
296
+ stdio: ['pipe', 'pipe', 'ignore']
297
+ });
298
+
299
+ // Look for domains associated with this project
300
+ const domainLines = domainsOutput.split('\n');
301
+ for (const line of domainLines) {
302
+ if (line.includes('.vercel.app') && !line.includes('source')) {
303
+ // Extract domain that looks like a custom project domain
304
+ const match = line.match(/([a-z0-9-]+\.vercel\.app)/);
305
+ if (match && !match[1].includes('lindsay-1340s-projects')) {
306
+ productionUrl = `https://${match[1]}`;
307
+ break;
308
+ }
309
+ }
310
+ }
311
+ } catch (e) {
312
+ // domains command might not be available
313
+ }
314
+
315
+ // Method 2: Get project info and construct standard production URL
316
+ if (!productionUrl) {
317
+ try {
318
+ // Get the project name from the deployment
319
+ const inspectOutput = execSync(`vercel inspect ${deployUrl}`, {
320
+ cwd: outputPath,
321
+ encoding: 'utf8',
322
+ stdio: ['pipe', 'pipe', 'ignore']
323
+ });
324
+
325
+ // Extract project name from inspect output
326
+ const projectMatch = inspectOutput.match(/Project Name:\s+([^\s]+)/);
327
+ if (projectMatch) {
328
+ const projectName = projectMatch[1];
329
+ // Construct the standard production URL
330
+ productionUrl = `https://${projectName}.vercel.app`;
331
+ }
332
+ } catch (e) {
333
+ // inspect command failed
334
+ }
335
+ }
336
+
337
+ // Method 3: Extract from deployment URL pattern
338
+ if (!productionUrl && deployUrl) {
339
+ // Try to extract project name from deployment URL
340
+ // Format: https://project-name-randomhash-team.vercel.app
341
+ const urlMatch = deployUrl.match(/https:\/\/([^-]+)-[a-z0-9]+-/);
342
+ if (urlMatch) {
343
+ const projectName = urlMatch[1];
344
+ productionUrl = `https://${projectName}.vercel.app`;
345
+ }
346
+ }
347
+ } catch (err) {
348
+ // All methods failed, use deployment URL
349
+ }
350
+
351
+ resolve({ deployUrl, productionUrl });
286
352
  } else {
287
353
  reject(new Error(`Vercel deployment failed with code ${code}`));
288
354
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowcode/doc-builder",
3
- "version": "1.4.23",
3
+ "version": "1.4.25",
4
4
  "description": "Reusable documentation builder for markdown-based sites with Vercel deployment support",
5
5
  "main": "index.js",
6
6
  "bin": {