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-18 12:01:09 +02:00
|
|
|
const rimraf = require("rimraf")
|
2020-05-11 16:42:42 +02:00
|
|
|
const {
|
|
|
|
budibaseTempDir,
|
|
|
|
} = require("../packages/server/src/utilities/budibaseDir")
|
|
|
|
const devDir = budibaseTempDir()
|
2020-05-06 11:33:30 +02:00
|
|
|
|
2020-05-18 12:01:09 +02:00
|
|
|
rimraf.sync(devDir)
|
2020-05-07 15:59:06 +02:00
|
|
|
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.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-11-25 17:08:28 +01:00
|
|
|
{
|
|
|
|
symlink: `${devDir}/budibase-client.js.map`,
|
|
|
|
destination: resolve("packages/client/dist/budibase-client.js.map"),
|
|
|
|
},
|
2021-01-18 18:40:19 +01:00
|
|
|
{
|
|
|
|
symlink: `${devDir}/@budibase/string-templates`,
|
|
|
|
destination: resolve("packages/string-templates"),
|
|
|
|
}
|
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.")
|