@nipurn/xprompt-v1 1.1.22 → 1.1.23

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.

Potentially problematic release.


This version of @nipurn/xprompt-v1 might be problematic. Click here for more details.

package/bin/100xprompt ADDED
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+ import { spawn } from "child_process"
3
+ import path from "path"
4
+ import fs from "fs"
5
+ import { fileURLToPath } from "url"
6
+
7
+ const __filename = fileURLToPath(import.meta.url)
8
+ const __dirname = path.dirname(__filename)
9
+
10
+ function getPlatformPackageName() {
11
+ const platform = process.platform
12
+ const arch = process.arch
13
+ // @ts-ignore
14
+ const isMusl = process.report?.getReport?.()?.header?.glibcVersionRuntime === undefined
15
+
16
+ let osName
17
+ if (platform === 'darwin') osName = 'darwin'
18
+ else if (platform === 'linux') osName = 'linux'
19
+ else if (platform === 'win32') osName = 'windows'
20
+
21
+ let pkgName = `nipurn-xprompt-v1-${osName}-${arch}`
22
+ if (platform === 'linux' && isMusl) {
23
+ pkgName = `nipurn-xprompt-v1-linux-${arch}-musl`
24
+ }
25
+
26
+ return pkgName
27
+ }
28
+
29
+ const platformPackageName = getPlatformPackageName()
30
+ const binDir = path.join(__dirname, '..', 'node_modules', platformPackageName, 'bin')
31
+ const binPath = path.join(binDir, '100xprompt')
32
+
33
+ if (!fs.existsSync(binPath)) {
34
+ console.error(`Error: Binary not found at ${binPath}`)
35
+ console.error('This package requires a platform-specific optional dependency.')
36
+ console.error('Please ensure that the correct optional dependency is installed for your system.')
37
+ console.error('You might need to run "npm install" or "yarn install" again.')
38
+ process.exit(1)
39
+ }
40
+
41
+ const args = process.argv.slice(2)
42
+ const child = spawn(binPath, args, { stdio: 'inherit' })
43
+
44
+ child.on('close', (code) => {
45
+ process.exit(code ?? 0)
46
+ })
47
+
48
+ child.on('error', (err) => {
49
+ console.error('Failed to start binary:', err)
50
+ process.exit(1)
51
+ })
package/package.json CHANGED
@@ -6,18 +6,18 @@
6
6
  "scripts": {
7
7
  "postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
8
8
  },
9
- "version": "1.1.22",
9
+ "version": "1.1.23",
10
10
  "optionalDependencies": {
11
- "nipurn-xprompt-v1-linux-arm64": "1.1.22",
12
- "nipurn-xprompt-v1-linux-x64": "1.1.22",
13
- "nipurn-xprompt-v1-linux-x64-baseline": "1.1.22",
14
- "nipurn-xprompt-v1-linux-arm64-musl": "1.1.22",
15
- "nipurn-xprompt-v1-linux-x64-musl": "1.1.22",
16
- "nipurn-xprompt-v1-linux-x64-baseline-musl": "1.1.22",
17
- "nipurn-xprompt-v1-darwin-arm64": "1.1.22",
18
- "nipurn-xprompt-v1-darwin-x64": "1.1.22",
19
- "nipurn-xprompt-v1-darwin-x64-baseline": "1.1.22",
20
- "nipurn-xprompt-v1-windows-x64": "1.1.22",
21
- "nipurn-xprompt-v1-windows-x64-baseline": "1.1.22"
11
+ "nipurn-xprompt-v1-linux-arm64": "1.1.23",
12
+ "nipurn-xprompt-v1-linux-x64": "1.1.23",
13
+ "nipurn-xprompt-v1-linux-x64-baseline": "1.1.23",
14
+ "nipurn-xprompt-v1-linux-arm64-musl": "1.1.23",
15
+ "nipurn-xprompt-v1-linux-x64-musl": "1.1.23",
16
+ "nipurn-xprompt-v1-linux-x64-baseline-musl": "1.1.23",
17
+ "nipurn-xprompt-v1-darwin-arm64": "1.1.23",
18
+ "nipurn-xprompt-v1-darwin-x64": "1.1.23",
19
+ "nipurn-xprompt-v1-darwin-x64-baseline": "1.1.23",
20
+ "nipurn-xprompt-v1-windows-x64": "1.1.23",
21
+ "nipurn-xprompt-v1-windows-x64-baseline": "1.1.23"
22
22
  }
23
23
  }
@@ -1,84 +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
- const result = childProcess.spawnSync(target, process.argv.slice(2), {
10
- stdio: "inherit",
11
- })
12
- if (result.error) {
13
- console.error(result.error.message)
14
- process.exit(1)
15
- }
16
- const code = typeof result.status === "number" ? result.status : 0
17
- process.exit(code)
18
- }
19
-
20
- const envPath = process.env.HUNDREDXPROMPT_BIN_PATH
21
- if (envPath) {
22
- run(envPath)
23
- }
24
-
25
- const scriptPath = fs.realpathSync(__filename)
26
- const scriptDir = path.dirname(scriptPath)
27
-
28
- const platformMap = {
29
- darwin: "darwin",
30
- linux: "linux",
31
- win32: "windows",
32
- }
33
- const archMap = {
34
- x64: "x64",
35
- arm64: "arm64",
36
- arm: "arm",
37
- }
38
-
39
- let platform = platformMap[os.platform()]
40
- if (!platform) {
41
- platform = os.platform()
42
- }
43
- let arch = archMap[os.arch()]
44
- if (!arch) {
45
- arch = os.arch()
46
- }
47
- const base = "100xprompt-" + platform + "-" + arch
48
- const binary = platform === "windows" ? "100xprompt.exe" : "100xprompt"
49
-
50
- function findBinary(startDir) {
51
- let current = startDir
52
- for (;;) {
53
- const modules = path.join(current, "node_modules")
54
- if (fs.existsSync(modules)) {
55
- const entries = fs.readdirSync(modules)
56
- for (const entry of entries) {
57
- if (!entry.startsWith(base)) {
58
- continue
59
- }
60
- const candidate = path.join(modules, entry, "bin", binary)
61
- if (fs.existsSync(candidate)) {
62
- return candidate
63
- }
64
- }
65
- }
66
- const parent = path.dirname(current)
67
- if (parent === current) {
68
- return
69
- }
70
- current = parent
71
- }
72
- }
73
-
74
- const resolved = findBinary(scriptDir)
75
- if (!resolved) {
76
- console.error(
77
- 'It seems that your package manager failed to install the right version of the 100xprompt CLI for your platform. You can try manually installing the "' +
78
- base +
79
- '" package',
80
- )
81
- process.exit(1)
82
- }
83
-
84
- run(resolved)