From 596940371e4760c41dfff9056090b3c0bb1e79b6 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Fri, 6 Nov 2020 13:46:19 +0000 Subject: [PATCH] remove superfluous files --- .../builder/src/builderStore/storeUtils.js | 8 +- .../server/src/api/controllers/application.js | 2 +- packages/server/src/api/controllers/page.js | 2 +- .../builder/compileStaticAssetsForPage.js | 24 ------ .../server/src/utilities/builder/getPages.js | 20 ----- .../server/src/utilities/builder/index.js | 80 ------------------- .../src/utilities/builder/listScreens.js | 48 ----------- .../server/src/utilities/createAppPackage.js | 2 - 8 files changed, 3 insertions(+), 183 deletions(-) delete mode 100644 packages/server/src/utilities/builder/getPages.js delete mode 100644 packages/server/src/utilities/builder/index.js delete mode 100644 packages/server/src/utilities/builder/listScreens.js diff --git a/packages/builder/src/builderStore/storeUtils.js b/packages/builder/src/builderStore/storeUtils.js index 97b780de69..9c9d1ef940 100644 --- a/packages/builder/src/builderStore/storeUtils.js +++ b/packages/builder/src/builderStore/storeUtils.js @@ -1,10 +1,4 @@ -import { - makePropsSafe, - getBuiltin, -} from "components/userInterface/pagesParsing/createProps" -import api from "./api" -import { store } from "builderStore" -import { generate_screen_css } from "./generate_css" +import { getBuiltin } from "components/userInterface/pagesParsing/createProps" import { uuid } from "./uuid" import getNewComponentName from "./getNewComponentName" diff --git a/packages/server/src/api/controllers/application.js b/packages/server/src/api/controllers/application.js index 8b931d14c8..2185293352 100644 --- a/packages/server/src/api/controllers/application.js +++ b/packages/server/src/api/controllers/application.js @@ -1,5 +1,5 @@ const CouchDB = require("../../db") -const { compileStaticAssetsForPage } = require("../../utilities/builder") +const compileStaticAssetsForPage = require("../../utilities/builder/compileStaticAssetsForPage") const env = require("../../environment") const { existsSync } = require("fs-extra") const { budibaseAppsDir } = require("../../utilities/budibaseDir") diff --git a/packages/server/src/api/controllers/page.js b/packages/server/src/api/controllers/page.js index 06bd887453..4f3989ae90 100644 --- a/packages/server/src/api/controllers/page.js +++ b/packages/server/src/api/controllers/page.js @@ -1,6 +1,6 @@ const CouchDB = require("../../db/client") const { generatePageID } = require("../../db/utils") -const { compileStaticAssetsForPage } = require("../../utilities/builder") +const compileStaticAssetsForPage = require("../../utilities/builder/compileStaticAssetsForPage") exports.save = async function(ctx) { const db = new CouchDB(ctx.user.appId) diff --git a/packages/server/src/utilities/builder/compileStaticAssetsForPage.js b/packages/server/src/utilities/builder/compileStaticAssetsForPage.js index f912195b06..598f7745fb 100644 --- a/packages/server/src/utilities/builder/compileStaticAssetsForPage.js +++ b/packages/server/src/utilities/builder/compileStaticAssetsForPage.js @@ -17,12 +17,8 @@ module.exports = async (appId, pageName, pkg) => { await buildFrontendAppDefinition(appId, pageName, pkg, appPath) await copyClientLib(appPath, pageName) - - // await savePageJson(appPath, pageName, pkg) } -// const rootPath = (config, appId) => (config.useAppRootPath ? `/${appId}` : "") - const copyClientLib = async (appPath, pageName) => { const sourcepath = require.resolve("@budibase/client") const destPath = join(publicPath(appPath, pageName), "budibase-client.js") @@ -96,23 +92,3 @@ const buildFrontendAppDefinition = async (appId, pageName, pkg) => { ` ) } - -// const savePageJson = async (appPath, pageName, pkg) => { -// const pageFile = join(appPath, "pages", pageName, "page.json") - -// if (pkg.page._css) { -// delete pkg.page._css -// } - -// if (pkg.page.name) { -// delete pkg.page.name -// } - -// if (pkg.page._screens) { -// delete pkg.page._screens -// } - -// await writeJSON(pageFile, pkg.page, { -// spaces: 2, -// }) -// } diff --git a/packages/server/src/utilities/builder/getPages.js b/packages/server/src/utilities/builder/getPages.js deleted file mode 100644 index e7d4856d0a..0000000000 --- a/packages/server/src/utilities/builder/getPages.js +++ /dev/null @@ -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 -// } diff --git a/packages/server/src/utilities/builder/index.js b/packages/server/src/utilities/builder/index.js deleted file mode 100644 index 015e40244e..0000000000 --- a/packages/server/src/utilities/builder/index.js +++ /dev/null @@ -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) -// } diff --git a/packages/server/src/utilities/builder/listScreens.js b/packages/server/src/utilities/builder/listScreens.js deleted file mode 100644 index 0b6fda3ed8..0000000000 --- a/packages/server/src/utilities/builder/listScreens.js +++ /dev/null @@ -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 -// } diff --git a/packages/server/src/utilities/createAppPackage.js b/packages/server/src/utilities/createAppPackage.js index af943d260e..a62e8c96df 100644 --- a/packages/server/src/utilities/createAppPackage.js +++ b/packages/server/src/utilities/createAppPackage.js @@ -1,5 +1,3 @@ -const { resolve } = require("./centralPath") -const { cwd } = require("process") const stream = require("stream") const fetch = require("node-fetch") const tar = require("tar-fs")