2015-10-07 10:51:59 +02:00
|
|
|
# VSCode Extension Manager
|
2015-09-28 19:34:49 +02:00
|
|
|
|
2015-10-07 11:59:27 +02:00
|
|
|
This tool assists in publishing Visual Studio Code extensions.
|
2015-09-28 19:34:49 +02:00
|
|
|
|
2015-10-07 11:59:27 +02:00
|
|
|
```
|
|
|
|
npm install -g vsce
|
|
|
|
```
|
|
|
|
|
|
|
|
## Manifest files
|
|
|
|
|
2015-10-07 12:00:22 +02:00
|
|
|
Every Visual Studio Code extension needs a manifest file: `package.json`.
|
2015-10-07 11:59:27 +02:00
|
|
|
Make sure it has at least the following fields:
|
|
|
|
|
|
|
|
* `name`
|
|
|
|
* `version`
|
|
|
|
* `publisher`
|
|
|
|
* `engines.vscode`
|
|
|
|
|
|
|
|
### Example:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"name": "uuid",
|
|
|
|
"version": "0.0.1",
|
|
|
|
"publisher": "joaomoreno",
|
|
|
|
"engines": {
|
|
|
|
"vscode": "*"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Publishing
|
|
|
|
|
|
|
|
Before publishing it is good practice to list the files that will be included
|
|
|
|
in your extension's package:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ vsce ls
|
|
|
|
hello.js
|
|
|
|
package.json
|
|
|
|
```
|
|
|
|
|
|
|
|
If that looks good, you can now publish your extension:
|
2015-09-28 19:34:49 +02:00
|
|
|
|
|
|
|
```
|
2015-10-07 11:59:27 +02:00
|
|
|
$ vsce publish
|
|
|
|
Publishing uuid@0.0.1...
|
|
|
|
Successfully published uuid@0.0.1!
|
2015-09-28 19:34:49 +02:00
|
|
|
```
|
|
|
|
|
2015-10-07 11:59:27 +02:00
|
|
|
The extension should now appear in the gallery.
|
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
|
|
|
### `.vsceignore`
|
|
|
|
|
|
|
|
You can create a `.vsceignore` file to exclude some files from being included
|
|
|
|
in your extension's package. This file is a collection of
|
|
|
|
[glob](https://github.com/isaacs/minimatch) patterns, one per line.
|
|
|
|
For example:
|
2015-09-28 19:34:49 +02:00
|
|
|
|
|
|
|
```
|
2015-10-07 11:59:27 +02:00
|
|
|
**/*.ts
|
|
|
|
**/tsconfig.json
|
|
|
|
!file.ts
|
2015-09-28 19:34:49 +02:00
|
|
|
```
|
2015-10-07 11:59:27 +02:00
|
|
|
|
|
|
|
### Pre-publish step
|
|
|
|
|
|
|
|
It's possible to add a pre-publish step to your manifest file. The command
|
|
|
|
will be called everytime the extension is packaged.
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"name": "uuid",
|
|
|
|
"version": "0.0.1",
|
|
|
|
"publisher": "joaomoreno",
|
|
|
|
"engines": {
|
|
|
|
"vscode": "*"
|
|
|
|
},
|
|
|
|
"scripts": {
|
|
|
|
"vscode:prepublish": "tsc"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
This will always invoke the [TypeScript](http://www.typescriptlang.org/)
|
2015-10-07 12:00:22 +02:00
|
|
|
compiler whenever the extension is packaged.
|