Fixing issue with node modules path.

This commit is contained in:
mike12345567 2021-04-01 16:36:27 +01:00
parent 07c4d519f6
commit e9e01f00cc
2 changed files with 8 additions and 12 deletions

View File

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

View File

@ -22,7 +22,8 @@ const fetch = require("node-fetch")
const DEFAULT_AUTOMATION_BUCKET =
"https://prod-budi-automations.s3-eu-west-1.amazonaws.com"
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,
@ -54,11 +55,10 @@ exports.checkDevelopmentEnvironment = () => {
if (!isDev()) {
return
}
let error
if (!fs.existsSync(budibaseTempDir())) {
error =
"Please run a build before attempting to run server independently to fill 'tmp' directory."
fs.mkdirSync(budibaseTempDir())
}
let error
if (!fs.existsSync(join(process.cwd(), ".env"))) {
error = "Must run via yarn once to generate environment."
}
@ -237,4 +237,5 @@ exports.cleanup = appIds => {
exports.upload = upload
exports.retrieve = retrieve
exports.retrieveToTmp = retrieveToTmp
exports.TOP_LEVEL_PATH = TOP_LEVEL_PATH
exports.NODE_MODULES_PATH = NODE_MODULES_PATH