Skip to content

Commit 19be190

Browse files
committed
feat(sync): 🚀 auto-create target directories instead of skipping
1 parent cf71857 commit 19be190

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

scripts/sync-config.mjs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,11 @@ async function syncConfigs(options = {}) {
220220

221221
const targetDir = path.join(projectRoot, '..', 'cloudbase-examples', templatePath);
222222

223-
if (!checkTargetExists(path.dirname(targetDir))) {
224-
console.log(` ⚠️ 跳过: 目标目录不存在 ${templatePath}`);
225-
skipCount++;
226-
continue;
223+
// 自动创建目标目录的父目录
224+
const targetParentDir = path.dirname(targetDir);
225+
if (!fs.existsSync(targetParentDir)) {
226+
console.log(` 📁 自动创建目录: ${path.relative(projectRoot, targetParentDir)}`);
227+
fs.mkdirSync(targetParentDir, { recursive: true });
227228
}
228229

229230
if (dryRun) {

0 commit comments

Comments
 (0)