
Product
Rust Support in Socket Is Now Generally Available
Socket’s Rust and Cargo support is now generally available, providing dependency analysis and supply chain visibility for Rust projects.
base-resolver
Advanced tools
'base-methods' plugin for resolving and loading globally installed npm modules.
'base-methods' plugin for resolving and loading globally installed npm modules.
Install with npm
$ npm i base-resolver --save
var resolver = require('base-resolver');
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 = require('base-resolver');
var Generate = require('base-methods');
// 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.use(function(app) {
app.generators = {};
app.define('register', function(key, config) {
this.generators[key] = config;
return this;
});
});
// register `resolver` as a global plugin
Generate.use(resolver('generate'));
Step 2
Intantiate the custom application we just created, and search for generators!
var generate = new Generate();
// setup a listener that will register generators (
// `config`s) as they're emitted
generate.on('config', function(config) {
console.log('registered:', config.alias);
generate.register(config.alias, config);
});
// find configs!
generate
.resolve('generate-*/generator.js', {
cwd: require('global-modules')
});
.resolve('generate-*/generator.js', {
cwd: process.cwd()
});
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.on('config', function(config) {
// do stuff with "config"
});
resolver
.resolve('foo', {pattern: 'generator.js', cwd: 'foo'})
.resolve('bar', {pattern: 'generator.js', cwd: 'bar'})
.resolve('baz', {pattern: 'generator.js', cwd: 'baz'})
Install dev dependencies:
$ npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Jon Schlinkert
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb on December 14, 2015.
FAQs
'base-methods' plugin for resolving and loading globally installed npm modules.
The npm package base-resolver receives a total of 3 weekly downloads. As such, base-resolver popularity was classified as not popular.
We found that base-resolver demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket’s Rust and Cargo support is now generally available, providing dependency analysis and supply chain visibility for Rust projects.

Security News
Chrome 144 introduces the Temporal API, a modern approach to date and time handling designed to fix long-standing issues with JavaScript’s Date object.

Research
Five coordinated Chrome extensions enable session hijacking and block security controls across enterprise HR and ERP platforms.