Azure DevOps allows creating custom extensions. As there are gaps in the documentation, I wrote my Learning Notes as I created this template.
This repository is my attempt to combine the best practices of these two code samples:
- azure-devops-extension-sample: the main samples repo using the latest Azure devops extensions SDK, and
- azure-devops-extension-hot-reload-and-debug: a way to locally debug changes (also see this blog post).
- To debug, install Firefox and launch the webpack-dev-server with
webpack-dev-server --mode development
- Remember to point to the specific html URL that you want to debug (i.e. https://localhost:3000/dist/hub-hotreload/hub-hotreload.html)
- To debug, install Firefox and launch the webpack-dev-server with
The key changes from merging these codes are:
- used Hubs as sample extensions
- changed dependency
node-sass
tosass
- added the following
scripts
inpackage.json
"build": "npm run compile && npm run package",
"build:dev": "npm run compile:dev && npm run package:dev",
- added
--rev-version
totfx extension package
andtfx extension publish
scripts - removed sample unit testing code, please refer to samples if you want to add that back in.
- Version number should always be incremented on every update. This is done in the
vss-extension.json
file. When updating an extension, all organizations using the widgets will get the update. - Additional folders should be added in the
files
node ofvss-extension.json
. - Add different widget sizes in the
supportedSizes
node. (WARNING: If you remove an already supported size, the widget will fail to load properly.) - Adding/changing extension
scopes
is not supported. Workaround is to remove the existing extension or upload into a new name.
- Install the packaging tool
npm i -g tfx-cli
- Create a publisher profile in the Publishing Portal
- Create the extension with
tfx extension create --manifest-globs vss-extension.json --output-path packages
- Upload the generated
.vsix
file in the Publishing Portal. (For uploading new extensions, shoose Azure DevOps)
Publish and share in 1 command using tfx extension publish --manifest-globs your-manifest.json --share-with yourOrganization
According to this and the fact that this is still open, it appears that using the old SDK is still better for creating Widgets. This is probably why there aren't any widget samples.
The method implemented in widget-hello is a workaround using the example from yunsii and combined with vss-widget.tsx from bworline. There may be other better ways to do this, but this works for now.
This template was created using Windows 11 and VS Code, with the following installed
- NodeJS v18.12.0 (installed using NVM)
- webpack v5.75.0
- webpack-cli v5.0.1
- webpack-dev-server v4.11.1
- typescript
It will be a delight to see other people contribute to this project. Please feel free to contribute by forking and submitting a pull request.