npmDepScriptRun npm scripts and review dependency health without leaving VS Code.
npmDepScript puts your Install
Or install from the command line:
Features
There is intentionally no Run all button. The editor stop control is the stop action for an individual run. The sidebar and dashboard have no separate Stop button; their Run button becomes Restart, which stops the previous run and starts it again. Requirements
The extension targets the Node.js runtime that ships with VS Code 1.95, so it keeps working on newer VS Code versions too. Getting started
ScreenshotsDashboard
Sidebar
Commands
Running scriptsIn
|
| Column | Meaning |
|---|---|
| Current | The version installed in node_modules. Shows “Not installed” if it is missing. The declared range is in the tooltip. |
| Next | The newest version allowed by your package.json range (npm’s “wanted” version). Example: ^1.2.3 → 1.5.0. |
| Latest | The version behind npm’s latest tag. |
| Health | Deprecated and/or ⚠ N badges. Clicking a badge opens the matching tab. |
The dashboard uses a table. The narrow sidebar uses stacked cards with the same labels.
Deprecated tab
- Covers direct dependencies only.
- Checks the installed version’s npm metadata for a deprecation message.
- Groups into Production and Development.
- Shows the installed version, latest version, declared range, deprecation message, and an Open on npm link.
Vulnerabilities tab
- Uses the detected package manager’s audit command and the project lockfile.
- Includes transitive installed packages, not just direct dependencies.
- Groups findings by Critical, High, Moderate, Low, and Info.
- Shows the affected package, installed version, title, affected range, fix information, and an Open advisory link.
- Supports npm, pnpm, Yarn Classic, Yarn Berry, and Bun audit output. If the package manager command is unavailable or the audit fails, the tab shows the error and a Retry button.
Health data is cached. It loads the first time the sidebar/dashboard opens and is refreshed
when you click Refresh, or when package.json or a lockfile changes. The registry lookup
uses the public npm registry; private registries are not supported yet.
Settings
| Setting | Default | What it does |
|---|---|---|
npmDepScript.packageManager |
auto |
auto, npm, pnpm, yarn, or bun. |
npmDepScript.workingDirectory |
workspaceRoot |
Run from the workspace root or the folder containing package.json. |
npmDepScript.confirmBeforeRun |
false |
Ask for confirmation before every run. |
The default working folder is the workspace root, as configured during setup. For nested
packages, switch npmDepScript.workingDirectory to packageFolder.
Development
Requirements
- Node.js
^22.18.0,^24.11.0, or>=26.0.0(required by Vite+ 1.4). - pnpm 11+.
Setup
pnpm install
pnpm build
Open this folder in VS Code and press F5. A second VS Code window (the Extension Development Host) opens with npmDepScript installed. The F5 launch configuration runs the build for you before starting.
Useful commands
| Script | What it does |
|---|---|
pnpm build |
Builds the webview, then the extension host bundle. |
pnpm build:webview |
Builds the browser-side UI with Vite (vp build). |
pnpm build:extension |
Builds the Node-side extension with Vite+ / tsdown (vp pack). |
pnpm check |
Runs Oxfmt, Oxlint, and TypeScript 7 type checking. |
pnpm check:fix |
Same as check, but applies formatting and safe fixes. |
pnpm test |
Runs the Vitest unit and component tests once. |
pnpm test:watch |
Runs Vitest in watch mode. |
pnpm vsix |
Builds and creates an installable .vsix file. |
pnpm watch:webview |
Rebuilds the webview on change (run in a second terminal). |
pnpm watch:extension |
Rebuilds the extension host bundle on change (run in a third terminal). |
Vite+ exposes the underlying tools as vp build, vp pack, vp check, and vp test.
The package scripts are thin wrappers around those commands.
Watch mode
- Webview changes: run
pnpm watch:webview, then close and reopen the dashboard (or reload the Extension Development Host) to load the new bundle. - Extension host changes: run
pnpm watch:extension, then restart the Extension Development Host (or run Developer: Reload Window). - Before committing: run
pnpm checkandpnpm test.
Packaging and publishing
Build the extension bundle first, then create a VSIX:
pnpm build
pnpm vsix
This creates npm-dep-script-1.0.0.vsix. Install it locally with:
code --install-extension ./npm-dep-script-1.0.0.vsix
To publish from the command line, authenticate once with your Marketplace publisher ID and a Personal Access Token, then publish:
pnpm exec vsce login RajatMalik
pnpm publish:marketplace
Alternatively, run pnpm exec vsce publish directly. The manifest vscode:prepublish
script builds the extension automatically before it is packaged.
The extension ID is RajatMalik.npm-dep-script; the display name is npmDepScript.
VS Code requires the manifest name to be lowercase and unscoped.
Contributing
- Repository: https://github.com/malikrajat/npmDepScript
- Issues: https://github.com/malikrajat/npmDepScript/issues
Please run pnpm check and pnpm test before opening a pull request.
Project layout
src/
extension.ts Entry point: activation, commands, file watcher
core/
packageSummary.ts Pure package.json parser (easy to unit test)
scriptEntries.ts Finds script keys and line positions in JSON
scriptRunner.ts Terminal lifecycle and run state (testable)
dependencyHealth.ts Versions, deprecation, and health counts
audit.ts npm/pnpm/Yarn/Bun audit output normalization
host/ Node-side VS Code integration
summaryService.ts Finds package.json, reads it, detects the runner
dependencyHealthService.ts Registry, installed versions, and audit adapter
editorRunButtons.ts CodeLens ▶/■ actions for package.json scripts
vscodeRunnerHost.ts VS Code terminal, dialog, and shell-integration adapter
webviewHtml.ts CSP, nonce, and webview asset URIs
webviewSession.ts Shared message handling for both surfaces
sidebarProvider.ts Activity bar webview
dashboardPanel.ts Editor tab webview
webview/ Browser-side UI (no VS Code imports)
main.ts Bootstraps the UI and talks to the host
app.ts Top-level render function
components/ Header, tabs, lists, health, status, footer
health.ts UI helpers for versions, badges, and links
styles.css Theme-aware CSS
shared/
types.ts Data shared by the host and the webview
protocol.ts Typed message guards
health.ts Severity order, keys, and empty health state
dependencyKind.ts Production/dev labels
runCommand.ts Command, tooltip, and runner-detection helpers
tests/
core/ Parser, audit, health, command, and runner tests
host/ Health-service orchestration tests
shared/ Message guard tests
webview/ DOM/component tests (jsdom)
media/ Activity bar icon and Marketplace icon
The extension host and the webview are deliberately separate:
- The host reads and validates
package.json. - It loads installed versions, registry metadata, and the package manager audit.
- It sends a plain data object over VS Code's message channel.
- The webview renders that object with DOM APIs and
textContent. - User actions are sent back as small typed messages.
- Script execution stays entirely in the extension host and uses the VS Code terminal.
This keeps VS Code APIs out of the UI code and makes both sides testable.
What comes next
The script runner and dependency-health views are ready for the next layer:
- Missing and unused dependency detection.
- Private registry and
.npmrcsupport. - A package selector for monorepos.
- Search and filtering for large dependency/script lists.
- Passing extra arguments to a script.
- Optional Run All and sidebar Stop controls, if you decide you want them later.
- VS Code integration tests with
@vscode/test-cli.
License
MIT. See the LICENSE file.


