@ranger1/dx 0.1.65 → 0.1.66
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/lib/vercel-deploy.js +15 -9
- package/package.json +1 -1
package/lib/vercel-deploy.js
CHANGED
|
@@ -169,8 +169,13 @@ function readLinkedProjectContext(contextRoot) {
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
function clearLinkedProjectContext(contextRoot) {
|
|
172
|
-
const
|
|
173
|
-
rmSync(
|
|
172
|
+
const linkDir = join(contextRoot, '.vercel')
|
|
173
|
+
rmSync(linkDir, { force: true, recursive: true })
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function clearVercelBuildOutput(contextRoot) {
|
|
177
|
+
const outputDir = join(contextRoot, '.vercel', 'output')
|
|
178
|
+
rmSync(outputDir, { force: true, recursive: true })
|
|
174
179
|
}
|
|
175
180
|
|
|
176
181
|
async function runVercel(args, options = {}) {
|
|
@@ -376,9 +381,8 @@ export async function deployToVercel(target, options = {}) {
|
|
|
376
381
|
`检测到 ${VERCEL_PROJECT_LINK_PATH} 但解析失败: ${linkedContext.parseError.message}`
|
|
377
382
|
)
|
|
378
383
|
if (strictContext) {
|
|
379
|
-
logger.
|
|
380
|
-
|
|
381
|
-
return
|
|
384
|
+
logger.warn('strictContext 已开启:自动清理 .vercel 后继续部署')
|
|
385
|
+
clearLinkedProjectContext(prebuiltCwd)
|
|
382
386
|
}
|
|
383
387
|
}
|
|
384
388
|
|
|
@@ -389,11 +393,11 @@ export async function deployToVercel(target, options = {}) {
|
|
|
389
393
|
` 本地链接: org=${maskIdentifier(linkedContext.orgId)} project=${maskIdentifier(linkedContext.projectId)}`
|
|
390
394
|
)
|
|
391
395
|
if (strictContext) {
|
|
392
|
-
logger.
|
|
393
|
-
|
|
394
|
-
|
|
396
|
+
logger.warn('strictContext 已开启:检测到冲突,自动清理 .vercel 后继续部署')
|
|
397
|
+
clearLinkedProjectContext(prebuiltCwd)
|
|
398
|
+
} else {
|
|
399
|
+
logger.warn('strictContext 已关闭,继续执行(可能存在误部署风险)')
|
|
395
400
|
}
|
|
396
|
-
logger.warn('strictContext 已关闭,继续执行(可能存在误部署风险)')
|
|
397
401
|
}
|
|
398
402
|
|
|
399
403
|
logger.info(
|
|
@@ -432,6 +436,8 @@ export async function deployToVercel(target, options = {}) {
|
|
|
432
436
|
if (strictContext && process.env.DX_VERCEL_KEEP_LINK !== '1') {
|
|
433
437
|
clearLinkedProjectContext(prebuiltCwd)
|
|
434
438
|
}
|
|
439
|
+
// 避免 Vercel 本地预构建产物残留导致 EEXIST(如 _global-error.func 符号链接冲突)
|
|
440
|
+
clearVercelBuildOutput(prebuiltCwd)
|
|
435
441
|
|
|
436
442
|
// 第一步:本地构建
|
|
437
443
|
logger.step(`本地构建 ${t} (${environment})`)
|