create-confluence-sync 1.0.3 → 1.0.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/sync.js +8 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-confluence-sync",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Bidirectional Confluence Server documentation sync via Git. Edit XHTML locally, commit, auto-sync with Confluence.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/sync.js CHANGED
@@ -165,7 +165,14 @@ export async function push(apiClient, tree, projectRoot, spaceKey, changedFiles)
165
165
  let created = 0;
166
166
  let updated = 0;
167
167
 
168
- for (let filePath of changedFiles) {
168
+ // Sort by path depth — create parents before children
169
+ const sorted = [...changedFiles].sort((a, b) => {
170
+ const depthA = a.replace(/\\/g, '/').split('/').length;
171
+ const depthB = b.replace(/\\/g, '/').split('/').length;
172
+ return depthA - depthB;
173
+ });
174
+
175
+ for (let filePath of sorted) {
169
176
  let normalized = filePath.replace(/\\/g, '/');
170
177
  let absolutePath = path.resolve(projectRoot, normalized);
171
178