@newtype-os/cli 0.0.24 → 0.0.26

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.
Files changed (3) hide show
  1. package/bin/nt +6 -3
  2. package/package.json +12 -12
  3. package/postinstall.mjs +23 -3
package/bin/nt CHANGED
@@ -162,10 +162,13 @@ function findBinary(startDir) {
162
162
 
163
163
  const resolved = findBinary(scriptDir)
164
164
  if (!resolved) {
165
+ const pkg = names[0]
165
166
  console.error(
166
- "It seems that your package manager failed to install the right version of the Newtype CLI for your platform. You can try manually installing " +
167
- names.map((n) => `\"${n}\"`).join(" or ") +
168
- " package",
167
+ "It seems that your package manager failed to install the right version of the Newtype CLI for your platform.\n\n" +
168
+ "To fix this, run:\n\n" +
169
+ " npm install -g " + pkg + "\n\n" +
170
+ "If that doesn't work, try reinstalling:\n\n" +
171
+ " npm install -g @newtype-os/cli\n",
169
172
  )
170
173
  process.exit(1)
171
174
  }
package/package.json CHANGED
@@ -6,19 +6,19 @@
6
6
  "scripts": {
7
7
  "postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
8
8
  },
9
- "version": "0.0.24",
9
+ "version": "0.0.26",
10
10
  "license": "MIT",
11
11
  "optionalDependencies": {
12
- "@newtype-os/cli-linux-arm64-musl": "0.0.24",
13
- "@newtype-os/cli-linux-x64-baseline-musl": "0.0.24",
14
- "@newtype-os/cli-linux-x64": "0.0.24",
15
- "@newtype-os/cli-linux-arm64": "0.0.24",
16
- "@newtype-os/cli-darwin-arm64": "0.0.24",
17
- "@newtype-os/cli-linux-x64-baseline": "0.0.24",
18
- "@newtype-os/cli-darwin-x64": "0.0.24",
19
- "@newtype-os/cli-windows-x64": "0.0.24",
20
- "@newtype-os/cli-darwin-x64-baseline": "0.0.24",
21
- "@newtype-os/cli-windows-x64-baseline": "0.0.24",
22
- "@newtype-os/cli-linux-x64-musl": "0.0.24"
12
+ "@newtype-os/cli-linux-arm64-musl": "0.0.26",
13
+ "@newtype-os/cli-linux-x64-baseline-musl": "0.0.26",
14
+ "@newtype-os/cli-linux-x64": "0.0.26",
15
+ "@newtype-os/cli-linux-arm64": "0.0.26",
16
+ "@newtype-os/cli-darwin-arm64": "0.0.26",
17
+ "@newtype-os/cli-linux-x64-baseline": "0.0.26",
18
+ "@newtype-os/cli-darwin-x64": "0.0.26",
19
+ "@newtype-os/cli-windows-x64": "0.0.26",
20
+ "@newtype-os/cli-darwin-x64-baseline": "0.0.26",
21
+ "@newtype-os/cli-windows-x64-baseline": "0.0.26",
22
+ "@newtype-os/cli-linux-x64-musl": "0.0.26"
23
23
  }
24
24
  }
package/postinstall.mjs CHANGED
@@ -5,6 +5,7 @@ import path from "path"
5
5
  import os from "os"
6
6
  import { fileURLToPath } from "url"
7
7
  import { createRequire } from "module"
8
+ import { execSync } from "child_process"
8
9
 
9
10
  const __dirname = path.dirname(fileURLToPath(import.meta.url))
10
11
  const require = createRequire(import.meta.url)
@@ -50,7 +51,7 @@ function detectPlatformAndArch() {
50
51
  function findBinary() {
51
52
  const { platform, arch } = detectPlatformAndArch()
52
53
  const packageName = `@newtype-os/cli-${platform}-${arch}`
53
- const binaryName = platform === "windows" ? "newtype.exe" : "newtype"
54
+ const binaryName = platform === "windows" ? "nt.exe" : "nt"
54
55
 
55
56
  try {
56
57
  // Use require.resolve to find the package
@@ -106,8 +107,27 @@ async function main() {
106
107
  } else {
107
108
  // On non-Windows platforms, just verify the binary package exists
108
109
  // Don't replace the wrapper script - it handles binary execution
109
- const { binaryPath } = findBinary()
110
- console.log(`Platform binary verified at: ${binaryPath}`)
110
+ try {
111
+ const { binaryPath } = findBinary()
112
+ console.log(`Platform binary verified at: ${binaryPath}`)
113
+ } catch (findError) {
114
+ // Binary package missing — attempt to install it
115
+ const { platform, arch } = detectPlatformAndArch()
116
+ const packageName = `@newtype-os/cli-${platform}-${arch}`
117
+ console.log(`Platform binary not found, attempting to install ${packageName}...`)
118
+ try {
119
+ execSync(`npm install ${packageName}`, {
120
+ cwd: path.join(__dirname, ".."),
121
+ stdio: "inherit",
122
+ timeout: 120_000,
123
+ })
124
+ const { binaryPath } = findBinary()
125
+ console.log(`Platform binary installed and verified at: ${binaryPath}`)
126
+ } catch (installError) {
127
+ console.error(`Failed to auto-install ${packageName}: ${installError.message}`)
128
+ console.error(`You can fix this manually by running: npm install -g ${packageName}`)
129
+ }
130
+ }
111
131
  console.log("Wrapper script will handle binary execution")
112
132
  }
113
133
  } catch (error) {