Use CJS style imports in plugin URL helper to work in jest, and respect plugin bucket env var
This commit is contained in:
parent
021316c73f
commit
788dac0f8d
|
@ -1,5 +1,6 @@
|
||||||
import env from "../environment"
|
const env = require("../environment")
|
||||||
import { plugins as ProPlugins } from "@budibase/pro"
|
const { plugins: ProPlugins } = require("@budibase/pro")
|
||||||
|
const { objectStore } = require("@budibase/backend-core")
|
||||||
|
|
||||||
export const enrichPluginURLs = plugins => {
|
export const enrichPluginURLs = plugins => {
|
||||||
if (!plugins || !plugins.length) {
|
if (!plugins || !plugins.length) {
|
||||||
|
@ -7,14 +8,14 @@ export const enrichPluginURLs = plugins => {
|
||||||
}
|
}
|
||||||
return plugins.map(plugin => {
|
return plugins.map(plugin => {
|
||||||
const cloud = !env.SELF_HOSTED
|
const cloud = !env.SELF_HOSTED
|
||||||
// In self host we need to prefix the path, as "plugins" is not part of the
|
const bucket = objectStore.ObjectStoreBuckets.PLUGINS
|
||||||
// bucket path. In cloud, "plugins" is already part of the bucket path.
|
const jsFileName = "plugin.min.js"
|
||||||
let jsUrl = cloud ? "https://cdn.budi.live/" : "/plugins/"
|
|
||||||
|
// In self host we need to prefix the path, as the bucket name is not part
|
||||||
|
// of the bucket path. In cloud, it's already part of the bucket path.
|
||||||
|
let jsUrl = cloud ? "https://cdn.budi.live/" : `/${bucket}/`
|
||||||
jsUrl += ProPlugins.getBucketPath(plugin.name)
|
jsUrl += ProPlugins.getBucketPath(plugin.name)
|
||||||
jsUrl += "plugin.min.js"
|
jsUrl += jsFileName
|
||||||
return {
|
return { ...plugin, jsUrl }
|
||||||
...plugin,
|
|
||||||
jsUrl,
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue