budibase/scripts/symlinkDev.js

45 lines
1.2 KiB
JavaScript
Raw Normal View History

#!/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")
const { resolve } = require("path")
2020-05-07 15:59:06 +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-07 15:59:06 +02:00
rimraf.sync(devDir);
fs.mkdirSync(`${devDir}/@budibase`, { recursive: true })
const SYMLINK_PATHS = [
{
2020-05-07 15:59:06 +02:00
symlink: `${devDir}/@budibase/materialdesign-components`,
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-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-07 15:59:06 +02:00
symlink: `${devDir}/budibase-client.js`,
destination: resolve("packages/client/dist/budibase-client.js"),
2020-05-07 11:53:34 +02:00
},
]
SYMLINK_PATHS.forEach(sym => {
2020-05-07 11:53:34 +02:00
fs.symlinkSync(sym.destination, sym.symlink)
})
2020-05-07 11:53:34 +02:00
console.log("Dev Symlinks Created Successfully.")