summaryrefslogtreecommitdiffstats
path: root/lib/constants/defaultPlugins.js
blob: 6d15971779d39b5accb6a8bc7127a6d40c6421e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var Immutable = require('immutable');
var PluginDependency = require('../models/pluginDependency');

var pkg = require('../../package.json');

/**
 * Create a PluginDependency from a dependency of gitbook
 * @param {String} pluginName
 * @return {PluginDependency}
 */
function createFromDependency(pluginName) {
    var npmID = PluginDependency.nameToNpmID(pluginName);
    var version = pkg.dependencies[npmID];

    return PluginDependency.create(pluginName, version);
}

/*
 * List of default plugins for all books,
 * default plugins should be installed in node dependencies of GitBook
 */
module.exports = Immutable.List([
    'highlight',
    'search',
    'lunr',
    'sharing',
    'fontsettings',
    'theme-default'
]).map(createFromDependency);