diff --git a/installer/npm/bin/botway.js b/installer/npm/bin/botway.js deleted file mode 100755 index ce342f9b..00000000 --- a/installer/npm/bin/botway.js +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env node -import { execFileSync } from "child_process"; -import path from "path"; -import { exit } from "process"; -import { fileURLToPath } from "url"; - -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); - -try { - execFileSync(path.resolve(`${__dirname}/botway`), process.argv.slice(2), { - stdio: "inherit", - }); -} catch (e) { - exit(1); -} diff --git a/installer/npm/botway.js b/installer/npm/botway.js new file mode 100755 index 00000000..0d722612 --- /dev/null +++ b/installer/npm/botway.js @@ -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); +} diff --git a/installer/npm/postinstall.js b/installer/npm/postinstall.js index 79fb1e45..27414d4a 100755 --- a/installer/npm/postinstall.js +++ b/installer/npm/postinstall.js @@ -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; } @@ -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() diff --git a/package.json b/package.json index 315ea9df..aa9e0005 100644 --- a/package.json +++ b/package.json @@ -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"