SuperAPI AI Directory

vscode-extension-publishing

Deployment & operations

View repository

Updated 10-16 06:49

About this skill

VSCode Extension Publishing

Task Objectives

  • This Skill is used to: publish VSCode extensions to the official Marketplace
  • Capabilities include: vsce tool usage, publishing process, platform-specific extensions, pre-release version management
  • Trigger condition: when the user needs to publish or distribute a VSCode extension

Prerequisites

  • Environment requirements: Node.js 18+, npm
  • Account requirements: Azure DevOps account, Marketplace publisher account
  • Tool installation:
    npm install -g @vscode/vsce
    

Operation Steps

Standard Process

1. Prepare extension metadata

Ensure package.json contains:

{
  "name": "my-extension",
  "displayName": "My Extension",
  "publisher": "my-publisher-id",
  "version": "0.0.1",
  "engines": {
    "vscode": "^1.74.0"
  },
  "description": "Extension description"
}

2. Create a Personal Access Token

  1. Go to Azure DevOps → User settings → Personal access tokens
  2. Create a new Token, set Organization to "All accessible organizations"
  3. Select Marketplace > Manage for scopes

3. Create a Publisher

  1. Go to https://marketplace.visualstudio.com/manage
  2. Sign in with a Microsoft account
  3. Create a Publisher, fill in the ID and Name
  4. Verify using vsce:
    vsce login <publisher-id>
    

4. Package the extension

# 打包为 .vsix 文件
vsce package

# 打包并指定版本
vsce package --pre-release

5. Publish the extension

# 发布到 Marketplace
vsce publish

# 指定版本号发布
vsce publish minor  # 1.0.0 -> 1.1.0
vsce publish 2.0.0  # 指定具体版本

Optional Branches

When a pre-release version needs to be published

vsce package --pre-release
vsce publish --pre-release

When a platform-specific extension is needed

# 为特定平台打包
vsce package --target win32-x64
vsce package --target linux-x64
vsce package --target darwin-arm64

# 发布所有平台
vsce publish --target win32-x64 win32-arm64 linux-x64

When automated publishing is needed

Add a script in package.json:

{
  "scripts": {
    "vscode:prepublish": "npm run compile"
  }
}

Resource Index

Domain References

  • references/vsce-cli.md

    • When to read: when you need to understand detailed vsce commands
    • Content: all vsce subcommands, options, usage
  • references/publisher-setup.md

    • When to read: when you need to set up a publisher account
    • Content: Publisher creation, PAT configuration, account verification
  • references/platform-extensions.md

    • When to read: when you need to publish a platform-specific extension
    • Content: platform support, VSIX build, multi-platform publishing

Notes

Publishing Restrictions

  • Extension names must be globally unique
  • SVG images need to be converted to PNG/JPG
  • Untrusted SVG badges are prohibited

Version Management

  • Follow the SemVer specification
  • Pre-release versions use odd patch numbers (e.g., 1.0.1, 1.0.3)
  • Release versions use even patch numbers (e.g., 1.0.0, 1.0.2)

Marketplace Display

  • Add a README.md description
  • Include CHANGELOG.md
  • Set a meaningful icon (128x128 PNG)