-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
28 lines (22 loc) · 797 Bytes
/
index.js
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
"use strict";
const _ = require("lodash");
const path = require("path");
const merapi = require("merapi");
const yaml = require("js-yaml");
const fs = require("fs");
const config = yaml.safeLoad(fs.readFileSync("./service.yml", "utf8"));
config.package = require("./package");
const plugins = yaml.safeLoad(fs.readFileSync("./plugin.yml", "utf8"));
const env = process.env.PLUGIN_ENV || "platform";
const pluginConf = plugins[env];
if (pluginConf) {
if (pluginConf.include)
config.plugins = _.union(config.plugins, pluginConf.include);
if (pluginConf.exclude)
config.plugins = _.without(config.plugins, ...pluginConf.exclude);
}
module.exports = merapi({
basepath: path.resolve(__dirname, "lib"),
config: config,
delimiters: {left: "${", right: "}"}
});