@dptech-corp/bohr-cli 2.2.1 → 2.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
Binary file
Binary file
Binary file
package/install.js CHANGED
@@ -2,6 +2,7 @@
2
2
  const fs = require("fs");
3
3
  const path = require("path");
4
4
  const os = require("os");
5
+ const { execSync } = require("child_process");
5
6
 
6
7
  const platform = os.platform();
7
8
  const arch = os.arch();
@@ -23,3 +24,21 @@ if (!fs.existsSync(binaryPath)) {
23
24
  }
24
25
 
25
26
  fs.chmodSync(binaryPath, 0o755);
27
+
28
+ // Force-overwrite any existing "bohr" binary in the npm bin directory.
29
+ // This handles the case where a previous (different) package installed a "bohr"
30
+ // executable, which would otherwise cause npm to refuse creating the bin link.
31
+ try {
32
+ const npmBin = execSync("npm bin -g", { encoding: "utf8" }).trim();
33
+ const targetLink = path.join(npmBin, "bohr");
34
+ const runJs = path.join(__dirname, "run.js");
35
+ if (fs.existsSync(targetLink)) {
36
+ const resolved = fs.realpathSync(targetLink);
37
+ if (resolved !== fs.realpathSync(runJs)) {
38
+ fs.unlinkSync(targetLink);
39
+ fs.symlinkSync(runJs, targetLink);
40
+ }
41
+ }
42
+ } catch (_) {
43
+ // Best-effort: if this fails, npm's own bin linking will still attempt normally.
44
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dptech-corp/bohr-cli",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "description": "CLI tool for Bohrium scientific computing platform",
5
5
  "bin": {
6
6
  "bohr": "run.js"