Skip to content
This repository has been archived by the owner on Jul 20, 2024. It is now read-only.

Commit

Permalink
more fixes, changes, and imporvements to fix botway npm installer
Browse files Browse the repository at this point in the history
  • Loading branch information
abdfnx committed May 8, 2022
1 parent f226efe commit 76e9540
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
16 changes: 0 additions & 16 deletions installer/npm/bin/botway.js

This file was deleted.

12 changes: 12 additions & 0 deletions installer/npm/botway.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env node
import { execFileSync } from "child_process";
import { exit } from "process";

try {
execFileSync("./botwaybin", process.argv.slice(2), {
stdio: "inherit",
});
} catch (e) {
console.log(e);
exit(1);
}
7 changes: 6 additions & 1 deletion installer/npm/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async function install() {
if (old == "yes") {
return path.join(f, "bin");
} else if (old == "no") {
return "bin";
return "bbin";
} else {
return f;
}
Expand Down Expand Up @@ -67,8 +67,13 @@ async function install() {
if (err) throw err;
});

await fs.rename("bbin/botway", "botwaybin", function (err) {
if (err) throw err;
});

await fs.rm(zipFile);
await fs.rm(folder(), { recursive: true });
await fs.rm("bbin", { recursive: true });
}

install()
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"node": ">=8.0.0"
},
"bin": {
"botway": "installer/npm/bin/botway.js"
"botway": "installer/npm/botway.js"
},
"scripts": {
"postinstall": "node ./installer/npm/postinstall.js"
Expand Down

0 comments on commit 76e9540

Please sign in to comment.