fix(scripts): 修复路径不存在提示和打开目录延迟问题
1. 为路径不存在的情况添加专属警告日志 2. 给打开文件目录操作增加2秒延迟,适配部分系统文件操作节奏
This commit is contained in:
@@ -98,6 +98,7 @@ async function main() {
|
||||
const destDir = path.join(cwd, 'unpackage', 'dist', 'build');
|
||||
const zipFilePath = await createZipWithSystemCommand(sourceDir, destDir, 'mp-harmony');
|
||||
console.log(`ZIP 文件路径: ${zipFilePath}`);
|
||||
|
||||
await openFileDirectory(zipFilePath);
|
||||
} else {
|
||||
console.log('跳过创建 ZIP 文件和打开目录');
|
||||
|
||||
@@ -24,6 +24,9 @@ function checkPathExists(targetPath) {
|
||||
fs.accessSync(targetPath);
|
||||
return true;
|
||||
} catch (error) {
|
||||
if (error.code === 'ENOENT') {
|
||||
console.warn(`❌ 路径:${targetPath} 不存在!!`)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -251,6 +254,7 @@ async function openFileDirectory(filePath, options = {}) {
|
||||
createIfNotExists = false, // 目录不存在时是否创建
|
||||
wait = false // 是否等待进程结束
|
||||
} = options;
|
||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||
|
||||
try {
|
||||
// 检查路径是否存在
|
||||
|
||||
Reference in New Issue
Block a user