2019-06-25 23:48:22 +02:00
|
|
|
const { join } = require("path");
|
2019-06-28 23:59:27 +02:00
|
|
|
const constructHierarchy = require("./constructHierarchy");
|
|
|
|
const { common } = require("budibase-core");
|
2019-06-25 23:48:22 +02:00
|
|
|
const createAppPackage = (appPath) => ({
|
|
|
|
appDefinition: require(join(appPath, "appDefinition.json")),
|
2019-06-28 23:59:27 +02:00
|
|
|
behaviourSources: require(join(appPath, "plugins.js")),
|
2019-06-25 23:48:22 +02:00
|
|
|
appPath
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports.masterAppPackage = (config) => {
|
|
|
|
const standardPackage = createAppPackage("../appPackages/master");
|
|
|
|
|
|
|
|
const customizeMaster = config && config.customizeMaster
|
|
|
|
? config.customizeMaster
|
|
|
|
: a => a;
|
|
|
|
|
2019-06-28 23:59:27 +02:00
|
|
|
const appDefinition = common.$(standardPackage.appDefinition, [
|
|
|
|
customizeMaster,
|
|
|
|
constructHierarchy
|
|
|
|
]);
|
|
|
|
|
|
|
|
const plugins = require("../appPackages/master/plugins.js")
|
|
|
|
(config);
|
2019-06-25 23:48:22 +02:00
|
|
|
|
|
|
|
return ({
|
|
|
|
appDefinition,
|
2019-06-28 23:59:27 +02:00
|
|
|
behaviourSources: config && config.extraMasterPlugins
|
|
|
|
? {...plugins, ...config.extraMasterPlugins}
|
|
|
|
: plugins,
|
2019-06-25 23:48:22 +02:00
|
|
|
appPath: standardPackage.appPath
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-06-28 23:59:27 +02:00
|
|
|
module.exports.applictionVersionPackage = (appname, versionId) => {
|
|
|
|
const pkg = createAppPackage(`../runtimePackages/${appname}/${versionId}`);
|
|
|
|
pkg.appDefinition = constructHierarchy(appDefinition);
|
|
|
|
return pkg;
|
|
|
|
}
|