@synsci/openscience 1.2.0 → 1.2.2

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.
package/bin/openscience CHANGED
@@ -59,7 +59,7 @@ const archMap = { x64: "x64", arm64: "arm64", arm: "arm" }
59
59
  const platform = platformMap[os.platform()] || os.platform()
60
60
  const arch = archMap[os.arch()] || os.arch()
61
61
  const base = "openscience-" + platform + "-" + arch
62
- const scopedBase = "cli-" + platform + "-" + arch
62
+ const scopedBase = "openscience-" + platform + "-" + arch
63
63
 
64
64
  // 2. Search this install's node_modules for the matching platform package.
65
65
  // This must come before ~/.openscience or Homebrew fallbacks; otherwise an npm
@@ -77,7 +77,7 @@ while (true) {
77
77
  }
78
78
  }
79
79
  // Check scoped packages (@synsci/openscience-darwin-arm64)
80
- const scoped = path.join(modules, "@openscience")
80
+ const scoped = path.join(modules, "@synsci")
81
81
  if (fs.existsSync(scoped)) {
82
82
  const scopedEntries = fs.readdirSync(scoped)
83
83
  for (const entry of scopedEntries) {
package/package.json CHANGED
@@ -6,19 +6,18 @@
6
6
  "scripts": {
7
7
  "postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
8
8
  },
9
- "version": "1.2.0",
9
+ "version": "1.2.2",
10
10
  "optionalDependencies": {
11
- "@synsci/openscience-linux-x64-baseline-musl": "1.2.0",
12
- "@synsci/openscience-windows-x64-baseline": "1.2.0",
13
- "@synsci/openscience-linux-x64-baseline": "1.2.0",
14
- "@synsci/openscience-darwin-x64": "1.2.0",
15
- "@synsci/openscience-linux-arm64-musl": "1.2.0",
16
- "@synsci/openscience-darwin-x64-baseline": "1.2.0",
17
- "@synsci/openscience": "1.2.0",
18
- "@synsci/openscience-linux-x64-musl": "1.2.0",
19
- "@synsci/openscience-darwin-arm64": "1.2.0",
20
- "@synsci/openscience-linux-arm64": "1.2.0",
21
- "@synsci/openscience-windows-x64": "1.2.0",
22
- "@synsci/openscience-linux-x64": "1.2.0"
11
+ "@synsci/openscience-linux-x64-baseline-musl": "1.2.2",
12
+ "@synsci/openscience-windows-x64-baseline": "1.2.2",
13
+ "@synsci/openscience-linux-x64-baseline": "1.2.2",
14
+ "@synsci/openscience-darwin-x64": "1.2.2",
15
+ "@synsci/openscience-linux-arm64-musl": "1.2.2",
16
+ "@synsci/openscience-darwin-x64-baseline": "1.2.2",
17
+ "@synsci/openscience-linux-x64-musl": "1.2.2",
18
+ "@synsci/openscience-darwin-arm64": "1.2.2",
19
+ "@synsci/openscience-linux-arm64": "1.2.2",
20
+ "@synsci/openscience-windows-x64": "1.2.2",
21
+ "@synsci/openscience-linux-x64": "1.2.2"
23
22
  }
24
23
  }
@@ -1,116 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const childProcess = require("child_process")
4
- const fs = require("fs")
5
- const path = require("path")
6
- const os = require("os")
7
-
8
- function run(target) {
9
- // Clean up files that confuse Bun compiled binaries.
10
- // Install dir stays as ~/.openscience/ until the path-migration follow-up PR.
11
- const openscienceDir = path.join(os.homedir(), ".openscience")
12
- for (const poison of ["package.json", ".gitignore", "bun.lockb", "bunfig.toml"]) {
13
- try { fs.unlinkSync(path.join(openscienceDir, poison)) } catch {}
14
- }
15
- try { fs.rmSync(path.join(openscienceDir, "node_modules"), { recursive: true }) } catch {}
16
- // Clear macOS extended attributes that cause Bun binaries to hang
17
- if (os.platform() === "darwin") {
18
- try { childProcess.spawnSync("xattr", ["-rc", openscienceDir], { stdio: "ignore" }) } catch {}
19
- }
20
-
21
- const result = childProcess.spawnSync(target, process.argv.slice(2), {
22
- stdio: "inherit",
23
- })
24
- if (result.error) {
25
- console.error(result.error.message)
26
- process.exit(1)
27
- }
28
- const code = typeof result.status === "number" ? result.status : 0
29
- process.exit(code)
30
- }
31
-
32
- // Helper: check if a path points to a real binary (not this wrapper script)
33
- function isBinary(p) {
34
- try {
35
- if (!fs.existsSync(p)) return false
36
- const real = fs.realpathSync(p)
37
- // Skip if it resolves to this script (self-reference via symlink)
38
- if (real === fs.realpathSync(__filename)) return false
39
- // Skip if it's a .js file (another wrapper)
40
- if (real.endsWith(".js")) return false
41
- return true
42
- } catch {
43
- return false
44
- }
45
- }
46
-
47
- // 1. Check OPENSCIENCE_BIN_PATH env var
48
- const envPath = process.env.OPENSCIENCE_BIN_PATH
49
- if (envPath && isBinary(envPath)) {
50
- run(envPath)
51
- }
52
-
53
- const binary = os.platform() === "win32" ? "openscience.exe" : "openscience"
54
- const scriptPath = fs.realpathSync(__filename)
55
- const scriptDir = path.dirname(scriptPath)
56
-
57
- const platformMap = { darwin: "darwin", linux: "linux", win32: "windows" }
58
- const archMap = { x64: "x64", arm64: "arm64", arm: "arm" }
59
- const platform = platformMap[os.platform()] || os.platform()
60
- const arch = archMap[os.arch()] || os.arch()
61
- const base = "openscience-" + platform + "-" + arch
62
- const scopedBase = "cli-" + platform + "-" + arch
63
-
64
- // 2. Search this install's node_modules for the matching platform package.
65
- // This must come before ~/.openscience or Homebrew fallbacks; otherwise an npm
66
- // install can accidentally launch an older globally-installed binary.
67
- let current = scriptDir
68
- while (true) {
69
- const modules = path.join(current, "node_modules")
70
- if (fs.existsSync(modules)) {
71
- try {
72
- const entries = fs.readdirSync(modules)
73
- for (const entry of entries) {
74
- if (entry.startsWith(base)) {
75
- const candidate = path.join(modules, entry, "bin", binary)
76
- if (isBinary(candidate)) run(candidate)
77
- }
78
- }
79
- // Check scoped packages (@synsci/openscience-darwin-arm64)
80
- const scoped = path.join(modules, "@openscience")
81
- if (fs.existsSync(scoped)) {
82
- const scopedEntries = fs.readdirSync(scoped)
83
- for (const entry of scopedEntries) {
84
- if (entry.startsWith(scopedBase)) {
85
- const candidate = path.join(scoped, entry, "bin", binary)
86
- if (isBinary(candidate)) run(candidate)
87
- }
88
- }
89
- }
90
- } catch {}
91
- }
92
- const parent = path.dirname(current)
93
- if (parent === current) break
94
- current = parent
95
- }
96
-
97
- // 3. Check ~/.openscience/bin (curl installer fallback; dir renamed later)
98
- const homeBin = path.join(os.homedir(), ".openscience", "bin", binary)
99
- if (isBinary(homeBin)) {
100
- run(homeBin)
101
- }
102
-
103
- // 4. Check /opt/homebrew/bin (macOS)
104
- if (os.platform() === "darwin" && isBinary("/opt/homebrew/bin/openscience")) {
105
- run("/opt/homebrew/bin/openscience")
106
- }
107
-
108
- // 5. Check /usr/local/bin
109
- if (isBinary("/usr/local/bin/openscience")) {
110
- run("/usr/local/bin/openscience")
111
- }
112
-
113
- console.error("openscience binary not found.")
114
- console.error("Install with: curl -fsSL https://syntheticsciences.ai/install | bash")
115
- console.error("Or set OPENSCIENCE_BIN_PATH environment variable.")
116
- process.exit(1)