Skip to content

Commit 1ac88da

Browse files
committed
make publish scripts work with node 10 and linux
1 parent 51eacd5 commit 1ac88da

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

scripts/prebuilt.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ var root_config = { cwd: root, stdio: [0, 1, 2], encoding: "utf8" };
99

1010
var ocamlVersion = require("./buildocaml.js").getVersionPrefix();
1111
var fs = require("fs");
12-
var hostPlatform = "darwin";
1312

13+
function isHostPlatform(){
14+
return process.platform === "darwin" || process.platform === "linux"
15+
}
1416
function rebuild() {
1517
cp.execSync(`node ${path.join(__dirname, "ninja.js")} cleanbuild`, {
1618
cwd: __dirname,
@@ -51,7 +53,7 @@ if (!is_windows) {
5153
}
5254

5355
function createOCamlTar() {
54-
if (process.platform === hostPlatform) {
56+
if (isHostPlatform()) {
5557
require("./installUtils.js").install();
5658
console.log(`status in ocaml submodule:`);
5759
cp.execSync(`git -C ocaml status -uno`, { cwd: root, stdio: [0, 1, 2] });

scripts/prepublish.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function check(map) {
6464
// since it's already snapshot
6565

6666
// make sure the remote and current are on the same commit
67-
var currentBranch = (p.execSync(`git branch --show-current`) + "").trim();
67+
var currentBranch = (p.execSync(`git rev-parse --abbrev-ref HEAD`) + "").trim();
6868
var command = `git fetch origin && git diff ${currentBranch} origin/${currentBranch}`;
6969
console.log(`Running '${command}'`);
7070
var remoteDiffs = p.execSync(command) + "";

0 commit comments

Comments
 (0)