1
0
Fork 0
mirror of synced 2024-07-04 14:01:27 +12:00
budibase/packages/server/utilities/builder/saveBackend.js
Michael Shanks c3fa212b31
Lots of poking around to get apps to run, plux fixing tests (#92)
ixing broken tests on client
typo in buildPage.js
fixing some server tests
local datastore uses fs-extra remove, not rmdir
client - loadBudibase - no longer destructuring arg
updated publishdev script for client (reads apps)
prettier fix
some little bug fixes
bugfix - set screens to empty array when falsy
typo in template page.json
replaced "Shard Factor" for "Estimated Count"
2020-02-12 12:45:24 +00:00

29 lines
908 B
JavaScript

const getPages = require("./getPages")
const { appPackageFolder } = require("../createAppPackage")
const { writeJSON, writeFile } = require("fs-extra")
const { join } = require("path")
const publicPath = require("./publicPath")
module.exports = async (config, appname, appDefinition, accessLevels) => {
const appPath = appPackageFolder(config, appname)
await writeJSON(`${appPath}/appDefinition.json`, appDefinition, {
spaces: 2,
})
await writeJSON(`${appPath}/access_levels.json`, accessLevels, {
spaces: 2,
})
const pages = await getPages(appPath)
for (let pageName in pages) {
const pagePublicPath = publicPath(appPath, pageName)
const filename = join(pagePublicPath, "clientBackendDefinition.js")
const appDefString = JSON.stringify(appDefinition)
await writeFile(
filename,
`window['##BUDIBASE_BACKEND_DEFINITION##'] = ${appDefString};`
)
}
}