1
0
Fork 0
mirror of synced 2024-06-27 18:40:42 +12:00
This commit is contained in:
Martin McKeaveney 2020-07-14 21:10:51 +01:00
parent 71fc36ec7e
commit 63c5cd9af4
3 changed files with 9 additions and 21 deletions

View file

@ -5,17 +5,8 @@
import { routes } from "../routify/routes" import { routes } from "../routify/routes"
import { store, initialise } from "builderStore" import { store, initialise } from "builderStore"
import NotificationDisplay from "components/common/Notification/NotificationDisplay.svelte" 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 () => { onMount(async () => {
// window.addEventListener("error", showErrorBanner)
// window.addEventListener("unhandledrejection", showErrorBanner)
await initialise() await initialise()
}) })

View file

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

View file

@ -10,26 +10,22 @@ const streamPipeline = promisify(stream.pipeline)
exports.appPackageFolder = (config, appname) => exports.appPackageFolder = (config, appname) =>
resolve(cwd(), config.latestPackagesFolder, appname) resolve(cwd(), config.latestPackagesFolder, appname)
exports.downloadExtractComponentLibraries = async appFolder => { 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 // Need to download tarballs directly from NPM as our users may not have node on their machine
for (let lib of LIBRARIES) { for (let lib of LIBRARIES) {
// download tarball // download tarball
// TODO: make sure the latest version is always downloaded // 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) 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( await streamPipeline(
response.body, response.body,
zlib.Unzip(), zlib.Unzip(),
tar.extract(`${appFolder}/node_modules/@budibase/${lib}`) tar.extract(`${appFolder}/node_modules/@budibase/${lib}`)
) )
} }
} }