codex-1up 0.3.11 → 0.3.13

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "codex-1up",
3
3
  "private": false,
4
4
  "type": "module",
5
- "version": "0.3.11",
5
+ "version": "0.3.13",
6
6
  "description": "TypeScript CLI for codex-1up (citty-based)",
7
7
  "bin": {
8
8
  "codex-1up": "bin/codex-1up.mjs"
@@ -40,6 +40,7 @@ const description = escapeRubyString(pkg.description || 'Command-line interface'
40
40
  const homepage = resolveHomepage(pkg.repository)
41
41
  const license = normalizeLicense(pkg.license)
42
42
  const binName = resolveBinName(pkg.bin, pkgName)
43
+ const binRelPath = resolveBinRelPath(pkg.bin, pkgName, binName)
43
44
 
44
45
  const formula = `class ${formulaClass} < Formula
45
46
  desc "${description}"
@@ -53,6 +54,9 @@ const formula = `class ${formulaClass} < Formula
53
54
  def install
54
55
  ENV["HOME"] = buildpath
55
56
  system "npm", "install", *std_npm_args
57
+ # npm install doesn't reliably create prefix/bin shims for ESM .mjs bins;
58
+ # symlink the package's bin entrypoint explicitly (preserves relative dist paths).
59
+ bin.install_symlink libexec/"lib/node_modules/${pkgName}/${binRelPath}" => "${binName}"
56
60
  end
57
61
 
58
62
  test do
@@ -117,3 +121,15 @@ function resolveBinName(bin, fallback) {
117
121
  }
118
122
  return fallback
119
123
  }
124
+
125
+ function resolveBinRelPath(bin, pkgName, binName) {
126
+ if (!bin) return `bin/${pkgName}.mjs`
127
+ if (typeof bin === 'string') return bin
128
+ if (typeof bin === 'object' && bin[binName]) return String(bin[binName])
129
+ // Fallback: first value in the map.
130
+ if (typeof bin === 'object') {
131
+ const values = Object.values(bin).map(String).filter(Boolean)
132
+ if (values.length > 0) return values[0]
133
+ }
134
+ return `bin/${pkgName}.mjs`
135
+ }