create-confluence-sync 1.0.8 → 1.0.9
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/package.json +1 -1
- package/src/sync.js +8 -1
package/package.json
CHANGED
package/src/sync.js
CHANGED
|
@@ -50,17 +50,24 @@ export async function pull(apiClient, tree, projectRoot, spaceKey) {
|
|
|
50
50
|
if (newPath && newPath !== page.path) {
|
|
51
51
|
const oldAbsolute = path.resolve(projectRoot, page.path);
|
|
52
52
|
try { await fs.unlink(oldAbsolute); } catch {}
|
|
53
|
+
// Clean up empty parent directories
|
|
54
|
+
let dir = path.dirname(oldAbsolute);
|
|
55
|
+
while (dir !== path.resolve(projectRoot) && dir !== path.dirname(dir)) {
|
|
56
|
+
try { await fs.rmdir(dir); dir = path.dirname(dir); } catch { break; }
|
|
57
|
+
}
|
|
58
|
+
console.log(`Moved by remote: ${page.path} → ${filePath}`);
|
|
53
59
|
}
|
|
54
60
|
|
|
55
61
|
const absolutePath = path.resolve(projectRoot, filePath);
|
|
56
62
|
await fs.mkdir(path.dirname(absolutePath), { recursive: true });
|
|
57
63
|
await fs.writeFile(absolutePath, content.body, 'utf-8');
|
|
58
|
-
console.log(`Updated: ${filePath}`);
|
|
64
|
+
if (!newPath || newPath === page.path) console.log(`Updated: ${filePath}`);
|
|
59
65
|
|
|
60
66
|
const attachments = await apiClient.getPageAttachments(pageId);
|
|
61
67
|
|
|
62
68
|
addPage(tree, pageId, {
|
|
63
69
|
title: remotePages[pageId].title,
|
|
70
|
+
fsName: sanitizeName(remotePages[pageId].title),
|
|
64
71
|
path: filePath,
|
|
65
72
|
parentId: remotePages[pageId].parentId,
|
|
66
73
|
version: content.version,
|