@able-autonomy/able 0.0.12 → 0.0.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/able.ts +6 -5
- package/package.json +1 -1
package/able.ts
CHANGED
|
@@ -103,15 +103,16 @@ if (command === 'config') {
|
|
|
103
103
|
}
|
|
104
104
|
// `bunx` keeps the copy it fetched first; asking for @latest once refreshes it. A host that pins Able runs its pin instead.
|
|
105
105
|
if (command === 'upgrade') {
|
|
106
|
-
const { version: current } = await Bun.file(join(import.meta.dir, 'package.json')).json()
|
|
107
|
-
const
|
|
108
|
-
|
|
106
|
+
const { name, version: current } = await Bun.file(join(import.meta.dir, 'package.json')).json()
|
|
107
|
+
const latest = Bun.spawnSync(['bun', 'info', name, 'version'], { stderr: 'ignore' }).stdout.toString().trim().split('\n').at(-1) ?? ''
|
|
108
|
+
if (!latest) fail(`bun info ${name} found no published version`)
|
|
109
|
+
const pinned = Bun.file(`node_modules/${name}/package.json`)
|
|
109
110
|
if (await pinned.exists()) {
|
|
110
111
|
const pin = (await pinned.json()).version
|
|
111
112
|
console.log(
|
|
112
113
|
pin === latest
|
|
113
114
|
? `Congrats! This folder already pins the latest able (v${latest})`
|
|
114
|
-
: `This folder pins able v${pin}; the latest is v${latest}. Set
|
|
115
|
+
: `This folder pins able v${pin}; the latest is v${latest}. Set ${name} to ${latest} in package.json, then bun install`,
|
|
115
116
|
)
|
|
116
117
|
process.exit(0)
|
|
117
118
|
}
|
|
@@ -119,7 +120,7 @@ if (command === 'upgrade') {
|
|
|
119
120
|
console.log(`Congrats! You're already on the latest version of able (which is v${current})`)
|
|
120
121
|
process.exit(0)
|
|
121
122
|
}
|
|
122
|
-
if (Bun.spawnSync(['bunx',
|
|
123
|
+
if (Bun.spawnSync(['bunx', `${name}@latest`], { stdout: 'ignore', stderr: 'ignore' }).exitCode !== 0) fail(`bunx ${name}@latest failed`)
|
|
123
124
|
console.log(`Upgraded able v${current} → v${latest}`)
|
|
124
125
|
process.exit(0)
|
|
125
126
|
}
|