@knowcode/doc-builder 1.0.6 → 1.0.8
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 +38 -0
- package/cli.js +71 -0
- package/lib/deploy.js +65 -12
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,44 @@ 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.8] - 2025-01-19
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Extremely prominent Root Directory warnings throughout setup
|
|
12
|
+
- Red background critical warnings before setup begins
|
|
13
|
+
- Clear post-setup instructions with visual formatting
|
|
14
|
+
- Step-by-step Root Directory fix instructions after linking
|
|
15
|
+
- Warning in help text about Root Directory configuration
|
|
16
|
+
|
|
17
|
+
### Improved
|
|
18
|
+
- Made Root Directory warnings impossible to miss
|
|
19
|
+
- Added visual boxes and colors to critical warnings
|
|
20
|
+
- Enhanced setup flow with pre-deployment warnings
|
|
21
|
+
- Better formatting of post-setup instructions
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
- All setup flows now show Root Directory warning first
|
|
25
|
+
- Both deploy command and default flow show warnings
|
|
26
|
+
|
|
27
|
+
## [1.0.7] - 2025-01-19
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
- New `reset-vercel` command to fix deployment issues
|
|
31
|
+
- Pre-deployment warning about Root Directory settings
|
|
32
|
+
- Automatic detection of "html/html does not exist" error with clear fix instructions
|
|
33
|
+
- Visual deployment status with project information
|
|
34
|
+
- Better error messages that extract and show the settings URL
|
|
35
|
+
|
|
36
|
+
### Improved
|
|
37
|
+
- Enhanced error handling with specific instructions for Root Directory issues
|
|
38
|
+
- Clear visual separation for deployment warnings
|
|
39
|
+
- More prominent pre-deployment checks
|
|
40
|
+
- Direct links to Vercel project settings
|
|
41
|
+
|
|
42
|
+
### Fixed
|
|
43
|
+
- Better handling of the common "html/html" path error
|
|
44
|
+
- Clearer recovery instructions when deployment fails
|
|
45
|
+
|
|
8
46
|
## [1.0.6] - 2025-01-19
|
|
9
47
|
|
|
10
48
|
### Added
|
package/cli.js
CHANGED
|
@@ -149,6 +149,12 @@ ${chalk.yellow('First-time Vercel Setup:')}
|
|
|
149
149
|
${chalk.green('Q: What is your project name?')}
|
|
150
150
|
→ Answer: ${chalk.yellow('Your project name')} (e.g., "my-docs" or "gasworld")
|
|
151
151
|
|
|
152
|
+
${chalk.bgRed.white.bold(' ⚠️ CRITICAL: ABOUT ROOT DIRECTORY ')}
|
|
153
|
+
${chalk.red('If asked about Root Directory at ANY point:')}
|
|
154
|
+
${chalk.red('• LEAVE IT EMPTY (blank)')}
|
|
155
|
+
${chalk.red('• DO NOT enter "html"')}
|
|
156
|
+
${chalk.red('• We deploy FROM html folder already!')}
|
|
157
|
+
|
|
152
158
|
${chalk.green('Q: Which framework preset?')}
|
|
153
159
|
→ Answer: ${chalk.yellow('Other (Static HTML)')} (always choose this)
|
|
154
160
|
|
|
@@ -243,6 +249,19 @@ ${chalk.yellow('Troubleshooting:')}
|
|
|
243
249
|
spinner.stop();
|
|
244
250
|
console.log(chalk.yellow('\n🚀 First time deploying to Vercel!\n'));
|
|
245
251
|
|
|
252
|
+
// Show critical warning about Root Directory
|
|
253
|
+
console.log(chalk.bgRed.white.bold('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
|
|
254
|
+
console.log(chalk.bgRed.white.bold(' ⚠️ CRITICAL WARNING - READ BEFORE CONTINUING! '));
|
|
255
|
+
console.log(chalk.bgRed.white.bold('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
|
|
256
|
+
|
|
257
|
+
console.log(chalk.yellow.bold('During setup, if Vercel asks about Root Directory:'));
|
|
258
|
+
console.log(chalk.red.bold('• LEAVE IT EMPTY (blank)'));
|
|
259
|
+
console.log(chalk.red.bold('• DO NOT ENTER "html"'));
|
|
260
|
+
console.log(chalk.red.bold('• We are ALREADY deploying from the html folder!\n'));
|
|
261
|
+
|
|
262
|
+
console.log(chalk.white('Setting Root Directory to "html" will cause errors.'));
|
|
263
|
+
console.log(chalk.white('You\'ll need to fix it in project settings later.\n'));
|
|
264
|
+
|
|
246
265
|
const setupConfirm = await prompts({
|
|
247
266
|
type: 'confirm',
|
|
248
267
|
name: 'value',
|
|
@@ -272,6 +291,48 @@ ${chalk.yellow('Troubleshooting:')}
|
|
|
272
291
|
}
|
|
273
292
|
});
|
|
274
293
|
|
|
294
|
+
// Reset command for Vercel issues
|
|
295
|
+
program
|
|
296
|
+
.command('reset-vercel')
|
|
297
|
+
.description('Reset Vercel configuration (fixes common deployment issues)')
|
|
298
|
+
.option('-c, --config <path>', 'path to config file (default: doc-builder.config.js)')
|
|
299
|
+
.addHelpText('after', `
|
|
300
|
+
${chalk.yellow('What this does:')}
|
|
301
|
+
• Removes .vercel folder from your output directory
|
|
302
|
+
• Lets you set up a fresh Vercel project
|
|
303
|
+
• Fixes "html/html does not exist" errors
|
|
304
|
+
• Fixes wrong project linking issues
|
|
305
|
+
|
|
306
|
+
${chalk.yellow('When to use:')}
|
|
307
|
+
• After "html/html does not exist" error
|
|
308
|
+
• When linked to wrong project (e.g., username/html)
|
|
309
|
+
• When Root Directory settings are incorrect
|
|
310
|
+
`)
|
|
311
|
+
.action(async (options) => {
|
|
312
|
+
try {
|
|
313
|
+
const config = await loadConfig(options.config || 'doc-builder.config.js', options);
|
|
314
|
+
const outputPath = path.join(process.cwd(), config.outputDir || 'html');
|
|
315
|
+
const vercelPath = path.join(outputPath, '.vercel');
|
|
316
|
+
|
|
317
|
+
if (fs.existsSync(vercelPath)) {
|
|
318
|
+
console.log(chalk.yellow('🗑️ Removing .vercel folder from ' + config.outputDir + '...'));
|
|
319
|
+
fs.removeSync(vercelPath);
|
|
320
|
+
console.log(chalk.green('✅ Vercel configuration reset!'));
|
|
321
|
+
console.log(chalk.gray('\nNow run deployment again:'));
|
|
322
|
+
console.log(chalk.cyan(' npx @knowcode/doc-builder deploy'));
|
|
323
|
+
console.log(chalk.gray('\nThis time:'));
|
|
324
|
+
console.log(chalk.gray('• Create a NEW project (not username/html)'));
|
|
325
|
+
console.log(chalk.gray('• Use a descriptive name like "my-docs"'));
|
|
326
|
+
console.log(chalk.gray('• Leave Root Directory EMPTY'));
|
|
327
|
+
} else {
|
|
328
|
+
console.log(chalk.gray('No .vercel folder found. Ready for fresh deployment!'));
|
|
329
|
+
}
|
|
330
|
+
} catch (error) {
|
|
331
|
+
console.error(chalk.red(error.message));
|
|
332
|
+
process.exit(1);
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
|
|
275
336
|
// Init command
|
|
276
337
|
program
|
|
277
338
|
.command('init')
|
|
@@ -377,6 +438,16 @@ program
|
|
|
377
438
|
deploySpinner.stop();
|
|
378
439
|
console.log(chalk.yellow('\n🚀 First time deploying to Vercel!\n'));
|
|
379
440
|
|
|
441
|
+
// Show critical warning about Root Directory
|
|
442
|
+
console.log(chalk.bgRed.white.bold('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
|
|
443
|
+
console.log(chalk.bgRed.white.bold(' ⚠️ CRITICAL WARNING - READ BEFORE CONTINUING! '));
|
|
444
|
+
console.log(chalk.bgRed.white.bold('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
|
|
445
|
+
|
|
446
|
+
console.log(chalk.yellow.bold('During setup, if Vercel asks about Root Directory:'));
|
|
447
|
+
console.log(chalk.red.bold('• LEAVE IT EMPTY (blank)'));
|
|
448
|
+
console.log(chalk.red.bold('• DO NOT ENTER "html"'));
|
|
449
|
+
console.log(chalk.red.bold('• We are ALREADY deploying from the html folder!\n'));
|
|
450
|
+
|
|
380
451
|
const setupConfirm = await prompts({
|
|
381
452
|
type: 'confirm',
|
|
382
453
|
name: 'value',
|
package/lib/deploy.js
CHANGED
|
@@ -93,6 +93,12 @@ async function setupVercelProject(config) {
|
|
|
93
93
|
console.log(chalk.white('5️⃣ ') + chalk.green('What\'s the name of your existing project?'));
|
|
94
94
|
console.log(chalk.white(' 👉 Answer: ') + chalk.yellow.bold(answers.projectName) + ' (your actual project name)\n');
|
|
95
95
|
|
|
96
|
+
console.log(chalk.red.bold('⚠️ CRITICAL WARNING ABOUT ROOT DIRECTORY:\n'));
|
|
97
|
+
console.log(chalk.bgRed.white.bold(' If Vercel asks about Root Directory or shows it in settings: '));
|
|
98
|
+
console.log(chalk.bgRed.white.bold(' LEAVE IT COMPLETELY EMPTY! DO NOT ENTER "html"! '));
|
|
99
|
+
console.log(chalk.white('\nWe are already in the html folder - setting Root Directory'));
|
|
100
|
+
console.log(chalk.white('to "html" will cause "html/html does not exist" errors!\n'));
|
|
101
|
+
|
|
96
102
|
console.log(chalk.blue('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
|
|
97
103
|
|
|
98
104
|
try {
|
|
@@ -107,14 +113,27 @@ async function setupVercelProject(config) {
|
|
|
107
113
|
}
|
|
108
114
|
|
|
109
115
|
// Important reminders for Vercel settings
|
|
110
|
-
console.log(chalk.
|
|
111
|
-
console.log(chalk.
|
|
112
|
-
console.log();
|
|
113
|
-
|
|
114
|
-
console.log(chalk.
|
|
115
|
-
|
|
116
|
-
console.log(chalk.white('
|
|
117
|
-
console.log(chalk.
|
|
116
|
+
console.log(chalk.red('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
|
|
117
|
+
console.log(chalk.red.bold('🚨 CRITICAL POST-SETUP STEP - DO THIS NOW!'));
|
|
118
|
+
console.log(chalk.red('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
|
|
119
|
+
|
|
120
|
+
console.log(chalk.yellow.bold('Vercel may have set Root Directory incorrectly!\n'));
|
|
121
|
+
|
|
122
|
+
console.log(chalk.white.bold('1. GO TO YOUR PROJECT SETTINGS NOW:'));
|
|
123
|
+
console.log(chalk.cyan(` https://vercel.com/${answers.projectName}/settings\n`));
|
|
124
|
+
|
|
125
|
+
console.log(chalk.white.bold('2. Find "Root Directory" under "Build & Development Settings"\n'));
|
|
126
|
+
|
|
127
|
+
console.log(chalk.white.bold('3. CHECK THE VALUE:'));
|
|
128
|
+
console.log(chalk.green(' ✅ CORRECT: ') + chalk.green.bold('Empty (blank) or "./"'));
|
|
129
|
+
console.log(chalk.red(' ❌ WRONG: ') + chalk.red.bold('"html" or any other value\n'));
|
|
130
|
+
|
|
131
|
+
console.log(chalk.white.bold('4. IF IT SAYS "html":'));
|
|
132
|
+
console.log(chalk.yellow(' • DELETE the value completely'));
|
|
133
|
+
console.log(chalk.yellow(' • Leave it EMPTY'));
|
|
134
|
+
console.log(chalk.yellow(' • Click SAVE\n'));
|
|
135
|
+
|
|
136
|
+
console.log(chalk.bgRed.white.bold(' Failure to do this will cause deployment errors! '));
|
|
118
137
|
console.log();
|
|
119
138
|
console.log(chalk.yellow('🔐 For Public Access:'));
|
|
120
139
|
console.log(chalk.white('1. Navigate to Project Settings > General'));
|
|
@@ -145,14 +164,31 @@ async function deployToVercel(config, isProd = false) {
|
|
|
145
164
|
throw new Error(`Output directory ${outputPath} does not exist. Run 'doc-builder build' first.`);
|
|
146
165
|
}
|
|
147
166
|
|
|
148
|
-
// Check for existing project link
|
|
167
|
+
// Check for existing project link and warn about common issues
|
|
149
168
|
const vercelProjectPath = path.join(outputPath, '.vercel', 'project.json');
|
|
150
169
|
if (fs.existsSync(vercelProjectPath)) {
|
|
151
170
|
try {
|
|
152
171
|
const projectInfo = fs.readJsonSync(vercelProjectPath);
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
console.log(chalk.
|
|
172
|
+
const projectId = projectInfo.projectId || 'unknown';
|
|
173
|
+
|
|
174
|
+
console.log(chalk.blue('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
|
|
175
|
+
console.log(chalk.yellow('📦 Deploying to existing Vercel project'));
|
|
176
|
+
console.log(chalk.blue('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
|
|
177
|
+
|
|
178
|
+
console.log(chalk.white('Project ID: ') + chalk.cyan(projectId));
|
|
179
|
+
|
|
180
|
+
// Check if .vercel/project.json has rootDirectory set
|
|
181
|
+
if (projectInfo.settings && projectInfo.settings.rootDirectory) {
|
|
182
|
+
console.log(chalk.red.bold('\n⚠️ WARNING: Root Directory is set to: ') + chalk.yellow(projectInfo.settings.rootDirectory));
|
|
183
|
+
console.log(chalk.red('This may cause deployment to fail!\n'));
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
console.log(chalk.yellow.bold('\n⚡ BEFORE CONTINUING:'));
|
|
187
|
+
console.log(chalk.white('1. Check your Root Directory setting at:'));
|
|
188
|
+
console.log(chalk.cyan(` https://vercel.com/dashboard/project/${projectId}`));
|
|
189
|
+
console.log(chalk.white('2. Root Directory should be ') + chalk.green.bold('EMPTY (blank)'));
|
|
190
|
+
console.log(chalk.white('3. If it says "html", ') + chalk.red.bold('DELETE IT NOW!\n'));
|
|
191
|
+
|
|
156
192
|
} catch (e) {
|
|
157
193
|
// Ignore read errors
|
|
158
194
|
}
|
|
@@ -186,6 +222,23 @@ async function deployToVercel(config, isProd = false) {
|
|
|
186
222
|
|
|
187
223
|
return deployUrl;
|
|
188
224
|
} catch (error) {
|
|
225
|
+
// Check if this is the common "html/html" path error
|
|
226
|
+
if (error.message && error.message.includes('html/html') && error.message.includes('does not exist')) {
|
|
227
|
+
console.log(chalk.red.bold('\n❌ ERROR: Vercel has incorrect Root Directory settings!\n'));
|
|
228
|
+
console.log(chalk.yellow('The project is configured with Root Directory = "html"'));
|
|
229
|
+
console.log(chalk.yellow('But we are already deploying FROM the html directory.\n'));
|
|
230
|
+
|
|
231
|
+
console.log(chalk.green.bold('🔧 TO FIX THIS:\n'));
|
|
232
|
+
console.log(chalk.white('1. Go to: ') + chalk.cyan(error.message.match(/https:\/\/vercel\.com\/[^\s]+/)?.[0] || 'https://vercel.com/dashboard'));
|
|
233
|
+
console.log(chalk.white('2. Find "Root Directory" under "Build & Development Settings"'));
|
|
234
|
+
console.log(chalk.white('3. ') + chalk.yellow.bold('DELETE the "html" value (leave it EMPTY)'));
|
|
235
|
+
console.log(chalk.white('4. Click "Save"'));
|
|
236
|
+
console.log(chalk.white('5. Run this command again\n'));
|
|
237
|
+
|
|
238
|
+
console.log(chalk.gray('Alternative: Delete html/.vercel folder and set up fresh'));
|
|
239
|
+
|
|
240
|
+
throw new Error('Root Directory misconfiguration - see instructions above');
|
|
241
|
+
}
|
|
189
242
|
throw new Error(`Vercel deployment failed: ${error.message}`);
|
|
190
243
|
}
|
|
191
244
|
}
|