Skip to content

neemzy/runn

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

runn

Run n auto, but only if you need to. Read more about it here!

How it works

Running this script will try to read a Node.js version constraint from the closest package.json file in the tree, match the current version against it, and run n auto if they do not match.

It needs to receive a path to a file containing all available Node.js versions as an argument; this file can easily be generated with n ls-remote --all.

This is meant to be ran upon cd to switch automatically while keeping it fast.

Setup

$ npm i

In .zshrc (for example):

autoload -U add-zsh-hook
n ls-remote --all > path/to/.node-versions

switch-node-version() {
  node path/to/runn path/to/.node-versions
}

add-zsh-hook chpwd switch-node-version
switch-node-version

About

Run n auto, but only if you need to

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published