@knowcode/doc-builder 1.0.9 → 1.0.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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,36 @@ 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.0.11] - 2025-01-19
9
+
10
+ ### Added
11
+ - Comprehensive troubleshooting for "buildCommand" errors in help
12
+ - Troubleshooting for "Project was deleted" errors
13
+ - "Delete and Start Fresh" section in deployment help
14
+ - Enhanced reset-vercel command documentation
15
+
16
+ ### Improved
17
+ - Clearer instructions for handling deleted projects
18
+ - Better organization of troubleshooting scenarios
19
+ - Added specific commands for each error type
20
+
21
+ ## [1.0.10] - 2025-01-19
22
+
23
+ ### Fixed
24
+ - Fixed persistent "buildCommand should be string,null" error
25
+ - vercel.json now explicitly sets buildCommand to empty string
26
+ - Added explicit build environment variables to deployment
27
+ - Added specific error handling for buildCommand conflicts
28
+
29
+ ### Added
30
+ - Better error messages for build settings conflicts
31
+ - Instructions to clear Vercel project settings
32
+ - Alternative reset instructions when settings conflict
33
+
34
+ ### Changed
35
+ - Deploy command now includes build skip flags
36
+ - All build-related fields explicitly set to empty strings
37
+
8
38
  ## [1.0.9] - 2025-01-19
9
39
 
10
40
  ### Fixed
package/cli.js CHANGED
@@ -187,6 +187,17 @@ ${chalk.yellow('Subsequent Deployments:')}
187
187
  ${chalk.gray('$')} npx @knowcode/doc-builder ${chalk.gray('# Deploy preview')}
188
188
  ${chalk.gray('$')} npx @knowcode/doc-builder deploy --prod ${chalk.gray('# Deploy to production')}
189
189
 
190
+ ${chalk.yellow('When All Else Fails - Delete and Start Fresh:')}
191
+ Sometimes the cleanest solution is to delete the Vercel project:
192
+
193
+ 1. Go to your project settings on Vercel
194
+ 2. Scroll to bottom and click ${chalk.red('"Delete Project"')}
195
+ 3. Run: ${chalk.gray('npx @knowcode/doc-builder reset-vercel')}
196
+ 4. Run: ${chalk.gray('npx @knowcode/doc-builder deploy')}
197
+ 5. Create a NEW project with correct settings
198
+
199
+ This removes all conflicting configurations!
200
+
190
201
  ${chalk.yellow('Troubleshooting:')}
191
202
  • ${chalk.cyan('Command not found:')} Install Vercel CLI globally
192
203
  • ${chalk.cyan('Not authenticated:')} Run ${chalk.gray('vercel login')}
@@ -209,6 +220,25 @@ ${chalk.yellow('Troubleshooting:')}
209
220
  2. Run deployment again
210
221
  3. When asked "Link to existing project?" say ${chalk.red.bold('NO')}
211
222
  4. Create a new project with your actual name
223
+
224
+ ${chalk.red.bold('• "buildCommand should be string,null" error:')}
225
+ ${chalk.yellow('Your Vercel project has conflicting build settings.')}
226
+
227
+ ${chalk.green('Fix:')}
228
+ 1. Go to project settings > Build & Development Settings
229
+ 2. Clear ALL fields (Build Command, Output Directory, etc.)
230
+ 3. Save and try again
231
+ ${chalk.gray('OR')}
232
+ Delete the project and start fresh (see below)
233
+
234
+ ${chalk.red.bold('• "Project was deleted or you don\'t have access" error:')}
235
+ ${chalk.yellow('The Vercel project was deleted but local config remains.')}
236
+
237
+ ${chalk.green('Fix:')}
238
+ ${chalk.gray('$')} npx @knowcode/doc-builder reset-vercel
239
+ ${chalk.gray('$')} npx @knowcode/doc-builder deploy
240
+
241
+ This removes old project references and starts fresh
212
242
  `)
213
243
  .action(async (options) => {
214
244
  const spinner = ora('Deploying to Vercel...').start();
@@ -307,6 +337,9 @@ ${chalk.yellow('When to use:')}
307
337
  • After "html/html does not exist" error
308
338
  • When linked to wrong project (e.g., username/html)
309
339
  • When Root Directory settings are incorrect
340
+ • After deleting a Vercel project
341
+ • When you get "Project was deleted" errors
342
+ • Any time you want to start fresh with deployment
310
343
  `)
311
344
  .action(async (options) => {
312
345
  try {
package/lib/deploy.js CHANGED
@@ -58,10 +58,13 @@ async function setupVercelProject(config) {
58
58
  fs.mkdirSync(outputDir, { recursive: true });
59
59
  }
60
60
 
61
- // Create minimal vercel.json for static site
62
- // Only include required fields
61
+ // Create vercel.json that explicitly overrides build settings
63
62
  const vercelConfig = {
64
- outputDirectory: "."
63
+ "buildCommand": "",
64
+ "outputDirectory": ".",
65
+ "devCommand": "",
66
+ "installCommand": "",
67
+ "framework": null
65
68
  };
66
69
 
67
70
  fs.writeJsonSync(vercelConfigPath, vercelConfig, { spaces: 2 });
@@ -194,21 +197,40 @@ async function deployToVercel(config, isProd = false) {
194
197
  // Create vercel.json in output directory for deployment
195
198
  const vercelConfigPath = path.join(outputPath, 'vercel.json');
196
199
  if (!fs.existsSync(vercelConfigPath)) {
197
- // Create minimal vercel.json for static site
200
+ // Create vercel.json that explicitly overrides build settings
198
201
  const vercelConfig = {
199
- outputDirectory: "."
202
+ "buildCommand": "",
203
+ "outputDirectory": ".",
204
+ "devCommand": "",
205
+ "installCommand": "",
206
+ "framework": null
200
207
  };
201
208
  fs.writeJsonSync(vercelConfigPath, vercelConfig, { spaces: 2 });
202
209
  }
203
210
 
204
- // Deploy command
205
- const deployCmd = isProd ? 'vercel --prod' : 'vercel';
211
+ // Deploy command with explicit build settings
212
+ // Override any project settings that might be causing issues
213
+ const deployArgs = [
214
+ '--build-env', 'VERCEL_BUILD_OUTPUT_DIRECTORY=.',
215
+ '--no-clipboard'
216
+ ];
217
+
218
+ if (isProd) {
219
+ deployArgs.push('--prod');
220
+ }
221
+
222
+ const deployCmd = `vercel ${deployArgs.join(' ')}`;
206
223
 
207
224
  try {
208
225
  // Run deployment from the output directory
209
226
  const output = execSync(deployCmd, {
210
227
  cwd: outputPath,
211
- encoding: 'utf8'
228
+ encoding: 'utf8',
229
+ env: {
230
+ ...process.env,
231
+ // Force Vercel to skip build
232
+ VERCEL_BUILD_SKIP: '1'
233
+ }
212
234
  });
213
235
 
214
236
  // Extract URL from output
@@ -234,6 +256,27 @@ async function deployToVercel(config, isProd = false) {
234
256
 
235
257
  throw new Error('Root Directory misconfiguration - see instructions above');
236
258
  }
259
+
260
+ // Check if this is the buildCommand error
261
+ if (error.message && error.message.includes('buildCommand') && error.message.includes('should be string,null')) {
262
+ console.log(chalk.red.bold('\n❌ ERROR: Vercel has saved build settings that conflict!\n'));
263
+ console.log(chalk.yellow('Your Vercel project has build settings that need to be cleared.\n'));
264
+
265
+ console.log(chalk.green.bold('🔧 TO FIX THIS:\n'));
266
+ console.log(chalk.white('Option 1 - Clear project settings:'));
267
+ console.log(chalk.cyan('1. Go to your project settings'));
268
+ console.log(chalk.cyan('2. Under "Build & Development Settings"'));
269
+ console.log(chalk.cyan('3. Clear ALL fields (Build Command, Output Directory, etc.)'));
270
+ console.log(chalk.cyan('4. Save and try again\n'));
271
+
272
+ console.log(chalk.white('Option 2 - Reset and start fresh:'));
273
+ console.log(chalk.cyan('1. Run: npx @knowcode/doc-builder reset-vercel'));
274
+ console.log(chalk.cyan('2. Run: npx @knowcode/doc-builder deploy'));
275
+ console.log(chalk.cyan('3. Create a NEW project (don\'t link to existing)\n'));
276
+
277
+ throw new Error('Build settings conflict - see instructions above');
278
+ }
279
+
237
280
  throw new Error(`Vercel deployment failed: ${error.message}`);
238
281
  }
239
282
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowcode/doc-builder",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "Reusable documentation builder for markdown-based sites with Vercel deployment support",
5
5
  "main": "index.js",
6
6
  "bin": {