node package manager


'rekuire' is basically node's 'require' without the relative paths


'rekuire' is basically node's 'require' without the relative paths!

It saves you TONS of time refactoring your code, and making it easily reusable. plus, it makes you code more readable = better!

to install, type

npm install rekuire

instead of doing this:

var MyModule = require('../../../MyModule.js'); <-- yuck!

you can now do this:

var rek = require('rekuire');
var myModule = rek('MyModule');

or that:

var myCoffee = rek('');
var myJson = rek('myJson.json');
var myModule = rek('src/api/MyModule');

  • Fixed a bug causing the scanner to fail, if the fetched file was named like a default method like 'toString'
  • Removed deprecated code - rek().path(...) will not work anymore, instead use rek.path(...).
  • Fixed an issue of causing rekuire not to scan the folders correctly when node_modules was a symlink.
  • Added .npmignore to the package - so you won't get the test files when adding dependencies
  • Now you are able to describe ignored folders in your project inside the package.json file!

when 'rekuire' is first loaded into the project, it scans the source files locations, and stores them. so when you need them they are right there ready to use! no relative paths are needed! yeahy!

in order to tell the scanner, not to scan specific folders you can configure rekuire not to scan folders right from the package.json file:

"rekuire": {
"ignore": ["out", "dist/target", "client/app"]

or you can set it up by code:

var mypath = rek.ignore('out', 'target', 'static/js');
// you should only do it once in your code

if you want to resolve only the file location, for example, when you want to use proxyquire.

var mypath = rek.path('MyModule');
// mypath = 'lib/classes/MyModule.js' 

for more examples, I recommend you to checkout the spec file :)

- - -
  • Added colliding files paths to Ambiguity Error
  • Fixed a bug that causes failures when scanning a package with higher os privileges (thanks Dany!)
  • Added a method to ignore folders while searching the right files (for example, the js files in the server's static folder)
  • you can now rekuire file according to the relative path of the file
  • Added support for index.js files inside a folder - can be retrieved by the folder path
  • Added support for .coffee files and .json

- - -

if you are having any problems, requests or criticism, don't hesitate to open an issue, here

- - -

To test, run: npm test