Skip to content

Commit e8a731e

Browse files
committed
repl.js: add development mode
1 parent 676c4b5 commit e8a731e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

scripts/repl.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,15 @@ 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+
console.log(`building byte code version of the compiler [${isDev ? "development" : "production"}]`);
49+
var ocamlDebugFlag = isDev ? "-g " : "";
50+
var jsooDebugFlag = isDev ? "--pretty " : "";
4951
e(
50-
`${OCAMLC} -w -30-40 -no-check-prims -I ${jsRefmtCompDir} ${jsRefmtCompDir}/js_refmt_compiler.mli ${jsRefmtCompDir}/js_refmt_compiler.ml -o jsc.byte `
52+
`${OCAMLC} ${ocamlDebugFlag}-w -30-40 -no-check-prims -I ${jsRefmtCompDir} ${jsRefmtCompDir}/js_compiler.mli ${jsRefmtCompDir}/js_compiler.ml -o jsc.byte `
5153
);
5254
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
55+
e(`${OCAMLRUN} ${JSOO} compile jsc.byte ${jsooDebugFlag}-o exports.js`);
5556
console.log("copy js artifacts");
5657
e(`cp ../lib/js/*.js ${playground}/stdlib`);
5758
e(`mv ./exports.js ${playground}`);
@@ -83,7 +84,7 @@ function prepublish() {
8384
});
8485
}
8586

86-
prepare();
87+
prepare(process.argv.includes("-development"));
8788
if (process.argv.includes("-prepublish")) {
8889
prepublish();
8990
}

0 commit comments

Comments
 (0)