Bookmark NPM Scripts Extension
A VSCode and Cursor extension that allows you to bookmark your favorite npm scripts and run them quickly.
Features
- ✅ Bookmark npm scripts from your project
- ✅ Customize names for bookmarked scripts
- ✅ Icon in Status Bar (bottom right) for quick access
- ✅ Dropdown menu to view and run bookmarked scripts
- ✅ Store bookmark settings per workspace
- ✅ Edit bookmark names individually
Usage
1. Installation and Setup
# Install dependencies
npm install
# Compile the project
npm run compile
To test the extension:
- Open the project folder in VSCode/Cursor
- Press
F5 to open a new Extension Host window
- In the new window, open a project with
package.json
2. Bookmarking Scripts
Method 1: From Status Bar
- Click on the
$(play) icon in the Status Bar (bottom right)
- If no bookmarks exist, select "Manage Bookmarks"
Method 2: From Command Palette
- Press
Ctrl+Shift+P (or Cmd+Shift+P on Mac)
- Type and select
Bookmark NPM Scripts: Manage Bookmarks
- Select the scripts you want to bookmark (you can select multiple)
- Optionally, set custom names for them
3. Running Scripts
- Click on the
$(play) icon in the Status Bar
- Select the desired script from the dropdown list
- The script will run in a new terminal named
npm run [script-name]
Note: In the dropdown list, you can see the "Manage Bookmarks..." option to manage your bookmarks.
4. Editing Bookmark Names
- From Command Palette:
Bookmark NPM Scripts: Edit Bookmark Name
- Or select "Manage Bookmarks..." from the dropdown list
5. Setting Up Keyboard Shortcuts
You can set up a keyboard shortcut to quickly open the bookmarked scripts list:
Method 1: Using Keyboard Shortcuts UI
- Press
Ctrl+K Ctrl+S (or Cmd+K Cmd+S on Mac) to open Keyboard Shortcuts
- Search for
Bookmark NPM Scripts: Run Bookmarked Script
- Click the
+ icon next to the command
- Press your desired key combination (e.g.,
Ctrl+Shift+R or Cmd+Shift+R)
- Press
Enter to confirm
Method 2: Using keybindings.json
- Press
Ctrl+Shift+P (or Cmd+Shift+P on Mac)
- Type
Preferences: Open Keyboard Shortcuts (JSON)
- Add the following entry:
{
"key": "ctrl+shift+r",
"command": "bookmarkNpmScripts.openBookmarks",
"when": "editorTextFocus || terminalFocus"
}
Available Commands:
bookmarkNpmScripts.openBookmarks - Open bookmarked scripts list
bookmarkNpmScripts.manageBookmarks - Manage bookmarks
bookmarkNpmScripts.editBookmarkName - Edit bookmark names
Building the Extension
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Build .vsix file for distribution
npm install -g vsce
vsce package
Development
# Watch mode for development
npm run watch
Project Structure
.
├── src/
│ └── extension.ts # Main extension code
├── package.json # Extension manifest
├── tsconfig.json # TypeScript configuration
└── README.md # This file
Requirements
- Node.js
- npm
- VSCode or Cursor (version 1.74.0 or higher)
License
MIT