Description
Is your feature request related to a problem? Please describe.
Currently, vsce hardcodes the use of npm for running prepublish scripts (npm run vscode:prepublish
). This causes issues when using alternative package managers like Bun, as the command fails with "npm: command not found" even when the project is properly configured to use Bun.
Describe the solution you'd like
I propose adding support for different package managers, specifically Bun, in the following ways:
- Auto-detect the package manager being used in the project (by checking for bun.lockb, package-lock.json, yarn.lock, etc.)
- Add a configuration option to explicitly specify which package manager to use (e.g., --package-manager=bun)
- Use the detected/specified package manager when running scripts instead of hardcoding npm
Describe alternatives you've considered
Current workarounds include:
- Installing npm alongside Bun (not ideal, adds unnecessary dependencies)
- Using the --no-dependencies flag (doesn't work as the npm command is still hardcoded)
Additional context
Bun is gaining popularity as a fast, all-in-one JavaScript runtime and package manager. Supporting it would improve the developer experience for teams using Bun in their VS Code extension projects.
Example of a project using Bun:
json
{
"scripts": {
"vscode:prepublish": "bun run package",
"package": "bun run build:webview && bun run check-types && bun run lint"
}
}
Environment:
- vsce version: 2.15.0
- OS: macOS
- Package Manager: Bun 1.1.42