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"
58 lines
1.7 KiB
JavaScript
58 lines
1.7 KiB
JavaScript
const { readdir, stat, copyFile } = require("fs-extra")
|
|
const { constants } = require("fs")
|
|
const { join, basename } = require("path")
|
|
const serverConfig = require("../../server/config")()
|
|
|
|
const packagesFolder = ".."
|
|
|
|
const jsFile = dir => join(dir, "budibase-client.js")
|
|
const jsMapFile = dir => join(dir, "budibase-client.js.map")
|
|
const sourceJs = jsFile("dist")
|
|
const sourceJsMap = jsMapFile("dist")
|
|
|
|
const appPackages = join(
|
|
packagesFolder,
|
|
"server",
|
|
serverConfig.latestPackagesFolder
|
|
)
|
|
|
|
const publicMain = appName => join(appPackages, appName, "public", "main")
|
|
const publicUnauth = appName =>
|
|
join(appPackages, appName, "public", "unauthenticated")
|
|
const nodeModules = appName =>
|
|
join(appPackages, appName, "node_modules", "@budibase", "client", "dist")
|
|
|
|
;(async () => {
|
|
const apps = await readdir(appPackages)
|
|
|
|
const copySource = file => async toDir => {
|
|
const dest = join(toDir, basename(file))
|
|
try {
|
|
await copyFile(file, dest, constants.COPYFILE_FICLONE)
|
|
console.log(`COPIED ${file} to ${dest}`)
|
|
} catch (e) {
|
|
console.log(`COPY FAILED ${file} to ${dest}: ${e}`)
|
|
}
|
|
}
|
|
|
|
const copySourceJs = copySource(sourceJs)
|
|
const copySourceJsMap = copySource(sourceJsMap)
|
|
|
|
for (let app of apps) {
|
|
if (app === ".data") continue
|
|
if (!(await stat(join(appPackages, app))).isDirectory()) continue
|
|
|
|
//await copySourceJs(nodeModules(app))
|
|
//await copySourceJsMap(nodeModules(app))
|
|
|
|
await copySourceJs(publicMain(app))
|
|
await copySourceJsMap(publicMain(app))
|
|
|
|
await copySourceJs(publicUnauth(app))
|
|
await copySourceJsMap(publicUnauth(app))
|
|
|
|
await copySource(join("dist", "budibase-client.esm.mjs"))(
|
|
join(packagesFolder, "server", "builder")
|
|
)
|
|
}
|
|
})()
|