Skip to content

Commit 18a1eab

Browse files
authored
Merge pull request #4394 from jchavarri/repl-add-debug
repl.js: add development mode
2 parents 676c4b5 + ff9cb1b commit 18a1eab

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

scripts/repl.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,16 @@ var nativePath = path.join(__dirname, "..", "native", "4.06.1", "bin");
4444
var OCAMLC = path.join(nativePath, "ocamlc.opt");
4545
var OCAMLRUN = path.join(nativePath, "ocamlrun");
4646
var JSOO = path.join(__dirname, "..", "vendor", "js_of_ocaml.bc");
47-
function prepare() {
48-
console.log("building byte code version of the compiler");
47+
function prepare(isDev) {
48+
var [env, ocamlFlag, jsooFlag] = isDev
49+
? ["development", "-g ", "--pretty "]
50+
: ["production", "", ""];
51+
console.log(`building byte code version of the compiler [${env}]`);
4952
e(
50-
`${OCAMLC} -w -30-40 -no-check-prims -I ${jsRefmtCompDir} ${jsRefmtCompDir}/js_refmt_compiler.mli ${jsRefmtCompDir}/js_refmt_compiler.ml -o jsc.byte `
53+
`${OCAMLC} ${ocamlFlag}-w -30-40 -no-check-prims -I ${jsRefmtCompDir} ${jsRefmtCompDir}/js_refmt_compiler.mli ${jsRefmtCompDir}/js_refmt_compiler.ml -o jsc.byte `
5154
);
5255
console.log("building js version");
53-
e(`${OCAMLRUN} ${JSOO} compile jsc.byte -o exports.js`);
54-
// e() js_of_ocaml jsc.byte -o exports.js
56+
e(`${OCAMLRUN} ${JSOO} compile jsc.byte ${jsooFlag}-o exports.js`);
5557
console.log("copy js artifacts");
5658
e(`cp ../lib/js/*.js ${playground}/stdlib`);
5759
e(`mv ./exports.js ${playground}`);
@@ -83,7 +85,7 @@ function prepublish() {
8385
});
8486
}
8587

86-
prepare();
88+
prepare(process.argv.includes("-development"));
8789
if (process.argv.includes("-prepublish")) {
8890
prepublish();
8991
}

0 commit comments

Comments
 (0)