This commit is contained in:
Martin McKeaveney 2020-07-14 21:10:51 +01:00
parent b4e70301a0
commit 020ef654db
3 changed files with 9 additions and 21 deletions

View File

@ -5,17 +5,8 @@
import { routes } from "../routify/routes"
import { store, initialise } from "builderStore"
import NotificationDisplay from "components/common/Notification/NotificationDisplay.svelte"
import { notifier } from "builderStore/store/notifications"
function showErrorBanner() {
notifier.danger(
"Whoops! Looks like we're having trouble. Please refresh the page."
)
}
onMount(async () => {
// window.addEventListener("error", showErrorBanner)
// window.addEventListener("unhandledrejection", showErrorBanner)
await initialise()
})

View File

@ -12,8 +12,9 @@ const setBuilderToken = require("../../utilities/builder/setBuilderToken")
const fs = require("fs-extra")
const { promisify } = require("util")
const chmodr = require("chmodr")
const { downloadExtractComponentLibraries } = require("../../utilities/createAppPackage")
const {
downloadExtractComponentLibraries,
} = require("../../utilities/createAppPackage")
exports.fetch = async function(ctx) {
const db = new CouchDB(ClientDb.name(getClientId(ctx)))

View File

@ -10,26 +10,22 @@ const streamPipeline = promisify(stream.pipeline)
exports.appPackageFolder = (config, appname) =>
resolve(cwd(), config.latestPackagesFolder, appname)
exports.downloadExtractComponentLibraries = async appFolder => {
const LIBRARIES = [
"materialdesign-components",
"standard-components"
]
const LIBRARIES = ["materialdesign-components", "standard-components"]
// Need to download tarballs directly from NPM as our users may not have node on their machine
for (let lib of LIBRARIES) {
// download tarball
// TODO: make sure the latest version is always downloaded
const registryUrl = `https://registry.npmjs.org/@budibase/${lib}/-/${lib}-0.1.2.tgz`;
const registryUrl = `https://registry.npmjs.org/@budibase/${lib}/-/${lib}-0.1.2.tgz`
const response = await fetch(registryUrl)
if (!response.ok) throw new Error(`unexpected response ${response.statusText}`)
if (!response.ok)
throw new Error(`unexpected response ${response.statusText}`)
await streamPipeline(
response.body,
response.body,
zlib.Unzip(),
tar.extract(`${appFolder}/node_modules/@budibase/${lib}`)
)
}
}
}