Fixing issue with node modules path.

This commit is contained in:
mike12345567 2021-04-01 16:36:27 +01:00
parent 4f589a8b49
commit 74aa94fac6
2 changed files with 8 additions and 12 deletions

View File

@ -13,6 +13,7 @@ const setBuilderToken = require("../../../utilities/builder/setBuilderToken")
const { const {
loadHandlebarsFile, loadHandlebarsFile,
NODE_MODULES_PATH, NODE_MODULES_PATH,
TOP_LEVEL_PATH,
} = require("../../../utilities/fileSystem") } = require("../../../utilities/fileSystem")
const env = require("../../../environment") const env = require("../../../environment")
const fileProcessor = require("../../../utilities/fileSystem/processor") const fileProcessor = require("../../../utilities/fileSystem/processor")
@ -33,7 +34,7 @@ async function checkForSelfHostedURL(ctx) {
const COMP_LIB_BASE_APP_VERSION = "0.2.5" const COMP_LIB_BASE_APP_VERSION = "0.2.5"
exports.serveBuilder = async function(ctx) { exports.serveBuilder = async function(ctx) {
let builderPath = resolve(NODE_MODULES_PATH, "builder") let builderPath = resolve(TOP_LEVEL_PATH, "builder")
if (ctx.file === "index.html") { if (ctx.file === "index.html") {
await setBuilderToken(ctx) await setBuilderToken(ctx)
} }
@ -94,13 +95,7 @@ exports.serveApp = async function(ctx) {
exports.serveClientLibrary = async function(ctx) { exports.serveClientLibrary = async function(ctx) {
return send(ctx, "budibase-client.js", { return send(ctx, "budibase-client.js", {
root: join( root: join(NODE_MODULES_PATH, "@budibase", "client", "dist"),
NODE_MODULES_PATH,
"node_modules",
"@budibase",
"client",
"dist"
),
}) })
} }

View File

@ -22,7 +22,8 @@ const fetch = require("node-fetch")
const DEFAULT_AUTOMATION_BUCKET = const DEFAULT_AUTOMATION_BUCKET =
"https://prod-budi-automations.s3-eu-west-1.amazonaws.com" "https://prod-budi-automations.s3-eu-west-1.amazonaws.com"
const DEFAULT_AUTOMATION_DIRECTORY = ".budibase-automations" const DEFAULT_AUTOMATION_DIRECTORY = ".budibase-automations"
const NODE_MODULES_PATH = join(__dirname, "..", "..", "..", "node_modules") const TOP_LEVEL_PATH = join(__dirname, "..", "..", "..")
const NODE_MODULES_PATH = join(TOP_LEVEL_PATH, "node_modules")
/** /**
* The single stack system (Cloud and Builder) should not make use of the file system where possible, * The single stack system (Cloud and Builder) should not make use of the file system where possible,
@ -54,11 +55,10 @@ exports.checkDevelopmentEnvironment = () => {
if (!isDev()) { if (!isDev()) {
return return
} }
let error
if (!fs.existsSync(budibaseTempDir())) { if (!fs.existsSync(budibaseTempDir())) {
error = fs.mkdirSync(budibaseTempDir())
"Please run a build before attempting to run server independently to fill 'tmp' directory."
} }
let error
if (!fs.existsSync(join(process.cwd(), ".env"))) { if (!fs.existsSync(join(process.cwd(), ".env"))) {
error = "Must run via yarn once to generate environment." error = "Must run via yarn once to generate environment."
} }
@ -237,4 +237,5 @@ exports.cleanup = appIds => {
exports.upload = upload exports.upload = upload
exports.retrieve = retrieve exports.retrieve = retrieve
exports.retrieveToTmp = retrieveToTmp exports.retrieveToTmp = retrieveToTmp
exports.TOP_LEVEL_PATH = TOP_LEVEL_PATH
exports.NODE_MODULES_PATH = NODE_MODULES_PATH exports.NODE_MODULES_PATH = NODE_MODULES_PATH