2020-05-06 11:33:30 +02:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
|
|
|
/**
|
|
|
|
This script symlinks the budibase component and client paths to the
|
|
|
|
ones that exist in your local development directories. This means you
|
|
|
|
can work your budibase apps but also change code for the components
|
|
|
|
and client library in real time.
|
|
|
|
*/
|
|
|
|
|
2020-05-07 11:53:34 +02:00
|
|
|
const fs = require("fs")
|
2020-05-06 11:33:30 +02:00
|
|
|
const { resolve } = require("path")
|
|
|
|
|
2020-05-07 11:53:34 +02:00
|
|
|
const devDir = "/tmp/.budibase/@budibase"
|
2020-05-06 11:33:30 +02:00
|
|
|
|
|
|
|
// create the dev directory if it doesn't exist
|
|
|
|
if (!fs.existsSync(devDir)) {
|
2020-05-07 11:53:34 +02:00
|
|
|
fs.mkdirSync(devDir, { recursive: true })
|
2020-05-06 11:33:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
const SYMLINK_PATHS = [
|
|
|
|
{
|
|
|
|
symlink: "/tmp/.budibase/@budibase/materialdesign-components",
|
|
|
|
destination: resolve("packages/materialdesign-components"),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
symlink: "/tmp/.budibase/@budibase/standard-components",
|
2020-05-07 11:53:34 +02:00
|
|
|
destination: resolve("packages/standard-components"),
|
2020-05-06 11:33:30 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
symlink: "/tmp/.budibase/budibase-client.esm.mjs",
|
2020-05-07 11:53:34 +02:00
|
|
|
destination: resolve("packages/client/dist/budibase-client.esm.mjs"),
|
2020-05-06 11:33:30 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
symlink: "/tmp/.budibase/budibase-client.js",
|
|
|
|
destination: resolve("packages/client/dist/budibase-client.js"),
|
2020-05-07 11:53:34 +02:00
|
|
|
},
|
2020-05-06 11:33:30 +02:00
|
|
|
]
|
|
|
|
|
|
|
|
SYMLINK_PATHS.forEach(sym => {
|
2020-05-07 11:53:34 +02:00
|
|
|
fs.symlinkSync(sym.destination, sym.symlink)
|
|
|
|
})
|
2020-05-06 11:33:30 +02:00
|
|
|
|
2020-05-07 11:53:34 +02:00
|
|
|
console.log("Dev Symlinks Created Successfully.")
|