@knowcode/doc-builder 1.1.1 → 1.1.3
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 +28 -0
- package/lib/deploy.js +53 -46
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,34 @@ 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.1.3] - 2025-01-19
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- Real-time output from Vercel CLI during deployment
|
|
12
|
+
- Fixed 404 errors by adding cleanUrls configuration
|
|
13
|
+
- Deployment now shows progress as it happens
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
- cleanUrls: true in vercel.json for proper URL handling
|
|
17
|
+
- trailingSlash: false to prevent redirect issues
|
|
18
|
+
- Real-time streaming of Vercel deployment output
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- Switched from execSync to spawn for live deployment output
|
|
22
|
+
- Better URL extraction from deployment output
|
|
23
|
+
|
|
24
|
+
## [1.1.2] - 2025-01-19
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
- Simplified deployment output - removed Root Directory warnings
|
|
28
|
+
- Cleaner deployment experience with just essential information
|
|
29
|
+
- Shows simple "Starting deployment" message instead of warnings
|
|
30
|
+
|
|
31
|
+
### Removed
|
|
32
|
+
- Pre-deployment Root Directory check and warnings
|
|
33
|
+
- Project ID display during deployment
|
|
34
|
+
- Verbose deployment preparation messages
|
|
35
|
+
|
|
8
36
|
## [1.1.1] - 2025-01-19
|
|
9
37
|
|
|
10
38
|
### Added
|
package/lib/deploy.js
CHANGED
|
@@ -64,7 +64,9 @@ async function setupVercelProject(config) {
|
|
|
64
64
|
"outputDirectory": ".",
|
|
65
65
|
"devCommand": "",
|
|
66
66
|
"installCommand": "",
|
|
67
|
-
"framework": null
|
|
67
|
+
"framework": null,
|
|
68
|
+
"cleanUrls": true,
|
|
69
|
+
"trailingSlash": false
|
|
68
70
|
};
|
|
69
71
|
|
|
70
72
|
fs.writeJsonSync(vercelConfigPath, vercelConfig, { spaces: 2 });
|
|
@@ -164,35 +166,9 @@ async function deployToVercel(config, isProd = false) {
|
|
|
164
166
|
throw new Error(`Output directory ${outputPath} does not exist. Run 'doc-builder build' first.`);
|
|
165
167
|
}
|
|
166
168
|
|
|
167
|
-
//
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
try {
|
|
171
|
-
const projectInfo = fs.readJsonSync(vercelProjectPath);
|
|
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
|
-
|
|
192
|
-
} catch (e) {
|
|
193
|
-
// Ignore read errors
|
|
194
|
-
}
|
|
195
|
-
}
|
|
169
|
+
// Simple deployment message
|
|
170
|
+
console.log(chalk.blue('\n🚀 Starting deployment to Vercel...'));
|
|
171
|
+
console.log(chalk.gray('This will take a few seconds...\n'));
|
|
196
172
|
|
|
197
173
|
// Create vercel.json in output directory for deployment
|
|
198
174
|
const vercelConfigPath = path.join(outputPath, 'vercel.json');
|
|
@@ -203,7 +179,9 @@ async function deployToVercel(config, isProd = false) {
|
|
|
203
179
|
"outputDirectory": ".",
|
|
204
180
|
"devCommand": "",
|
|
205
181
|
"installCommand": "",
|
|
206
|
-
"framework": null
|
|
182
|
+
"framework": null,
|
|
183
|
+
"cleanUrls": true,
|
|
184
|
+
"trailingSlash": false
|
|
207
185
|
};
|
|
208
186
|
fs.writeJsonSync(vercelConfigPath, vercelConfig, { spaces: 2 });
|
|
209
187
|
}
|
|
@@ -222,22 +200,51 @@ async function deployToVercel(config, isProd = false) {
|
|
|
222
200
|
const deployCmd = `vercel ${deployArgs.join(' ')}`;
|
|
223
201
|
|
|
224
202
|
try {
|
|
225
|
-
// Run deployment from the output directory
|
|
226
|
-
const
|
|
227
|
-
cwd: outputPath,
|
|
228
|
-
encoding: 'utf8',
|
|
229
|
-
env: {
|
|
230
|
-
...process.env,
|
|
231
|
-
// Force Vercel to skip build
|
|
232
|
-
VERCEL_BUILD_SKIP: '1'
|
|
233
|
-
}
|
|
234
|
-
});
|
|
203
|
+
// Run deployment from the output directory with real-time output
|
|
204
|
+
const { spawn } = require('child_process');
|
|
235
205
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
206
|
+
return new Promise((resolve, reject) => {
|
|
207
|
+
const vercelProcess = spawn('vercel', deployArgs, {
|
|
208
|
+
cwd: outputPath,
|
|
209
|
+
env: {
|
|
210
|
+
...process.env,
|
|
211
|
+
// Force Vercel to skip build
|
|
212
|
+
VERCEL_BUILD_SKIP: '1'
|
|
213
|
+
},
|
|
214
|
+
shell: true
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
let deployUrl = '';
|
|
218
|
+
|
|
219
|
+
// Capture stdout in real-time
|
|
220
|
+
vercelProcess.stdout.on('data', (data) => {
|
|
221
|
+
const output = data.toString();
|
|
222
|
+
process.stdout.write(output); // Show output in real-time
|
|
223
|
+
|
|
224
|
+
// Try to extract URL from output
|
|
225
|
+
const urlMatch = output.match(/https:\/\/[^\s]+/);
|
|
226
|
+
if (urlMatch) {
|
|
227
|
+
deployUrl = urlMatch[0];
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
// Capture stderr
|
|
232
|
+
vercelProcess.stderr.on('data', (data) => {
|
|
233
|
+
process.stderr.write(data.toString());
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
vercelProcess.on('close', (code) => {
|
|
237
|
+
if (code === 0) {
|
|
238
|
+
resolve(deployUrl || 'Check Vercel dashboard');
|
|
239
|
+
} else {
|
|
240
|
+
reject(new Error(`Vercel deployment failed with code ${code}`));
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
vercelProcess.on('error', (err) => {
|
|
245
|
+
reject(new Error(`Failed to start Vercel process: ${err.message}`));
|
|
246
|
+
});
|
|
247
|
+
});
|
|
241
248
|
} catch (error) {
|
|
242
249
|
// Check if this is the common "html/html" path error
|
|
243
250
|
if (error.message && error.message.includes('html/html') && error.message.includes('does not exist')) {
|