tidy up
This commit is contained in:
parent
3519d0f210
commit
5774f99fee
|
@ -1,5 +1,5 @@
|
||||||
const Koa = require("koa")
|
const Koa = require("koa")
|
||||||
const router = require("./middleware/routes/builderRouter")
|
const router = require("./middleware/routers")
|
||||||
const koaBody = require("koa-body")
|
const koaBody = require("koa-body")
|
||||||
const initialiseRuntimePackages = require("./initialise/initialiseRuntimePackages")
|
const initialiseRuntimePackages = require("./initialise/initialiseRuntimePackages")
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"name": "newscreen",
|
||||||
|
"props": {
|
||||||
|
"_component": "@budibase/standard-component/div",
|
||||||
|
"className": "something else"
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -1,2 +1,2 @@
|
||||||
window['##BUDIBASE_FRONTEND_DEFINITION##'] = {"componentLibraries":[{"importPath":"/lib/customComponents/index.js","libName":"./customComponents"},{"importPath":"/lib/moreCustomComponents/index.js","libName":"./moreCustomComponents"}],"appRootPath":"","page":{"title":"Test App","favicon":"./_shared/favicon.png","stylesheets":["my-styles.css"],"componentLibraries":["./customComponents","./moreCustomComponents"],"props":{"_component":"@budibase/standard-components/container","type":"div"}},"screens":[{"name":"screen1","description":"","props":{"_component":"@budibase/standard-components/container","className":"","type":"div"},"_css":"/css/d121e1ecc6cf44f433213222e9ff5d40.css"},{"name":"screen2","description":"","props":{"_component":"@budibase/standard-components/container","className":"","type":"div"},"_css":"/css/7b7c05b78e05c06eb8d69475caadfea3.css"}]};
|
window['##BUDIBASE_FRONTEND_DEFINITION##'] = {"componentLibraries":[{"importPath":"/lib/node_modules/@budibase/standard-components/dist/index.js","libName":"@budibase/standard-components"},{"importPath":"/lib/customComponents/index.js","libName":"./customComponents"},{"importPath":"/lib/moreCustomComponents/index.js","libName":"./moreCustomComponents"}],"appRootPath":"","page":{"title":"Test App","favicon":"./_shared/favicon.png","stylesheets":["my-styles.css"],"componentLibraries":["@budibase/standard-components","./customComponents","./moreCustomComponents"],"props":{"_component":"@budibase/standard-components/container","type":"div"}},"screens":[{"name":"screen1","description":"","props":{"_component":"@budibase/standard-components/container","className":"","type":"div"},"_css":"/css/d121e1ecc6cf44f433213222e9ff5d40.css"},{"name":"screen2","description":"","props":{"_component":"@budibase/standard-components/container","className":"","type":"div"},"_css":"/css/7b7c05b78e05c06eb8d69475caadfea3.css"}]};
|
||||||
window['##BUDIBASE_FRONTEND_FUNCTIONS##'] = {'1234':() => 'test return'}
|
window['##BUDIBASE_FRONTEND_FUNCTIONS##'] = {'1234':() => 'test return'}
|
|
@ -6,14 +6,14 @@ const send = require("koa-send")
|
||||||
const routeHandlers = require("./routeHandlers")
|
const routeHandlers = require("./routeHandlers")
|
||||||
const {
|
const {
|
||||||
componentLibraryInfo,
|
componentLibraryInfo,
|
||||||
} = require("../../utilities/builder")
|
} = require("../utilities/builder")
|
||||||
const {
|
const {
|
||||||
componentRoutes,
|
componentRoutes,
|
||||||
appsRoutes,
|
appsRoutes,
|
||||||
pageRoutes,
|
pageRoutes,
|
||||||
userRoutes,
|
userRoutes,
|
||||||
authenticatedRoutes
|
authenticatedRoutes
|
||||||
} = require("./");
|
} = require("./routes");
|
||||||
|
|
||||||
const builderPath = resolve(__dirname, "../../builder")
|
const builderPath = resolve(__dirname, "../../builder")
|
||||||
|
|
||||||
|
@ -86,30 +86,32 @@ module.exports = (config, app) => {
|
||||||
await next()
|
await next()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.get("/_builder", async ctx => {
|
|
||||||
await send(ctx, "/index.html", { root: builderPath })
|
|
||||||
})
|
|
||||||
.get("/_builder/:appname/componentlibrary", async ctx => {
|
|
||||||
const info = await componentLibraryInfo(
|
|
||||||
ctx.config,
|
|
||||||
ctx.params.appname,
|
|
||||||
ctx.query.lib
|
|
||||||
)
|
|
||||||
await send(ctx, info.components._lib || "index.js", { root: info.libDir })
|
|
||||||
})
|
|
||||||
.get("/_builder/*", async (ctx, next) => {
|
|
||||||
const path = ctx.path.replace("/_builder", "")
|
|
||||||
|
|
||||||
const isFile = new RegExp(/(.+\..{1,5})/g).test(path)
|
router
|
||||||
|
.get("/_builder", async ctx => {
|
||||||
if (path.startsWith("/api/") || path.startsWith("/instance/")) {
|
|
||||||
await next()
|
|
||||||
} else if (isFile) {
|
|
||||||
await send(ctx, path, { root: builderPath })
|
|
||||||
} else {
|
|
||||||
await send(ctx, "/index.html", { root: builderPath })
|
await send(ctx, "/index.html", { root: builderPath })
|
||||||
}
|
})
|
||||||
})
|
.get("/_builder/:appname/componentlibrary", async ctx => {
|
||||||
|
const info = await componentLibraryInfo(
|
||||||
|
ctx.config,
|
||||||
|
ctx.params.appname,
|
||||||
|
ctx.query.lib
|
||||||
|
)
|
||||||
|
await send(ctx, info.components._lib || "index.js", { root: info.libDir })
|
||||||
|
})
|
||||||
|
.get("/_builder/*", async (ctx, next) => {
|
||||||
|
const path = ctx.path.replace("/_builder", "")
|
||||||
|
|
||||||
|
const isFile = new RegExp(/(.+\..{1,5})/g).test(path)
|
||||||
|
|
||||||
|
if (path.startsWith("/api/") || path.startsWith("/instance/")) {
|
||||||
|
await next()
|
||||||
|
} else if (isFile) {
|
||||||
|
await send(ctx, path, { root: builderPath })
|
||||||
|
} else {
|
||||||
|
await send(ctx, "/index.html", { root: builderPath })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
router.use(userRoutes.routes());
|
router.use(userRoutes.routes());
|
||||||
router.use(userRoutes.allowedMethods());
|
router.use(userRoutes.allowedMethods());
|
||||||
|
|
Loading…
Reference in New Issue