1 | # vsce
|
2 |
|
3 | > _The Visual Studio Code Extension Manager_
|
4 |
|
5 | [![ci](https://github.com/microsoft/vsce/workflows/ci/badge.svg)](https://github.com/microsoft/vsce/actions?query=workflow%3Aci)
|
6 | [![Version](https://img.shields.io/npm/v/vsce.svg)](https://npmjs.org/package/vsce)
|
7 | [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
|
8 |
|
9 | ## Requirements
|
10 |
|
11 | - [Node.js](https://nodejs.org/en/) at least `14.x.x`
|
12 |
|
13 | Or simply [Docker](#usage-via-docker).
|
14 |
|
15 | ### Linux
|
16 |
|
17 | In order to save credentials safely, this project uses [keytar](https://www.npmjs.com/package/keytar) which uses `libsecret`, which you may need to install before publishing extensions. Setting the `VSCE_STORE=file` environment variable will revert back to the file credential store. Using the `VSCE_PAT` environment variable will also avoid using keytar.
|
18 |
|
19 | Depending on your distribution, you will need to run the following command:
|
20 |
|
21 | - Debian/Ubuntu: `sudo apt-get install libsecret-1-dev`
|
22 | - Alpine: `apk add libsecret`
|
23 | - Red Hat-based: `sudo yum install libsecret-devel`
|
24 | - Arch Linux: `sudo pacman -S libsecret`
|
25 |
|
26 | ## Usage
|
27 |
|
28 | Install vsce globally:
|
29 |
|
30 | ```console
|
31 | npm install --global vsce
|
32 | ```
|
33 |
|
34 | Verify the installation:
|
35 |
|
36 | ```console
|
37 | vsce --version
|
38 | ```
|
39 |
|
40 | `vsce` is meant to be mainly used as a command line tool. It can also be used a library since it exposes a small [API](https://github.com/microsoft/vscode-vsce/blob/main/src/api.ts). When using vsce as a library be sure to sanitize any user input used in API calls, as a security measurement.
|
41 |
|
42 | ## Usage via Docker
|
43 |
|
44 | You can also build a container for running vsce:
|
45 |
|
46 | ```console
|
47 | $ DOCKER_BUILDKIT=1 docker build --tag vsce "https://github.com/microsoft/vscode-vsce.git#main"
|
48 | ```
|
49 |
|
50 | Validate the container:
|
51 |
|
52 | ```console
|
53 | docker run --rm -it vsce --version
|
54 | ```
|
55 |
|
56 | Publish your local extension:
|
57 |
|
58 | ```console
|
59 | docker run --rm -it -v "$(pwd)":/workspace vsce publish
|
60 | ```
|
61 |
|
62 | ## Configuration
|
63 |
|
64 | You can configure the behavior of `vsce` by using CLI flags (run `vsce --help` to list them all). Example:
|
65 |
|
66 | ```console
|
67 | vsce publish --baseImagesUrl https://my.custom/base/images/url
|
68 | ```
|
69 |
|
70 | Or you can also set them in the `package.json`, so that you avoid having to retype the common options again. Example:
|
71 |
|
72 | ```jsonc
|
73 | // package.json
|
74 | {
|
75 | "vsce": {
|
76 | "baseImagesUrl": "https://my.custom/base/images/url"
|
77 | "dependencies": true,
|
78 | "yarn": false
|
79 | }
|
80 | }
|
81 | ```
|
82 |
|
83 | ## Development
|
84 |
|
85 | First clone this repository, then:
|
86 |
|
87 | ```console
|
88 | $ npm install
|
89 |
|
90 | $ npm run watch:build # or `watch:test` to also build tests
|
91 | ```
|
92 |
|
93 | Once the watcher is up and running, you can run out of sources with:
|
94 |
|
95 | ```console
|
96 | node vsce
|
97 | ```
|
98 |
|
99 | This project uses [semantic-release](https://semantic-release.gitbook.io/semantic-release/) and commit messages must follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec. This allows us to effortlessly automate releases.
|
100 |
|
101 | ## About
|
102 |
|
103 | This tool assists in packaging and publishing Visual Studio Code extensions.
|
104 |
|
105 | Read the [**Documentation**](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VS Code website.
|