@knowcode/doc-builder 1.0.5 → 1.0.6
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 +20 -0
- package/cli.js +18 -0
- package/lib/deploy.js +54 -15
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,26 @@ 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.6] - 2025-01-19
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Much more prominent and helpful Vercel setup instructions
|
|
12
|
+
- Step-by-step visual guide with numbered steps and emojis
|
|
13
|
+
- Warning about common "username/html" project linking mistake
|
|
14
|
+
- Detection and warning for existing project deployments
|
|
15
|
+
- Comprehensive troubleshooting for "html/html does not exist" error
|
|
16
|
+
- Clear instructions for fixing Root Directory settings
|
|
17
|
+
|
|
18
|
+
### Improved
|
|
19
|
+
- Enhanced visual formatting for Vercel prompts with boxes and colors
|
|
20
|
+
- Added critical warnings about NOT linking to generic "html" projects
|
|
21
|
+
- Better error detection and user guidance
|
|
22
|
+
- More helpful project settings URLs
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
- Updated vercel.json to use empty strings instead of false values
|
|
26
|
+
- Added installCommand to vercel.json for better compatibility
|
|
27
|
+
|
|
8
28
|
## [1.0.5] - 2025-01-19
|
|
9
29
|
|
|
10
30
|
### Fixed
|
package/cli.js
CHANGED
|
@@ -185,6 +185,24 @@ ${chalk.yellow('Troubleshooting:')}
|
|
|
185
185
|
• ${chalk.cyan('Command not found:')} Install Vercel CLI globally
|
|
186
186
|
• ${chalk.cyan('Not authenticated:')} Run ${chalk.gray('vercel login')}
|
|
187
187
|
• ${chalk.cyan('Project not linked:')} Delete ${chalk.gray('.vercel')} folder and redeploy
|
|
188
|
+
|
|
189
|
+
${chalk.red.bold('• Path "html/html" does not exist error:')}
|
|
190
|
+
${chalk.yellow('This happens when Vercel has the wrong Root Directory setting.')}
|
|
191
|
+
|
|
192
|
+
${chalk.green('Fix:')}
|
|
193
|
+
1. Go to your Vercel project settings
|
|
194
|
+
2. Under "Build & Development Settings"
|
|
195
|
+
3. Set "Root Directory" to ${chalk.yellow.bold('empty (leave blank)')}
|
|
196
|
+
4. Save and redeploy
|
|
197
|
+
|
|
198
|
+
${chalk.red.bold('• Linked to wrong project (username/html):')}
|
|
199
|
+
${chalk.yellow('Never link to the generic "html" project!')}
|
|
200
|
+
|
|
201
|
+
${chalk.green('Fix:')}
|
|
202
|
+
1. Delete the ${chalk.gray('html/.vercel')} folder
|
|
203
|
+
2. Run deployment again
|
|
204
|
+
3. When asked "Link to existing project?" say ${chalk.red.bold('NO')}
|
|
205
|
+
4. Create a new project with your actual name
|
|
188
206
|
`)
|
|
189
207
|
.action(async (options) => {
|
|
190
208
|
const spinner = ora('Deploying to Vercel...').start();
|
package/lib/deploy.js
CHANGED
|
@@ -59,23 +59,41 @@ async function setupVercelProject(config) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
// Create vercel.json for static site
|
|
62
|
+
// Use empty string instead of false to avoid Vercel issues
|
|
62
63
|
const vercelConfig = {
|
|
63
|
-
buildCommand:
|
|
64
|
+
buildCommand: "",
|
|
64
65
|
outputDirectory: ".",
|
|
66
|
+
installCommand: "",
|
|
65
67
|
framework: null
|
|
66
68
|
};
|
|
67
69
|
|
|
68
70
|
fs.writeJsonSync(vercelConfigPath, vercelConfig, { spaces: 2 });
|
|
69
71
|
console.log(chalk.green(`✅ Created vercel.json in ${config.outputDir || 'html'} directory`));
|
|
70
72
|
|
|
71
|
-
// Run Vercel setup
|
|
72
|
-
console.log(chalk.blue('\n
|
|
73
|
-
console.log(chalk.
|
|
74
|
-
console.log(chalk.
|
|
75
|
-
|
|
76
|
-
console.log(chalk.
|
|
77
|
-
|
|
78
|
-
console.log(chalk.
|
|
73
|
+
// Run Vercel setup with prominent instructions
|
|
74
|
+
console.log(chalk.blue('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
|
|
75
|
+
console.log(chalk.blue('🔗 Linking to Vercel - IMPORTANT INSTRUCTIONS'));
|
|
76
|
+
console.log(chalk.blue('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
|
|
77
|
+
|
|
78
|
+
console.log(chalk.yellow('⚠️ FOLLOW THESE ANSWERS CAREFULLY:\n'));
|
|
79
|
+
|
|
80
|
+
console.log(chalk.white('1️⃣ ') + chalk.green('Set up "~/Documents/.../html"?'));
|
|
81
|
+
console.log(chalk.white(' 👉 Answer: ') + chalk.yellow.bold('YES') + '\n');
|
|
82
|
+
|
|
83
|
+
console.log(chalk.white('2️⃣ ') + chalk.green('Which scope should contain your project?'));
|
|
84
|
+
console.log(chalk.white(' 👉 Answer: ') + chalk.yellow.bold('Select your account') + ' (usually your username)\n');
|
|
85
|
+
|
|
86
|
+
console.log(chalk.white('3️⃣ ') + chalk.green('Found project "username/html". Link to it?'));
|
|
87
|
+
console.log(chalk.white(' 👉 Answer: ') + chalk.red.bold('NO') + ' (this is NOT your project!)\n');
|
|
88
|
+
|
|
89
|
+
console.log(chalk.white('4️⃣ ') + chalk.green('Link to different existing project?'));
|
|
90
|
+
console.log(chalk.white(' 👉 Answer: ') + chalk.yellow.bold('YES') + ' if you have an existing project');
|
|
91
|
+
console.log(chalk.white(' 👉 Answer: ') + chalk.yellow.bold('NO') + ' to create new project\n');
|
|
92
|
+
|
|
93
|
+
console.log(chalk.white('5️⃣ ') + chalk.green('What\'s the name of your existing project?'));
|
|
94
|
+
console.log(chalk.white(' 👉 Answer: ') + chalk.yellow.bold(answers.projectName) + ' (your actual project name)\n');
|
|
95
|
+
|
|
96
|
+
console.log(chalk.blue('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
|
|
79
97
|
|
|
80
98
|
try {
|
|
81
99
|
// Run vercel link from the output directory
|
|
@@ -90,11 +108,18 @@ async function setupVercelProject(config) {
|
|
|
90
108
|
|
|
91
109
|
// Important reminders for Vercel settings
|
|
92
110
|
console.log(chalk.yellow('\n⚠️ IMPORTANT: Vercel Project Settings\n'));
|
|
93
|
-
console.log(chalk.white('After deployment, go to your Vercel dashboard
|
|
94
|
-
console.log(
|
|
95
|
-
console.log(chalk.
|
|
96
|
-
console.log(chalk.
|
|
97
|
-
console.log(chalk.
|
|
111
|
+
console.log(chalk.white('After deployment, go to your Vercel dashboard:'));
|
|
112
|
+
console.log();
|
|
113
|
+
console.log(chalk.red.bold('🔴 CRITICAL: Check Root Directory Setting'));
|
|
114
|
+
console.log(chalk.white('1. Go to: ') + chalk.cyan(`https://vercel.com/${answers.projectName}/settings`));
|
|
115
|
+
console.log(chalk.white('2. Under "Build & Development Settings"'));
|
|
116
|
+
console.log(chalk.white('3. Make sure "Root Directory" is ') + chalk.yellow.bold('EMPTY or "./"'));
|
|
117
|
+
console.log(chalk.white(' (NOT "html" or any other directory)'));
|
|
118
|
+
console.log();
|
|
119
|
+
console.log(chalk.yellow('🔐 For Public Access:'));
|
|
120
|
+
console.log(chalk.white('1. Navigate to Project Settings > General'));
|
|
121
|
+
console.log(chalk.white('2. Under "Security", find "Deployment Protection"'));
|
|
122
|
+
console.log(chalk.white('3. Set "Deployment Protection" to ') + chalk.yellow.bold('Disabled'));
|
|
98
123
|
console.log();
|
|
99
124
|
console.log(chalk.cyan('Dashboard URL: https://vercel.com/dashboard'));
|
|
100
125
|
console.log();
|
|
@@ -120,12 +145,26 @@ async function deployToVercel(config, isProd = false) {
|
|
|
120
145
|
throw new Error(`Output directory ${outputPath} does not exist. Run 'doc-builder build' first.`);
|
|
121
146
|
}
|
|
122
147
|
|
|
148
|
+
// Check for existing project link
|
|
149
|
+
const vercelProjectPath = path.join(outputPath, '.vercel', 'project.json');
|
|
150
|
+
if (fs.existsSync(vercelProjectPath)) {
|
|
151
|
+
try {
|
|
152
|
+
const projectInfo = fs.readJsonSync(vercelProjectPath);
|
|
153
|
+
console.log(chalk.yellow('\n⚠️ Deploying to existing project: ') + chalk.cyan(projectInfo.projectId || 'unknown'));
|
|
154
|
+
console.log(chalk.yellow('If deployment fails with path errors, check your Root Directory setting:'));
|
|
155
|
+
console.log(chalk.cyan(`https://vercel.com/dashboard/project/${projectInfo.projectId || 'settings'}\n`));
|
|
156
|
+
} catch (e) {
|
|
157
|
+
// Ignore read errors
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
123
161
|
// Create vercel.json in output directory for deployment
|
|
124
162
|
const vercelConfigPath = path.join(outputPath, 'vercel.json');
|
|
125
163
|
if (!fs.existsSync(vercelConfigPath)) {
|
|
126
164
|
const vercelConfig = {
|
|
127
|
-
buildCommand:
|
|
165
|
+
buildCommand: "",
|
|
128
166
|
outputDirectory: ".",
|
|
167
|
+
installCommand: "",
|
|
129
168
|
framework: null
|
|
130
169
|
};
|
|
131
170
|
fs.writeJsonSync(vercelConfigPath, vercelConfig, { spaces: 2 });
|