1.0.5 • Published 9 years ago

keystone-dpac-plugins v1.0.5

Weekly downloads
2
License
GPL v3
Repository
github
Last release
9 years ago

NPM version Build Status Dependency Status

Finds and prepares d-pac plugins for use in KeystoneJS

Installation

npm install --save keystone-dpac-plugins

Usage

// before `keystone.import( "models" );`
// (1) setup
var plugins = require("keystone-dpac-plugins");
plugins.register();

// in your models
// (2) plugin selection
var plugins = require("keystone-dpac-plugins");

MyModel.add({
    someField : {
        type    : Types.Select,
        options : plugins.list( "judge" )
    }
});
  1. This will parse your project's package.json and iterate over the dependencies, if it encounters a d-pac plugin module it will read out the relevant data and store it.
  2. It returns a list with usable plugins (of type "judge" in the above example), readily consumable by a keystone Select field.

Note: The plugin modules have NOT been required at this point and do not take up memory. The actual require'ing is left up to you.

Example

See comparative-selection plugin for an example of a keystone/d-pac plugin.

License

GPL v3 © d-pac