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 15:59:06 +02:00
|
|
|
const rimraf = require("rimraf");
|
2020-05-06 11:33:30 +02:00
|
|
|
|
2020-05-07 15:59:06 +02:00
|
|
|
const devDir = "/tmp/.budibase"
|
2020-05-06 11:33:30 +02:00
|
|
|
|
2020-05-07 15:59:06 +02:00
|
|
|
rimraf.sync(devDir);
|
|
|
|
fs.mkdirSync(`${devDir}/@budibase`, { recursive: true })
|
2020-05-06 11:33:30 +02:00
|
|
|
|
|
|
|
const SYMLINK_PATHS = [
|
|
|
|
{
|
2020-05-07 15:59:06 +02:00
|
|
|
symlink: `${devDir}/@budibase/materialdesign-components`,
|
2020-05-06 11:33:30 +02:00
|
|
|
destination: resolve("packages/materialdesign-components"),
|
|
|
|
},
|
|
|
|
{
|
2020-05-07 15:59:06 +02:00
|
|
|
symlink: `${devDir}/@budibase/standard-components`,
|
2020-05-07 11:53:34 +02:00
|
|
|
destination: resolve("packages/standard-components"),
|
2020-05-06 11:33:30 +02:00
|
|
|
},
|
|
|
|
{
|
2020-05-07 15:59:06 +02:00
|
|
|
symlink: `${devDir}/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
|
|
|
},
|
|
|
|
{
|
2020-05-07 15:59:06 +02:00
|
|
|
symlink: `${devDir}/budibase-client.js`,
|
2020-05-06 11:33:30 +02:00
|
|
|
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.")
|