Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

HenryNguyen5/vsc-nvm

Repository files navigation

README

Install here

Simplify your node versioning workflow with nvm and this extension.

Features

This extension simplifies nvm workflow by:

  • Automatically running nvm use on each terminal opened when an .nvmrc file exists in your workspace. Inspired by vscode-nvm
  • Providing a command input hook to choose a version of node to run tasks against

Requirements

  • To be able to pick different node versions, you must have nvm installed
  • To have nvm use executed on terminal startup, you must have nvm installed along with a .nvmrc file in your workspace

Extension Settings

Running a task with a choosable node version

// launch.json for running version picker with defaults
{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Jest Current File",
      "program": "${workspaceFolder}/node_modules/.bin/jest",
      "args": ["--detectOpenHandles", "${relativeFile}"],
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen",
      "runtimeExecutable": "${env:HOME}/.nvm/versions/node/${input:pickVersion}/bin/node"
    }
  ],
  "inputs": [
    {
      "id": "pickVersion",
      "type": "command",
      "command": "extension.node-version"
    }
  ]
}

Running a task with a choosable node version in a custom nvm directory

// launch.json for running version picker with specified nvm dir
{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Jest Current File",
      "program": "${workspaceFolder}/node_modules/.bin/jest",
      "args": ["--detectOpenHandles", "${relativeFile}"],
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen",
      "runtimeExecutable": "${env:HOME}/.nvm/versions/node/${input:pickVersion}/bin/node"
    }
  ],
  "inputs": [
    {
      "id": "pickVersion",
      "type": "command",
      "command": "extension.node-version",
      "args": {
        "nvmDir": "/my/home/.nvm"
      }
    }
  ]
}

Releases

No releases published

Packages

No packages published