1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
const fs = require("fs");
const path = require("path");
const targetPath = path.join(
__dirname,
"..",
"node_modules",
"@medusajs",
"medusa",
"dist",
"services",
"payment-provider.js"
);
if (!fs.existsSync(targetPath)) {
console.error("patch-medusa: cible introuvable:", targetPath);
process.exit(1);
}
const original = fs.readFileSync(targetPath, "utf8");
const before = "model.update({}, { is_installed: false })";
const after =
"model.createQueryBuilder().update().set({ is_installed: false }).where('1=1').execute()";
if (!original.includes(before)) {
console.error(
"patch-medusa: motif introuvable, le patch n'a pas ete applique."
);
process.exit(1);
}
const patched = original.replace(before, after);
fs.writeFileSync(targetPath, patched, "utf8");
console.log("patch-medusa: update vide remplace avec succes.");
|