Budibase is an open-source low-code platform for creating internal apps in minutes. Supports PostgreSQL, MySQL, MSSQL, MongoDB, Rest API, Docker, K8s 🚀
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

54 lines
1.4 KiB

const fs = require("fs")
const { join } = require("path")
const { spawnSync } =require("child_process")
const DONT_RUN_PKG = ["bbui"]
const PACKAGES_PATH = join(__dirname, "..", "packages")
function getPackages() {
return fs.readdirSync(PACKAGES_PATH)
}
function deleteFile(path) {
try {
fs.unlinkSync(path)
} catch (err) {
// don't error, it just doesn't exist
}
}
function removeModules(path) {
if (fs.existsSync(path)) {
fs.rmdirSync(path, { recursive: true })
}
}
function executeInPackage(packageName) {
if (DONT_RUN_PKG.includes(packageName)) {
return
}
const dir = join(PACKAGES_PATH, packageName)
if (!fs.existsSync(join(dir, "package.json"))) {
console.error(`SKIPPING ${packageName} directory, no package.json`)
return
}
const packageLockLoc = join(dir, "package-lock.json")
const modulesLoc = join(dir, "node_modules")
deleteFile(join(dir, "yarn.lock"))
deleteFile(packageLockLoc)
removeModules(modulesLoc)
const opts = { cwd: dir, stdio: "inherit", shell: true }
spawnSync("npm", ["i", "--package-lock-only"], opts)
spawnSync("npm", ["audit", "fix"], opts)
spawnSync("yarn", ["import"], opts)
deleteFile(packageLockLoc)
removeModules(modulesLoc)
}
const packages = getPackages()
for (let pkg of packages) {
executeInPackage(pkg)
}
spawnSync("yarn", ["bootstrap"], { cwd: join(__dirname, ".."), stdio: "inherit", shell: true })