From 339f93c1c5fa39455264be06da04c065fe18b2df Mon Sep 17 00:00:00 2001 From: "Azat S." Date: Wed, 23 Oct 2024 01:33:12 +0300 Subject: [PATCH] fix: add missed postinstall script --- bin/todoctor.js | 3 +-- package.json | 3 ++- scripts/postinstall.js | 8 ++++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/bin/todoctor.js b/bin/todoctor.js index a43d7dd..263f27e 100755 --- a/bin/todoctor.js +++ b/bin/todoctor.js @@ -7,12 +7,11 @@ import os from 'node:os' import fs from 'node:fs' let filename = fileURLToPath(import.meta.url) +let dirname = path.dirname(filename) let platform = os.platform() let arch = os.arch() -export let dirname = path.dirname(filename) - export let binaries = { 'win32:x64': 'windows/x64/todoctor.exe', 'darwin:arm64': 'macos/arm64/todoctor', diff --git a/package.json b/package.json index 02c5dda..00a245b 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,8 @@ "files": [ "./bin", "./build", - "./dist" + "./dist", + "./scripts" ], "devDependencies": { "@azat-io/eslint-config-typescript": "^1.10.0", diff --git a/scripts/postinstall.js b/scripts/postinstall.js index 586223b..cc92be3 100644 --- a/scripts/postinstall.js +++ b/scripts/postinstall.js @@ -1,8 +1,12 @@ +import { fileURLToPath } from 'node:url' import path from 'node:path' import fs from 'node:fs' -import { dirname as binDirectory, binaries } from '../bin/todoctor' +import { binaries } from '../bin/todoctor' + +let filename = fileURLToPath(import.meta.url) +let dirname = path.dirname(filename) Object.values(binaries).forEach(binaryPath => { - fs.chmodSync(path.join(binDirectory, binaryPath), 0o755) + fs.chmodSync(path.join(dirname, '../bin/', binaryPath), 0o755) })