Skip to content

Commit d7cbe3a

Browse files
committed
refine installation logic
1 parent 69b139b commit d7cbe3a

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

scripts/prebuilt.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ var { is_windows } = require("./config.js");
66

77
var root = path.join(__dirname, "..");
88
var root_config = { cwd: root, stdio: [0, 1, 2], encoding: "utf8" };
9-
process.env.BS_RELEASE_BUILD = "true";
109

1110
var ocamlVersion = require("./buildocaml.js").getVersionPrefix();
1211
var fs = require("fs");
@@ -18,7 +17,7 @@ function rebuild() {
1817
stdio: [0, 1, 2]
1918
});
2019
}
21-
var assert = require('assert')
20+
var assert = require("assert");
2221
/**
2322
*
2423
* @param {string} src
@@ -33,7 +32,7 @@ function installDirBy(src, dest, filter) {
3332
var x = path.join(src, file);
3433
var y = path.join(dest, file);
3534
// console.log(x, '----->', y )
36-
fs.copyFile(x, y, (err) => assert.equal(err,null));
35+
fs.copyFile(x, y, err => assert.equal(err, null));
3736
}
3837
});
3938
} else {
@@ -51,18 +50,22 @@ function install() {
5150
var ocaml_dir = path.join(lib_dir, "ocaml");
5251
var stdlib_dir = path.join(jscomp_dir, "stdlib-406");
5352

53+
// sync up with cmij_main.ml
5454
installDirBy(runtime_dir, ocaml_dir, function(file) {
5555
var y = path.parse(file);
56-
return y.name === "js" || y.ext.includes("cm");
56+
return y.name === "js" && y.ext !== ".cmj";
5757
// install js.cmi, js.mli
5858
});
59+
60+
// for merlin or other IDE
61+
var installed_suffixes = [".ml", ".mli", ".cmi",".cmt", ".cmti"];
5962
installDirBy(others_dir, ocaml_dir, function(file) {
6063
var y = path.parse(file);
61-
return y.ext === ".ml" || y.ext === ".mli" || y.ext.includes("cm");
64+
return installed_suffixes.includes(y.ext);
6265
});
6366
installDirBy(stdlib_dir, ocaml_dir, function(file) {
6467
var y = path.parse(file);
65-
return y.ext === ".ml" || y.ext === ".mli" || y.ext.includes("cm");
68+
return installed_suffixes.includes(y.ext)
6669
});
6770
}
6871

0 commit comments

Comments
 (0)