Skip to content

Commit 0beaee9

Browse files
committed
fix to apply patch one after the other
1 parent 3542789 commit 0beaee9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/open-next/src/build/patch/codePatcher.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as fs from "node:fs/promises";
2-
import * as buildHelper from "../helper.js";
32
import logger from "../../logger.js";
3+
import * as buildHelper from "../helper.js";
44

55
// Either before or after should be provided, otherwise just use the field directly
66
export interface VersionedField<T> {
@@ -99,12 +99,12 @@ export async function applyCodePatches(
9999
}
100100

101101
// We apply the patches
102+
let patchedContent = content;
102103

103-
patchToApply.forEach(async (patch) => {
104+
for (const patch of patchToApply) {
104105
const patchCodeFns = Array.isArray(patch.patchCode)
105106
? extractVersionedField(patch.patchCode, nextVersion)
106107
: [patch.patchCode];
107-
let patchedContent = content;
108108
logger.debug(
109109
`Applying ${patchCodeFns.length} patches to ${filePath} for ${patch.name}`,
110110
);
@@ -116,8 +116,8 @@ export async function applyCodePatches(
116116
manifests,
117117
});
118118
}
119-
await fs.writeFile(filePath, patchedContent);
120-
});
119+
}
120+
await fs.writeFile(filePath, patchedContent);
121121
}),
122122
);
123123
console.timeEnd("Applying code patches");

0 commit comments

Comments
 (0)