-
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: introduce addon system, add vscode addon, close #129
- Loading branch information
Showing
6 changed files
with
66 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { addonVSCode } from './vscode'; | ||
|
||
export const builtinAddons = [ | ||
addonVSCode, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { Addon } from '../types' | ||
|
||
/** | ||
* Sync VS Code engine with the version of `@types/vscode` | ||
*/ | ||
export const addonVSCode: Addon = { | ||
beforeWrite(pkg) { | ||
if (!pkg.raw?.engines?.vscode) { | ||
return | ||
} | ||
|
||
const version = pkg.raw.dependencies?.['@types/vscode'] | ||
|| pkg.raw.devDependencies?.['@types/vscode'] | ||
|| pkg.raw.peerDependencies?.['@types/vscode'] | ||
|
||
if (version && pkg.raw.engines?.vscode !== version) { | ||
// eslint-disable-next-line no-console | ||
console.log(`[addon] Updated VS Code engine field to ${version}`) | ||
pkg.raw.engines.vscode = version | ||
} | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters