@knowcode/doc-builder 1.1.2 → 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 +16 -0
- package/lib/deploy.js +50 -17
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,22 @@ 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
|
+
|
|
8
24
|
## [1.1.2] - 2025-01-19
|
|
9
25
|
|
|
10
26
|
### Changed
|
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 });
|
|
@@ -177,7 +179,9 @@ async function deployToVercel(config, isProd = false) {
|
|
|
177
179
|
"outputDirectory": ".",
|
|
178
180
|
"devCommand": "",
|
|
179
181
|
"installCommand": "",
|
|
180
|
-
"framework": null
|
|
182
|
+
"framework": null,
|
|
183
|
+
"cleanUrls": true,
|
|
184
|
+
"trailingSlash": false
|
|
181
185
|
};
|
|
182
186
|
fs.writeJsonSync(vercelConfigPath, vercelConfig, { spaces: 2 });
|
|
183
187
|
}
|
|
@@ -196,22 +200,51 @@ async function deployToVercel(config, isProd = false) {
|
|
|
196
200
|
const deployCmd = `vercel ${deployArgs.join(' ')}`;
|
|
197
201
|
|
|
198
202
|
try {
|
|
199
|
-
// Run deployment from the output directory
|
|
200
|
-
const
|
|
201
|
-
cwd: outputPath,
|
|
202
|
-
encoding: 'utf8',
|
|
203
|
-
env: {
|
|
204
|
-
...process.env,
|
|
205
|
-
// Force Vercel to skip build
|
|
206
|
-
VERCEL_BUILD_SKIP: '1'
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
// Extract URL from output
|
|
211
|
-
const urlMatch = output.match(/https:\/\/[^\s]+/);
|
|
212
|
-
const deployUrl = urlMatch ? urlMatch[0] : 'Check Vercel dashboard';
|
|
203
|
+
// Run deployment from the output directory with real-time output
|
|
204
|
+
const { spawn } = require('child_process');
|
|
213
205
|
|
|
214
|
-
return
|
|
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
|
+
});
|
|
215
248
|
} catch (error) {
|
|
216
249
|
// Check if this is the common "html/html" path error
|
|
217
250
|
if (error.message && error.message.includes('html/html') && error.message.includes('does not exist')) {
|