@knowcode/doc-builder 1.0.9 → 1.0.10

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,23 @@ 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.10] - 2025-01-19
9
+
10
+ ### Fixed
11
+ - Fixed persistent "buildCommand should be string,null" error
12
+ - vercel.json now explicitly sets buildCommand to empty string
13
+ - Added explicit build environment variables to deployment
14
+ - Added specific error handling for buildCommand conflicts
15
+
16
+ ### Added
17
+ - Better error messages for build settings conflicts
18
+ - Instructions to clear Vercel project settings
19
+ - Alternative reset instructions when settings conflict
20
+
21
+ ### Changed
22
+ - Deploy command now includes build skip flags
23
+ - All build-related fields explicitly set to empty strings
24
+
8
25
  ## [1.0.9] - 2025-01-19
9
26
 
10
27
  ### Fixed
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.10",
4
4
  "description": "Reusable documentation builder for markdown-based sites with Vercel deployment support",
5
5
  "main": "index.js",
6
6
  "bin": {