feat: creates support for swaps on the storefront (#355)

This commit is contained in:
Sebastian Rindom
2021-08-30 12:14:56 +02:00
committed by GitHub
parent bd1e115696
commit ae82cfc70a
20 changed files with 2122 additions and 1170 deletions
+12 -12
View File
@@ -1,10 +1,10 @@
const path = require("path");
const { spawn } = require("child_process");
const path = require("path")
const { spawn } = require("child_process")
const { setPort } = require("./use-api");
const { setPort } = require("./use-api")
module.exports = ({ cwd, verbose }) => {
const serverPath = path.join(__dirname, "test-server.js");
const serverPath = path.join(__dirname, "test-server.js")
return new Promise((resolve, reject) => {
const medusaProcess = spawn("node", [path.resolve(serverPath)], {
@@ -18,15 +18,15 @@ module.exports = ({ cwd, verbose }) => {
stdio: verbose
? ["inherit", "inherit", "inherit", "ipc"]
: ["ignore", "ignore", "ignore", "ipc"],
});
})
medusaProcess.on("uncaughtException", (err) => {
medusaProcess.kill();
});
medusaProcess.kill()
})
medusaProcess.on("message", (port) => {
setPort(port);
resolve(medusaProcess);
});
});
};
setPort(port)
resolve(medusaProcess)
})
})
}