VSCode-Yarn: VSCode extensions to manage yarn commands.
You can install this awesome extension through the VSCode-Yarn.
Launch Quick Open
Paste the following command and press Enter:
ext install gamunu.vscode-yarnPackaged VSIX Extension ↑
Download the latest .vsix release file from the GitHub repository and install it from the command line
code --install-extension vscode-yarn-*.*.*.vsixor from within VS Code by launching Quick Open and running the Install from VSIX... command.
GitHub Repository Clone ↑
Change to your .vscode/extensions VS Code extensions directory.
Depending on your platform it is located in the following folders:
Clone the VSCode Yarn repository as gamunu.vscode-yarn:
git clone git@github.com:gamunu/vscode-yarn.git gamunu.vscode-yarnyarn init- Initialize a new yarn packageyarn install- Install all dependencies for a projectyarn add- Add a package to use in your current packageyarn add --dev- Add a package to the "devDependencies"yarn remove <pkg>- Remove a packageyarn start- Run the "start" script defined in package.jsonyarn test- Run the "test" script defined in package.jsonyarn build- Run the "build" script defined in package.jsonyarn publish [tag]- Publish a package to npm registry with optional tagyarn run <script>- Run a defined package scriptSearch Packages- Search npm registry for packages with interactive installationManage Registries- Add/remove custom npm registries for package search
Not happy with the available commands? No problem, raw command is also available. Enter any yarn command you want.
Yarn commands are available in the package.json file's explorer context menu for quick access.
The extension provides a dedicated sidebar in VS Code's activity bar for comprehensive yarn management:
The Search Packages view allows you to:
- Search for npm packages: Enter a search term to find packages in the npm registry
- View search results directly: See package names, descriptions, and versions
- Install with one click: Install as regular or dev dependency with convenient buttons
- Rate limit protection: Built-in cooldown system to avoid npm registry rate limits
To search for packages:
- Click the Search icon in the sidebar title
- Enter your search term
- Press Enter to see results
- Use the inline buttons to install packages
The Dependencies view provides:
- Visual organization: Dependencies and DevDependencies in separate collapsible sections
- Version information: See installed versions at a glance
- Quick uninstall: Remove packages with one click
- Auto-refresh: Automatically updates when dependencies change
This view makes it easy to:
- Monitor what packages are installed in your project
- Quickly remove unnecessary dependencies
- Distinguish between regular and development dependencies
Support for Macbook Pro Touch Bar. Following yarn commands are available:
- yarn install
- yarn start
- yarn test
- yarn build
You can also run the last executed script by typing yarn run last....
You can terminate a script with the terminate command. It uses the tree-kill module that you can find on yarn.
It has different behaviors on Unix or Windows.
The extension fully supports multi-root workspaces:
- Choose which package.json to work with when multiple are available
- Remember your selection for subsequent operations
- Switch between different package.json files easily
- If a package.json is opened as an active editor/focused tab yarn will be invoked on it.
- If the package.json is explicitly defined in the configuration yarn will invoke on it.
- If above scenarios fail to satisfy. The extension will fallback to package.json in project root folder.
The extension offers an enhanced package search experience:
There are multiple ways to search for packages:
-
Via Command Palette:
- Open the command palette (Ctrl+Shift+P or Cmd+Shift+P on macOS)
- Type "Yarn: Search Packages"
- Enter your search term
- Select a package to install
-
Via Yarn Sidebar:
- Click the Yarn icon in the activity bar
- Click the search icon in the sidebar title bar
- Enter your search term
- Use the inline buttons to install packages
-
With Quick Pick:
- When searching, you can choose to install as regular or dev dependency
- The quick pick shows package descriptions and versions
yarn.runInTerminalDefines whether the command is run in a terminal window or whether the output form the command is shown in theOutputwindow. The default is to show the output in the output window.yarn.dontHideOutputOnSuccessKeep the output panel visible when yarn execution is successful. No effect with runInTerminal. The default is to keep output window open.yarn.binCustom yarn bin name, the default isyarn.yarn.packageJsonDefault package json path. relative to current project root.yarn.enableTouchbarEnable TouchBar support in MacOSX. TouchBar support includes:- yarn install
- yarn run build
- yarn run test
- yarn run start
{
"yarn.runInTerminal": false,
"yarn.dontHideOutputOnSuccess": false,
"yarn.packageJson": "src/package.json"
}The extension defines a chording keyboard shortcut for the R key. As a consequence an existing keybinding for R is not executed immediately. If this is not desired, then please bind another key for these commands, see the customization documentation.
| Shortcut (Windows/Linux) | Shortcut (macOS) | Command |
|---|---|---|
Ctrl+R Shift+R |
Cmd+R Shift+R |
Run Script |
Ctrl+R R |
Cmd+R R |
Run Last Script |
Ctrl+R Shift+X |
Cmd+R Shift+X |
Terminate Script |
Ctrl+R T |
Cmd+R T |
Run Test |
Report a bug or a suggestion by posting an issue on the GitHub repository.
vscode-yarn incorporates code modified from fknop vscode-npm.