Fixing an issue with server still expecting tmp directory to be created externally and updating component library to not cache with require in dev.

This commit is contained in:
mike12345567 2021-04-01 16:28:51 +01:00
parent 2f03b758a9
commit 4f589a8b49
1 changed files with 6 additions and 9 deletions

View File

@ -22,13 +22,7 @@ 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( const NODE_MODULES_PATH = join(__dirname, "..", "..", "..", "node_modules")
__dirname,
"..",
"..",
"..",
"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,
@ -178,12 +172,15 @@ exports.getComponentLibraryManifest = async (appId, library) => {
const path = require.resolve(library).split(lib)[0] const path = require.resolve(library).split(lib)[0]
return require(join(path, lib, filename)) return require(join(path, lib, filename))
} else if (env.isDev()) { } else if (env.isDev()) {
return require(join( const path = join(
NODE_MODULES_PATH, NODE_MODULES_PATH,
"@budibase", "@budibase",
"standard-components", "standard-components",
filename filename
)) )
// always load from new so that updates are refreshed
delete require.cache[require.resolve(path)]
return require(path)
} }
const path = join(appId, "node_modules", library, "package", filename) const path = join(appId, "node_modules", library, "package", filename)
let resp = await retrieve(ObjectStoreBuckets.APPS, path) let resp = await retrieve(ObjectStoreBuckets.APPS, path)