Skip to content

Commit

Permalink
Patch postinstall.js number 2 (#493)
Browse files Browse the repository at this point in the history
* fix octal notation

* fix removeInitialBinaries when reinstalling
  • Loading branch information
tsnobip authored Mar 4, 2024
1 parent 7b18a82 commit d04115a
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/rescript-relay/scripts/release-postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function copyPlatformBinaries(platform) {
if (!fs.existsSync(ppxFinalPath)) {
fs.copyFileSync(path.join(__dirname, "ppx-" + platform), ppxFinalPath);
}
fs.chmodSync(ppxFinalPath, 0777);
fs.chmodSync(ppxFinalPath, 0o777);

/**
* Copy the Relay compiler
Expand All @@ -125,14 +125,20 @@ function copyPlatformBinaries(platform) {
rescriptRelayCompilerFinalPath
);
}
fs.chmodSync(rescriptRelayCompilerFinalPath, 0777);
fs.chmodSync(rescriptRelayCompilerFinalPath, 0o777);
}

function unlinkIfNotExistsSync(path) {
if (fs.existsSync(path)) {
fs.unlinkSync(path);
}
}

function removeInitialBinaries() {
fs.unlinkSync(path.join(__dirname, "ppx-macos-arm64"));
fs.unlinkSync(path.join(__dirname, "ppx-macos-latest"));
fs.unlinkSync(path.join(__dirname, "ppx-windows-latest"));
fs.unlinkSync(path.join(__dirname, "ppx-linux"));
unlinkIfNotExistsSync(path.join(__dirname, "ppx-macos-arm64"));
unlinkIfNotExistsSync(path.join(__dirname, "ppx-macos-latest"));
unlinkIfNotExistsSync(path.join(__dirname, "ppx-windows-latest"));
unlinkIfNotExistsSync(path.join(__dirname, "ppx-linux"));
fs.rmSync(path.join(__dirname, "relay-compiler-linux-x64"), {
recursive: true,
force: true,
Expand Down

0 comments on commit d04115a

Please sign in to comment.