yesod-mirror/tools/vscode/README.md
Copybara 8157b39ea4
Some checks failed
CI / build (push) Failing after 12s
Project import generated by Copybara.
GitOrigin-RevId: 6370f6ea785709295b6abcf9c60717cacf3ac432
2026-01-20 21:26:21 +00:00

1.3 KiB

VSCode Extension Build Tools

This directory contains Bazel rules and utilities for packaging VSCode extensions.

Contents

  • defs.bzl: Provides the vsce_extension rule, which handles the staging and packaging of VSCode extensions using vsce.
  • vsce_wrapper.js: A Node.js wrapper for @vscode/vsce that handles runfiles resolution and polyfills necessary for running within a Bazel sandbox.
  • BUILD.bazel: Defines the shared vsce_tool binary.

Usage

Load the vsce_extension rule in your extension's BUILD.bazel file:

load("//tools/vscode:defs.bzl", "vsce_extension")

vsce_extension(
    name = "my_extension_vsix",
    srcs = [
        "package.json",
        "README.md",
        # ... other config files
    ],
    extension_js = [":my_extension_bundle"], # Usually an esbuild target
    out = "my-extension-0.0.1.vsix",
)

Why this exists

Packaging VSCode extensions via vsce typically requires a standard node_modules structure and often tries to run prepublish scripts. This tooling provides a way to:

  1. Package extensions without a local node_modules.
  2. Bypass mandatory npm dependency checks and prepublish scripts by staging files manually.
  3. Ensure the environment is correctly set up for vsce to run inside a hermetic Bazel sandbox.