Skip to content

Commit

Permalink
fix: vscode addon
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jan 22, 2025
1 parent 2cd59dc commit a757471
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/addons/vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,23 @@ export const addonVSCode: Addon = {
return
}

const minEngineVersion = semver.minVersion(pkg.raw.engines.vscode)
if (!minEngineVersion) {
return
}

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(':')) {
if (!version || version.includes(':')) {
return
}

const minEngineVersion = semver.minVersion(pkg.raw.engines.vscode)
const minVersion = semver.minVersion(version)
if (!minEngineVersion || !minVersion) {
return
}

if (version && semver.gt(version, minEngineVersion)) {
if (semver.gt(minVersion, minEngineVersion)) {
// eslint-disable-next-line no-console
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
Expand Down

0 comments on commit a757471

Please sign in to comment.