@fern-api/replay 0.10.1 → 0.10.3
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/cli.cjs +8 -3
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +8 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -984,7 +984,7 @@ function applyBothPatches(baseLines, oursPatches, theirsPatches) {
|
|
|
984
984
|
}
|
|
985
985
|
|
|
986
986
|
// src/ReplayApplicator.ts
|
|
987
|
-
import { mkdir, mkdtemp, readFile, rm, writeFile } from "fs/promises";
|
|
987
|
+
import { mkdir, mkdtemp, readFile, rm, unlink, writeFile } from "fs/promises";
|
|
988
988
|
import { tmpdir } from "os";
|
|
989
989
|
import { dirname as dirname2, extname, join as join2 } from "path";
|
|
990
990
|
import { minimatch } from "minimatch";
|
|
@@ -1213,9 +1213,10 @@ var ReplayApplicator = class {
|
|
|
1213
1213
|
const resolvedPath = await this.resolveFilePath(filePath, baseGen.tree_hash, currentTreeHash);
|
|
1214
1214
|
const base = await this.git.showFile(baseGen.tree_hash, filePath);
|
|
1215
1215
|
const theirs = await this.applyPatchToContent(base, patch.patch_content, filePath, tempGit, tempDir);
|
|
1216
|
-
|
|
1216
|
+
const effectiveTheirs = theirs ?? await readFile(join2(this.outputDir, resolvedPath), "utf-8").catch(() => null);
|
|
1217
|
+
if (effectiveTheirs) {
|
|
1217
1218
|
this.fileTheirsAccumulator.set(resolvedPath, {
|
|
1218
|
-
content:
|
|
1219
|
+
content: effectiveTheirs,
|
|
1219
1220
|
baseGeneration: patch.base_generation
|
|
1220
1221
|
});
|
|
1221
1222
|
}
|
|
@@ -1259,8 +1260,12 @@ var ReplayApplicator = class {
|
|
|
1259
1260
|
};
|
|
1260
1261
|
} catch {
|
|
1261
1262
|
for (const [resolvedPath, content] of snapshots) {
|
|
1263
|
+
const fullPath = join2(this.outputDir, resolvedPath);
|
|
1262
1264
|
if (content != null) {
|
|
1263
|
-
await writeFile(
|
|
1265
|
+
await writeFile(fullPath, content);
|
|
1266
|
+
} else {
|
|
1267
|
+
await unlink(fullPath).catch(() => {
|
|
1268
|
+
});
|
|
1264
1269
|
}
|
|
1265
1270
|
}
|
|
1266
1271
|
}
|