https://github.com/ntnyq/vscode-extension-manifest
:package: VSCode extension manifest type definitions, validators, and utilities.
https://github.com/ntnyq/vscode-extension-manifest
Last synced: 3 months ago
JSON representation
:package: VSCode extension manifest type definitions, validators, and utilities.
- Host: GitHub
- URL: https://github.com/ntnyq/vscode-extension-manifest
- Owner: ntnyq
- License: mit
- Created: 2024-11-24T21:43:15.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-07-14T06:37:18.000Z (3 months ago)
- Last Synced: 2025-07-14T19:00:07.228Z (3 months ago)
- Language: TypeScript
- Size: 607 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vscode-extension-manifest
[](https://github.com/ntnyq/vscode-extension-manifest/actions)
[](https://www.npmjs.com/package/vscode-extension-manifest)
[](https://www.npmjs.com/package/vscode-extension-manifest)
[](https://codecov.io/github/ntnyq/vscode-extension-manifest)
[](https://github.com/ntnyq/vscode-extension-manifest/blob/main/LICENSE)> VSCode extension manifest type definitions, validators, and utilities.
> [!NOTE]
> This package only provides types for VSCode extension manifest related fields listed in [Extension Manifest](https://code.visualstudio.com/api/references/extension-manifest).
>
> If you need type support for a normal NodeJs package.json file, please check [type-fest - package-json.d.ts](https://github.com/sindresorhus/type-fest/blob/main/source/package-json.d.ts).## Install
```shell
npm install vscode-extension-manifest -D
``````shell
yarn add vscode-extension-manifest -D
``````shell
pnpm add vscode-extension-manifest -D
``````shell
bun add vscode-extension-manifest -D
```## Usage
```ts
import {
defineExtensionManifest,
readExtensionManifest,
readExtensionManifestSync,
validateExtensionManifest,
writeExtensionManifest,
writeExtensionManifestSync,
} from 'vscode-extension-manifest'console.log(await readExtensionManifest())
//=> VSCode extension manifest with types definitionconsole.log(validateExtensionManifest(readExtensionManifestSync()))
// => true if valid, false otherwiseconst extensionManifest = defineExtensionManifest({
name: 'vscode-extension-manifest',
version: '1.0.0',
publisher: 'ntnyq',
engines: {
vscode: '^1.96.0',
},
})await writeExtensionManifest(extensionManifest, {
cwd: 'packages/extension',
})writeExtensionManifestSync(extensionManifest, {
cwd: 'vscode',
})
```## API
### readExtensionManifest
- Type: `(options?: ReadOptions) => Promise`
Returns a `Promise` for VSCode extension manifest with type definition.
#### ReadOptions
for `readExtensionManifest` and `readExtensionManifestSync`
##### filename
- Type: `string`
- Default: `package.json`
- Required: `false`The filename of the extension manifest.
##### cwd
- Type: `string | URL`
- Default: `process.cwd()`
- Required: `false`The current working directory.
##### cache
- Type: `boolean | Map>`
- Default: `undefined`
- Required: `false`Specifies whether the read results should be cached. Can be a boolean or a map to hold the cached data.
### readExtensionManifestSync
- Type: `(options?: ReadOptions) => ExtensionManifest`
Returns VSCode extension manifest with type definition.
#### ReadOptions
Same as **readExtensionManifest**
### writeExtensionManifest
- Type: `(manifest: ExtensionManifest, options?: WriteOptions) => Promise`
#### WriteOptions
for `writeExtensionManifest` and `writeExtensionManifestSync`
##### filename
- Type: `string`
- Default: `package.json`
- Required: `false`The filename of the extension manifest.
##### cwd
- Type: `string | URL`
- Default: `process.cwd()`
- Required: `false`The current working directory.
##### replacer
- Type: `(number | string)[] | null`
- Default: `null`
- Required: `false`The replacer for JSON.stringify.
##### space
- Type: `number | string`
- Default: `2`
- Required: `false`The space for JSON.stringify.
##### stringify
- Type: `(value: any) => string`
- Default: `JSON.stringify`
- Required: `false`The stringify function.
### writeExtensionManifestSync
- Type: `(manifest: ExtensionManifest, options?: WriteOptions) => void`
#### WriteOptions
Same as **writeExtensionManifest**
### defineExtensionManifest
Define a vscode extension manifest.
#### Parameters
##### manifest
- Type: `ExtensionManifest`
- Required: `true`The extension manifest.
### validateExtensionManifest
- Type: `(manifest: ExtensionManifest) => boolean`
Returns `true` if the extension manifest is valid, `false` otherwise.
By checking the following properties:
- `publisher`
#### Parameters
##### manifest
- Type: `ExtensionManifest`
- Required: `true`Read by `readExtensionManifest` or `readExtensionManifestSync`.
## Contributes
Find any types definition that are missing or not match.
Please create an [issue](https://github.com/ntnyq/vscode-extension-manifest/issues/new) or pull request.
## Links
- [Extension Manifest](https://code.visualstudio.com/api/references/extension-manifest)
- [Contribution Points](https://code.visualstudio.com/api/references/contribution-points)
- [Extension Manifest types](https://github.com/microsoft/vscode/blob/main/src/vs/platform/extensions/common/extensions.ts)## License
[MIT](./LICENSE) License © 2024-PRESENT [ntnyq](https://github.com/ntnyq)