'base-methods' plugin for resolving and loading globally installed npm modules.
Install
Install with npm
$ npm i base-resolver --save
Usage
var resolver = ;
Example
In two steps, the following example shows how we would use base-resolver
with a custom Generate
application that is built on top of [base-methods][].
Step 1: Setup
The following example shows how we might begin creating a basic project generator from [base-methods][]. More specifically, this shows how we might register and cache generators.
var resolver = ;var Generate = ; // register a "global" plugin, to initialize the `generators` // object, and decorate a `register` method (as an alternative // to inheriting base-methods or other more complicated approaches)Generate; // register `resolver` as a global pluginGenerate;
Step 2
Intantiate the custom application we just created, and search for generators!
var generate = ; // setup a listener that will register generators (// `config`s) as they're emittedgenerate; // find configs!generate ; ;
API
Params
name
{String}: Optionally specify a namespace for storing resolved configs.options
{Object}: Options to pass to matchedoption.patterns
{String|Array}: Glob patterns to searchoption.cwd
{String}: The starting directory to search fromreturns
{Object}
Example
resolver; resolver
Related projects
- global-modules: The directory used by npm for globally installed npm modules. | homepage
- matched: Adds array support to node-glob, sync and async. Also supports tilde expansion (user home) and… more | homepage
- npm-paths: Returns an array of unique "npm" directories based on the user's platform and environment. | homepage
- resolve-modules: Resolves local and global npm modules that match specified patterns, and returns a configuration object… more | homepage
Running tests
Install dev dependencies:
$ npm i -d && npm test
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Author
Jon Schlinkert
License
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb on December 14, 2015.