@sleekcms/sync 1.6.0 → 1.7.0
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/dist/setup-site.js +8 -10
- package/package.json +1 -1
package/dist/setup-site.js
CHANGED
|
@@ -145,8 +145,11 @@ async function walkFiles(viewsDir) {
|
|
|
145
145
|
* Push local edits via /save_files. Server enforces save order.
|
|
146
146
|
*
|
|
147
147
|
* Skip: file mtime matches cache → don't read, don't push.
|
|
148
|
-
*
|
|
149
|
-
*
|
|
148
|
+
* The server replies with success/error per file only — it never echoes back a
|
|
149
|
+
* normalized copy, so local files are never rewritten on save. A failed save is
|
|
150
|
+
* recorded in sync-errors.log; a successful save clears that file's entry.
|
|
151
|
+
* Server-side normalization (resolved image objects, JSON frontmatter, entry
|
|
152
|
+
* refs, etc.) is reflected locally only on a full re-fetch.
|
|
150
153
|
*/
|
|
151
154
|
async function pushLocalChanges(viewsDir, fileMap, apiBase, token) {
|
|
152
155
|
const changes = [];
|
|
@@ -190,14 +193,9 @@ async function pushLocalChanges(viewsDir, fileMap, apiBase, token) {
|
|
|
190
193
|
continue;
|
|
191
194
|
}
|
|
192
195
|
delete errors[c.rel];
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
if (currentStat.mtimeMs === c.stat.mtimeMs && finalContent !== c.content) {
|
|
197
|
-
await fs_extra_1.default.outputFile(c.full, finalContent);
|
|
198
|
-
finalMtime = (await fs_extra_1.default.stat(c.full)).mtimeMs;
|
|
199
|
-
}
|
|
200
|
-
fileMap[c.rel] = { mtimeMs: finalMtime };
|
|
196
|
+
// Record the mtime we pushed. The local file is left exactly as the
|
|
197
|
+
// user wrote it — we don't rewrite it with a server-normalized copy.
|
|
198
|
+
fileMap[c.rel] = { mtimeMs: c.stat.mtimeMs };
|
|
201
199
|
console.log(`✅ ${c.prior ? "Updated" : "Created"} ${c.rel}`);
|
|
202
200
|
pushed++;
|
|
203
201
|
}
|