diff options
| author | ertopogo <erwin.t.pombett@gmail.com> | 2026-01-24 14:23:03 +0100 |
|---|---|---|
| committer | ertopogo <erwin.t.pombett@gmail.com> | 2026-01-24 14:23:03 +0100 |
| commit | 19c3d267fad7a29d779dda810ca5801de9e5312c (patch) | |
| tree | c1764167c1fe1ea11f8d8d64454692fca53d444f /backend | |
| parent | e0c9c32c60b67dc34a18f5a93209393e7abc8660 (diff) | |
corrections du backend
Diffstat (limited to 'backend')
| -rw-r--r-- | backend/Dockerfile | 4 | ||||
| -rw-r--r-- | backend/package.json | 10 | ||||
| -rw-r--r-- | backend/scripts/patch-medusa.js | 34 |
3 files changed, 42 insertions, 6 deletions
diff --git a/backend/Dockerfile b/backend/Dockerfile index 6775ba5..17fdda8 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -10,8 +10,8 @@ RUN npm install COPY . .
-# Build the project (if using TypeScript)
-RUN npm run build
+# Build only when TypeScript sources exist
+RUN if [ -d "src" ]; then npm run build; else echo "Skipping build: no src/ directory"; fi
# Expose port
EXPOSE 9000
diff --git a/backend/package.json b/backend/package.json index 5a4c902..caf9258 100644 --- a/backend/package.json +++ b/backend/package.json @@ -15,11 +15,12 @@ "scripts": {
"clean": "cross-env ./node_modules/.bin/rimraf dist",
"build": "cross-env ./node_modules/.bin/rimraf dist && tsc -p tsconfig.json",
- "start": "cross-env npm run build && medusa start",
- "start:custom": "cross-env npm run build && node --preserve-symlinks index.js",
- "dev": "cross-env npm run build && medusa develop",
+ "start": "sh -c \"if [ -d src ]; then npm run build; else echo 'Skipping build: no src/ directory'; fi && medusa start\"",
+ "start:custom": "sh -c \"if [ -d src ]; then npm run build; else echo 'Skipping build: no src/ directory'; fi && node --preserve-symlinks index.js\"",
+ "dev": "sh -c \"if [ -d src ]; then npm run build; else echo 'Skipping build: no src/ directory'; fi && medusa develop\"",
"seed": "medusa seed -f ./data/seed.json",
- "install:cli": "npm install -g @medusajs/medusa-cli"
+ "install:cli": "npm install -g @medusajs/medusa-cli",
+ "postinstall": "node scripts/patch-medusa.js"
},
"dependencies": {
"@medusajs/medusa": "^1.20.0",
@@ -34,6 +35,7 @@ "cors": "^2.8.5",
"dotenv": "16.3.1",
"express": "^4.17.1",
+ "medusa-fulfillment-manual": "^1.1.0",
"medusa-interfaces": "^1.3.7",
"medusa-payment-manual": "^1.0.24",
"medusa-payment-stripe": "^6.0.7",
diff --git a/backend/scripts/patch-medusa.js b/backend/scripts/patch-medusa.js new file mode 100644 index 0000000..9d95d9a --- /dev/null +++ b/backend/scripts/patch-medusa.js @@ -0,0 +1,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."); |
