GithubHelp home page GithubHelp logo

auto-nvm's Introduction

auto-nvm

Automatically run the right version of Node and NPM for each project.

Just an idea - file an issue for discussion if you think this is interesting!

Background

Meteor does version management for you, and automatically installs/runs the right versions of everything based on the .meteor/release file that exists in every Meteor project. As a result, you can basically always just git clone a Meteor project, and type meteor in the root directory to run it, without worrying about versions of Meteor, Node, NPM, etc.

I'd like to have the same experience for Node - it would be great to just download any project, run one command, and be sure that it's going to run the way the author intended. Many projects now need to document in the README which versions of Node they expect, but there's already a field for that in package.json - the engines field!

Could we use this field to just run the right version of Node and NPM based on the project we're in?

Desired UX

git clone https://github.com/webpack/react-starter
auto-nvm npm install
auto-nvm npm start

This should first install the versions of Node and NPM recommended by the project's package.json file, and then run the right commands.

auto-nvm node and auto-nvm npm should be reasonable things to alias to node and npm respectively; in the ideal universe where each project specifies its node and npm versions correctly, you should never have to manually decide which version to run again!

Creating a new project

When using auto-nvm npm init, the resulting package.json should acquire an engines field which specifies the newest stable versions of Node and NPM by default.

Error handling

There are certain conditions where auto-nvm will encounter issues:

  1. engines is not specified in package.json - it should attempt to fall back to NVM's default versions for the command. You should be able to use nvm use as usual.
  2. engines is specified, but not in a valid format. In this case it might make sense to print a warning.
  3. engines is specified, but is not a version that NVM can install. In this case it might make sense to print a warning.

auto-nvm's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

auto-nvm's Issues

Meteor integration

It would be nice if this could be in Meteor imho. For example:

package.json file in .meteor/

And interacting with NPM with meteor npm *. Perhaps even automagically with just meteor.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.