Skip to content

Commit

Permalink
fix(vscode): ignore special protocols for engine version bumpping
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Sep 14, 2024
1 parent 8ffef60 commit a3af724
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/addons/vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@ export const addonVSCode: Addon = {
return
}

const version = pkg.raw.dependencies?.['@types/vscode']
const version: string = pkg.raw.dependencies?.['@types/vscode']
|| pkg.raw.devDependencies?.['@types/vscode']
|| pkg.raw.peerDependencies?.['@types/vscode']
|| ''

// Protocols like `workspace:` and `catalog:`, we skip them
if (version.includes(':')) {
return
}

if (version && pkg.raw.engines?.vscode !== version) {
// eslint-disable-next-line no-console
console.log(`[addon] Updated VS Code engine field to ${version}`)
console.log(`[taze addon] Updated VS Code engine field to ${version}`)
// If the version is not a range (fixed version), we prepend it with a caret
pkg.raw.engines.vscode = /[>^<:~]/.test(version) ? version : `^${version}`
}
Expand Down

0 comments on commit a3af724

Please sign in to comment.