@knowcode/doc-builder 1.4.23 → 1.4.24

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,18 @@ 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.24] - 2025-07-21
9
+
10
+ ### Fixed
11
+ - Deployment now shows the correct production URL from Vercel
12
+ - Uses Vercel CLI to fetch the actual production alias
13
+ - Shows clean URL like `doc-builder-delta.vercel.app` instead of deployment URL
14
+
15
+ ### Background
16
+ - Previously showed deployment URLs like `doc-builder-i02vs7dur-lindsay-1340s-projects.vercel.app`
17
+ - Now queries `vercel project ls` to get the actual production URL
18
+ - Falls back to deployment URL if production URL cannot be determined
19
+
8
20
  ## [1.4.23] - 2025-07-21
9
21
 
10
22
  ### 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.23">Last updated: Jul 21, 2025, 07:42 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.23">Last updated: Jul 21, 2025, 07:42 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.23">Last updated: Jul 21, 2025, 07:42 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.23">Last updated: Jul 21, 2025, 07:42 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.23">Last updated: Jul 21, 2025, 07:42 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.23">Last updated: Jul 21, 2025, 07:42 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.23">Last updated: Jul 21, 2025, 07:42 PM UTC</span>
33
33
  </div>
34
34
 
35
35
 
package/lib/deploy.js CHANGED
@@ -280,9 +280,57 @@ 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 CLI
286
+ try {
287
+ const { execSync } = require('child_process');
288
+ const projectInfo = execSync('vercel project ls', {
289
+ cwd: outputPath,
290
+ encoding: 'utf8',
291
+ stdio: ['pipe', 'pipe', 'ignore']
292
+ });
293
+
294
+ // Try to determine the project name from the deployment URL or .vercel/project.json
295
+ let projectName = null;
296
+
297
+ // First try to get from .vercel/project.json
298
+ try {
299
+ const projectJsonPath = path.join(outputPath, '.vercel', 'project.json');
300
+ if (fs.existsSync(projectJsonPath)) {
301
+ const projectData = fs.readJsonSync(projectJsonPath);
302
+ // Get project name from Vercel API if needed
303
+ const projectId = projectData.projectId;
304
+ if (projectId) {
305
+ // For now, try to extract from deployment URL
306
+ const deployMatch = deployUrl.match(/https:\/\/([^-]+)/);
307
+ if (deployMatch) {
308
+ projectName = deployMatch[1];
309
+ }
310
+ }
311
+ }
312
+ } catch (e) {
313
+ // Ignore errors reading project.json
314
+ }
315
+
316
+ // Extract the production URL for the current project
317
+ const lines = projectInfo.split('\n');
318
+ for (const line of lines) {
319
+ // Look for project by checking if the line contains the deployment URL domain
320
+ const urlMatch = line.match(/https:\/\/[^\s]+\.vercel\.app/);
321
+ if (urlMatch && (
322
+ (projectName && line.toLowerCase().includes(projectName)) ||
323
+ line.includes(deployUrl.split('.')[0].split('//')[1])
324
+ )) {
325
+ resolve({ deployUrl, productionUrl: urlMatch[0] });
326
+ return;
327
+ }
328
+ }
329
+ } catch (err) {
330
+ // Fallback if we can't get project info
331
+ }
332
+
333
+ resolve({ deployUrl, productionUrl: null });
286
334
  } else {
287
335
  reject(new Error(`Vercel deployment failed with code ${code}`));
288
336
  }
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.24",
4
4
  "description": "Reusable documentation builder for markdown-based sites with Vercel deployment support",
5
5
  "main": "index.js",
6
6
  "bin": {