1
0
Fork 0
mirror of synced 2024-07-08 07:46:10 +12:00
budibase/packages/server/utilities/builder.js
2019-07-14 07:46:36 +01:00

39 lines
1 KiB
JavaScript

const { appPackageFolder, appsFolder } = require("./createAppPackage");
const { writeFile, readFile, readdir } = require("./fsawait");
const { pipe : $ } = require("budibase-core").common;
module.exports.getPackageForBuilder = async (config, appname) => {
const appPath = appPackageFolder(config, appname);
return ({
appDefinition: JSON.parse(await readFile(
`${appPath}/appDefinition.json`,
"utf8")),
accessLevels: JSON.parse(await readFile(
`${appPath}/access_levels.json`,
"utf8"))
})
}
module.exports.savePackage = async (config, appname, pkg) => {
const appPath = appPackageFolder(config, appname);
await writeFile(
`${appPath}/appDefinition.json`,
JSON.stringify(pkg.appDefinition),
"utf8");
await writeFile(
`${appPath}/access_levels.json`,
JSON.stringify(pkg.accessLevels),
"utf8");
}
module.exports.getApps = async (config) =>
await readdir(appsFolder(config));