Giter Club home page Giter Club logo

npmfs's Introduction

npmfs

A filesystem that looks like it holds all the node_modules and executables of every npm package

install

First you need to install FUSE. See this link for more info.

npm install -g npmfs

temporarily mount npmfs

node_modules

Mount a node_modules folder that (seems to) contain all packages in npm

npmfs ~/node_modules

Now when in your home directory (or any subdirectory) it will seem like every npm package is locally installed.

cd
node
> typeof(require('dog'))
'object'
> typeof(require('cat'))
'function'

executables

Mount a bin folder that (seems to) contain all executables in npm

npmfs --bin ~/bin

Then in another shell

#add the bin folder to our path!
PATH=$PATH:~/bin

Now try to run an executable you don't have like blah or wow. It will automatically install and run it!

install service

First install ndm if you don't already have it.

$ npm install -g ndm

Now install npmfs as a service:

$ ndm install npmfs
[?] npmfs node_modules directory: /usr/local/npmfs/node_modules
[?] npmfs bin directory: /usr/local/npmfs/bin
...
$ ndm start npmfs

permanently add the bin folder to our path

#if on a mac
sudo sh -c "echo /usr/local/npmfs/bin > /etc/paths.d/npmfs" #mac only

#or on ubuntu (untested)
sudo sh -c "echo 'export PATH=$PATH:/usr/local/npmfs/bin' > /etc/profile.d/npmfs.sh"
sudo chmod a+x /etc/profile.d/npmfs.sh

symlink all node_modules

ln -s /usr/local/npmfs/node_modules ~/node_modules

remove service

ndm remove npmfs

remove the added paths if they were created

#if on a mac
sudo rm /etc/paths.d/npmfs

#or on ubuntu (untested)
sudo rm /etc/profile.d/npmfs.sh

npmfs's People

Contributors

seanewest avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

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.