Skip to content

Commit

Permalink
Activate emsdk version from package.json
Browse files Browse the repository at this point in the history
This ensures that the version installed on a developer's clone
matches what's in package.json

may want to catch the error + add some instructions to fix the
problem
  • Loading branch information
tomjakubowski committed Jun 13, 2023
1 parent 457d655 commit d86d8d3
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions scripts/run_emsdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ const path = require("path");
try {
const cwd = process.cwd();
const cmd = process.argv.slice(2).join(" ");
const scripts = __dirname;
const emsdkdir = path.join(scripts, "..", ".emsdk");
const emversion = require("../package.json").emscripten;
const emsdkdir = path.join(__dirname, "..", ".emsdk");
const emversion = require(path.join(
__dirname,
"..",
"package.json"
)).emscripten;
if (!emversion) {
throw new Error("emscripten version not specified in package.json");
throw new Error("Emscripten version not specified in package.json");
}
execute_throw`${scripts}/with_emsdk.sh ${emsdkdir} ${emversion} ${cmd}`;
execute_throw`cd ${emsdkdir} && . ./emsdk_env.sh >/dev/null 2>&1 && emsdk activate ${emversion} >/dev/null && cd ${cwd} && ${cmd}`;
} catch (e) {
console.log(e.message);
process.exit(1);
Expand Down

0 comments on commit d86d8d3

Please sign in to comment.