forked from tsai/budibase
8 changed files with 3 additions and 183 deletions
@ -1,20 +0,0 @@ |
|||
// const { readJSON, readdir } = require("fs-extra")
|
|||
// const { join } = require("../centralPath")
|
|||
|
|||
// module.exports = async appPath => {
|
|||
// const pages = {}
|
|||
|
|||
// const pageFolders = await readdir(join(appPath, "pages"))
|
|||
// for (let pageFolder of pageFolders) {
|
|||
// try {
|
|||
// pages[pageFolder] = await readJSON(
|
|||
// join(appPath, "pages", pageFolder, "page.json")
|
|||
// )
|
|||
// pages[pageFolder].name = pageFolder
|
|||
// } catch (_) {
|
|||
// // ignore error
|
|||
// }
|
|||
// }
|
|||
|
|||
// return pages
|
|||
// }
|
|||
@ -1,80 +0,0 @@ |
|||
// const { appPackageFolder } = require("../createAppPackage")
|
|||
// const {
|
|||
// readJSON,
|
|||
// writeJSON,
|
|||
// readdir,
|
|||
// ensureDir,
|
|||
// rename,
|
|||
// unlink,
|
|||
// rmdir,
|
|||
// } = require("fs-extra")
|
|||
// const { join } = require("../centralPath")
|
|||
// const { dirname } = require("path")
|
|||
|
|||
const compileStaticAssetsForPage = require("./compileStaticAssetsForPage") |
|||
// const getPages = require("./getPages")
|
|||
// const listScreens = require("./listScreens")
|
|||
// const { budibaseAppsDir } = require("../budibaseDir")
|
|||
// const { budibaseAppsDir } = require("../budibaseDir")
|
|||
|
|||
module.exports.compileStaticAssetsForPage = compileStaticAssetsForPage |
|||
// module.exports.listScreens = listScreens
|
|||
|
|||
// const getAppDefinition = async appPath =>
|
|||
// await readJSON(`${appPath}/appDefinition.json`)
|
|||
|
|||
// module.exports.getPackageForBuilder = async application => {
|
|||
// const appPath = resolve(budibaseAppsDir(), application._id)
|
|||
|
|||
// const pages = await getPages(appPath)
|
|||
|
|||
// return {
|
|||
// pages,
|
|||
// application,
|
|||
// }
|
|||
// }
|
|||
|
|||
// const screenPath = (appPath, pageName, name) =>
|
|||
// join(appPath, "pages", pageName, "screens", name + ".json")
|
|||
|
|||
// module.exports.saveScreen = async (appId, pagename, screen) => {
|
|||
// const appPath = join(budibaseAppsDir(), appId)
|
|||
// const compPath = screenPath(appPath, pagename, screen.props._id)
|
|||
|
|||
// await ensureDir(dirname(compPath))
|
|||
// if (screen._css) {
|
|||
// delete screen._css
|
|||
// }
|
|||
|
|||
// await writeJSON(compPath, screen, {
|
|||
// encoding: "utf8",
|
|||
// flag: "w",
|
|||
// spaces: 2,
|
|||
// })
|
|||
// return screen
|
|||
// }
|
|||
|
|||
// module.exports.deleteScreen = async (config, appId, pagename, name) => {
|
|||
// const appPath = join(budibaseAppsDir(), appId)
|
|||
// const componentFile = screenPath(appPath, pagename, name)
|
|||
// await unlink(componentFile)
|
|||
|
|||
// const dir = dirname(componentFile)
|
|||
// if ((await readdir(dir)).length === 0) {
|
|||
// await rmdir(dir)
|
|||
// }
|
|||
// }
|
|||
|
|||
// module.exports.savePage = async (appId, pagename, page) => {
|
|||
// const appPath = join(budibaseAppsDir(), appId)
|
|||
// const pageDir = join(appPath, "pages", pagename)
|
|||
|
|||
// await ensureDir(pageDir)
|
|||
// await writeJSON(join(pageDir, "page.json"), page, {
|
|||
// encoding: "utf8",
|
|||
// flag: "w",
|
|||
// space: 2,
|
|||
// })
|
|||
// const appDefinition = await getAppDefinition(appPath)
|
|||
// await compileStaticAssetsForPage(appId, appDefinition, pagename, page)
|
|||
// }
|
|||
@ -1,48 +0,0 @@ |
|||
const { readJSON, readdir, stat } = require("fs-extra") |
|||
const { join } = require("../centralPath") |
|||
const { keyBy } = require("lodash/fp") |
|||
const { budibaseAppsDir } = require("../budibaseDir") |
|||
|
|||
// module.exports = async (appId, pagename) => {
|
|||
// const appPath = join(budibaseAppsDir(), appId)
|
|||
// return keyBy("name")(await fetchscreens(appPath, pagename))
|
|||
// }
|
|||
|
|||
// const fetchscreens = async (appPath, pagename, relativePath = "") => {
|
|||
// const currentDir = join(appPath, "pages", pagename, "screens", relativePath)
|
|||
|
|||
// const contents = await readdir(currentDir)
|
|||
|
|||
// const screens = []
|
|||
|
|||
// for (let item of contents) {
|
|||
// const itemRelativePath = join(relativePath, item)
|
|||
// const itemFullPath = join(currentDir, item)
|
|||
// const stats = await stat(itemFullPath)
|
|||
|
|||
// if (stats.isFile()) {
|
|||
// if (!item.endsWith(".json")) continue
|
|||
|
|||
// const component = await readJSON(itemFullPath)
|
|||
|
|||
// component.name = itemRelativePath
|
|||
// .substring(0, itemRelativePath.length - 5)
|
|||
// .replace(/\\/g, "/")
|
|||
|
|||
// component.props = component.props || {}
|
|||
|
|||
// screens.push(component)
|
|||
// } else {
|
|||
// const childComponents = await fetchscreens(
|
|||
// appPath,
|
|||
// join(relativePath, item)
|
|||
// )
|
|||
|
|||
// for (let c of childComponents) {
|
|||
// screens.push(c)
|
|||
// }
|
|||
// }
|
|||
// }
|
|||
|
|||
// return screens
|
|||
// }
|
|||
Loading…
Reference in new issue