@knowcode/doc-builder 1.4.24 → 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,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.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
+
8
20
  ## [1.4.24] - 2025-07-21
9
21
 
10
22
  ### Fixed
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.23">Last updated: Jul 21, 2025, 07:42 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.23">Last updated: Jul 21, 2025, 07:42 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.23">Last updated: Jul 21, 2025, 07:42 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.23">Last updated: Jul 21, 2025, 07:42 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.23">Last updated: Jul 21, 2025, 07:42 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.23">Last updated: Jul 21, 2025, 07:42 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.23">Last updated: Jul 21, 2025, 07:42 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
@@ -282,55 +282,73 @@ async function deployToVercel(config, isProd = false) {
282
282
 
283
283
  vercelProcess.on('close', async (code) => {
284
284
  if (code === 0) {
285
- // Try to get the production URL from Vercel CLI
285
+ // Try to get the production URL from Vercel
286
+ let productionUrl = null;
287
+
286
288
  try {
287
289
  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
290
 
297
- // First try to get from .vercel/project.json
291
+ // Method 1: Check for project domains
298
292
  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];
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;
309
308
  }
310
309
  }
311
310
  }
312
311
  } catch (e) {
313
- // Ignore errors reading project.json
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
+ }
314
335
  }
315
336
 
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;
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`;
327
345
  }
328
346
  }
329
347
  } catch (err) {
330
- // Fallback if we can't get project info
348
+ // All methods failed, use deployment URL
331
349
  }
332
350
 
333
- resolve({ deployUrl, productionUrl: null });
351
+ resolve({ deployUrl, productionUrl });
334
352
  } else {
335
353
  reject(new Error(`Vercel deployment failed with code ${code}`));
336
354
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowcode/doc-builder",
3
- "version": "1.4.24",
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": {