load-flit-plugins

Load multiple flit plugins using globbing patterns, inspired from load-grunt-tasks.

load-flit-plugins

Load multiple flit plugins using globbing patterns

Usually you would have to load each task one by one, which is unnecessarily cumbersome.

This module will read the dependencies/devDependencies/peerDependencies in your package.json and load flit plugins that match the provided patterns.

flit.loadNpmPlugins('flit-plugin-flightplan');
flit.loadNpmPlugins('flit-xxx');
require('load-flit-plugins')(flit);
$ npm install --save-dev load-flit-plugins
// flitfile.js 
module.exports = function (flit) {
    // load all flit plugins matching the `flit-*` pattern 
    require('load-flit-plugins')(flit);
 
    flit.init({});
    flit.task('default', []);
}
require('load-flit-plugins')(flit);

Equivalent to:

require('load-flit-plugins')(flit, {pattern: 'flit-*'});
require('load-flit-plugins')(flit, {pattern: 'flit-contrib-*'});
require('load-flit-plugins')(flit, {pattern: ['flit-contrib-*', 'flit-xxx']});

You can exclude plugins using the negate ! globbing pattern:

require('load-flit-plugins')(flit, {pattern: ['flit-contrib-*', '!flit-contrib-xxx']});
require('load-flit-plugins')(flit, {config: '../package'});
require('load-flit-plugins')(flit, {scope: 'devDependencies'});
require('load-flit-plugins')(flit, {scope: ['devDependencies', 'dependencies']});
require('load-flit-plugins')(flit, {
    pattern: 'flit-contrib-*',
    config: '../package.json',
    scope: 'devDependencies'
});

Type: String, Array
Default: 'flit-*' (globbing pattern)

Type: String, Object
Default: Path to nearest package.json

Type: String, Array
Default: ['dependencies', 'devDependencies', 'peerDependencies']

MIT