Skip to content

neemzy/runn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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