Skip to content

Commit 032ae2d

Browse files
fix: etarget error on package update
1 parent 351f5c0 commit 032ae2d

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

dist/src/utils.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1859,8 +1859,17 @@ async function checkDependencyUpdates(credentialManager) {
18591859
const isBun = process.versions.bun &&
18601860
fs.existsSync(path.resolve(process.cwd(), 'bun.lock'));
18611861
const isPnpm = fs.existsSync(path.resolve(process.cwd(), 'pnpm-lock.yaml')) && !isBun;
1862+
const deps = packageJson
1863+
.dependencies || {};
18621864
const pkgTargets = updates
1863-
.map((u) => `"${u.name}@^${u.latest}"`)
1865+
.map((u) => {
1866+
if (u.source === 'GitHub') {
1867+
const spec = deps[u.name];
1868+
if (spec)
1869+
return `"${u.name}@${spec}"`;
1870+
}
1871+
return `"${u.name}@^${u.latest}"`;
1872+
})
18641873
.join(' ');
18651874
const cmd = isPnpm
18661875
? `pnpm add ${pkgTargets}`

src/utils.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2288,8 +2288,17 @@ async function checkDependencyUpdates(
22882288
fs.existsSync(path.resolve(process.cwd(), 'bun.lock'))
22892289
const isPnpm =
22902290
fs.existsSync(path.resolve(process.cwd(), 'pnpm-lock.yaml')) && !isBun
2291+
const deps =
2292+
(packageJson as { dependencies?: Record<string, string> })
2293+
.dependencies || {}
22912294
const pkgTargets = updates
2292-
.map((u) => `"${u.name}@^${u.latest}"`)
2295+
.map((u) => {
2296+
if (u.source === 'GitHub') {
2297+
const spec = deps[u.name]
2298+
if (spec) return `"${u.name}@${spec}"`
2299+
}
2300+
return `"${u.name}@^${u.latest}"`
2301+
})
22932302
.join(' ')
22942303
const cmd = isPnpm
22952304
? `pnpm add ${pkgTargets}`

0 commit comments

Comments
 (0)