0.0.5 • Published 8 years ago

warp.firstclass v0.0.5

Weekly downloads
2
License
ISC
Repository
-
Last release
8 years ago

Overview

Makes your node modules first class, so:

// no more:
require('../../../awesomeModule') 
// just:
require('awesomeModule').

How

It creates symlinks in ./node_modules for all the root directories in provided 'dirToLink' directory. Works on Mac, Linux and Windows.

Usage

Say you have project structure like

  • server.js
  • package.json
  • backend
    • models
    • config
    • controllers

This would allow to require any modules in './backend' directory directly.

npm install warp.firstclass
warp.firstclass './backend/'
    

Now if you somewhere deep below in you controllers, you can still do:

var db = require('models'); //instead of require('../../../models')

Execute automatically with npm install

add the following to package.json

scripts": { "preinstall": "warp.firstclass './backend/'"}

Troubleshooting

  1. You get error " -bash: warp.firstclass: command not found "
node node_modules/warp.firstclass/bin/warp.firstclass.js './backend/'
  1. If you get permissions errors when running npm install you might need to run it as a root user (admin). so:

Linux/Mac

sudo npm install --unsafe-perm

The --unsafe-perm option insures that it actually gets runned as root, because when you run npm install as a root NPM tries to downgrade its privileges.

Windows

  • open terminal as administrator
  • run
0.0.5

8 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago