yesod-mirror/tools/vscode/README.md

36 lines
1.3 KiB
Markdown
Raw Normal View History

# 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:
```python
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.