Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: error message on non linked binary not showing #71

Merged
merged 1 commit into from
Nov 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions .ci/pipelines-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ const packageJson = JSON.stringify(
typings: "./odiff.d.ts",
main: "./odiff.js",
scripts: {
"postinstall": "node ./postinstall.js"
postinstall: "node ./postinstall.js",
},
bin: {
odiff: "bin/odiff",
},
"bin": {
"odiff": "bin/odiff"
}
},
null,
2
Expand Down Expand Up @@ -88,16 +88,19 @@ fs.copyFileSync(

if (!fs.existsSync(path.join(__dirname, "..", "_release", "bin"))) {
console.log("Creating placeholder files");
const placeholderFile = `:; echo "Binary was not linked. You need to have postinstall enabled. Please rerun 'npm install'"; exit $?
@ECHO OFF
ECHO Binary was not linked. You need to have postinstall enabled. Please rerun 'npm install'`;
const placeholderFile = `
#!/bin/bash
echo "Binary was not linked. You need to have postinstall enabled, please make sure to not use --ignore-scripts when installing deps.";
exit 1;
`;

fs.mkdirSync(path.join(__dirname, "..", "_release", "bin"));

Object.keys(bins).forEach((name) => {
if (bins[name]) {
const binPath = path.join(__dirname, "..", "_release", "bin", name);
fs.writeFileSync(binPath, placeholderFile);
fs.chmodSync(binPath, 0777);
fs.chmodSync(binPath, 511);
} else {
console.log("bins[name] name=" + name + " was empty. Weird.");
console.log(bins);
Expand Down