update routify to beta 40 and set up correct basepath for application, also fixes some links

This commit is contained in:
kevmodrome 2020-04-09 09:04:09 +02:00
parent 627880c69a
commit a065a4399d
6 changed files with 9 additions and 40 deletions

View File

@ -59,7 +59,7 @@
"@babel/preset-env": "^7.5.5", "@babel/preset-env": "^7.5.5",
"@babel/runtime": "^7.5.5", "@babel/runtime": "^7.5.5",
"@rollup/plugin-alias": "^3.0.1", "@rollup/plugin-alias": "^3.0.1",
"@sveltech/routify": "1.5.0-beta.26", "@sveltech/routify": "1.5.0-beta.40",
"babel-jest": "^24.8.0", "babel-jest": "^24.8.0",
"browser-sync": "^2.26.7", "browser-sync": "^2.26.7",
"http-proxy-middleware": "^0.19.1", "http-proxy-middleware": "^0.19.1",
@ -81,4 +81,4 @@
"svelte": "^3.0.0" "svelte": "^3.0.0"
}, },
"gitHead": "115189f72a850bfb52b65ec61d932531bf327072" "gitHead": "115189f72a850bfb52b65ec61d932531bf327072"
} }

View File

@ -14,32 +14,6 @@ import replace from "rollup-plugin-replace"
import path from "path" import path from "path"
const target = "http://localhost:4001"
const _builderProxy = proxy("/_builder", {
target: "http://localhost:3000",
pathRewrite: { "^/_builder": "" },
})
const apiProxy = proxy(
[
"/_builder/assets/**",
"/_builder/api/**",
"/_builder/**/componentlibrary",
"/_builder/instance/**",
],
{
target,
logLevel: "debug",
changeOrigin: true,
cookieDomainRewrite: true,
onProxyReq(proxyReq) {
if (proxyReq.getHeader("origin")) {
proxyReq.setHeader("origin", target)
}
},
}
)
const production = !process.env.ROLLUP_WATCH const production = !process.env.ROLLUP_WATCH
const lodash_fp_exports = [ const lodash_fp_exports = [
@ -230,11 +204,6 @@ export default {
// Watch the `dist` directory and refresh the // Watch the `dist` directory and refresh the
// browser on changes when not in production // browser on changes when not in production
!production && livereload(outputpath), !production && livereload(outputpath),
!production &&
browsersync({
server: outputpath,
middleware: [apiProxy, _builderProxy],
}),
// If we're building for production (npm run build // If we're building for production (npm run build
// instead of npm run dev), minify // instead of npm run dev), minify

View File

@ -1,7 +1,7 @@
<script> <script>
import Modal from "svelte-simple-modal" import Modal from "svelte-simple-modal"
import { onMount } from "svelte" import { onMount } from "svelte"
import { Router } from "@sveltech/routify" import { Router, basepath } from "@sveltech/routify"
import { routes } from "@sveltech/routify/tmp/routes" import { routes } from "@sveltech/routify/tmp/routes"
import { store, initialise } from "builderStore" import { store, initialise } from "builderStore"
import AppNotification, { import AppNotification, {
@ -20,6 +20,8 @@
window.addEventListener("error", showErrorBanner) window.addEventListener("error", showErrorBanner)
window.addEventListener("unhandledrejection", showErrorBanner) window.addEventListener("unhandledrejection", showErrorBanner)
}) })
$basepath = "/_builder"
</script> </script>
<AppNotification /> <AppNotification />

View File

@ -6,7 +6,7 @@
</script> </script>
<div <div
on:click={() => $goto($url(href))} on:click={() => $goto(href)}
class="budibase__nav-item backend-nav-item" class="budibase__nav-item backend-nav-item"
class:selected={$isActive(href)}> class:selected={$isActive(href)}>
{label} {label}

View File

@ -13,7 +13,7 @@
<div> <div>
<h4 style="margin-bottom: 20px">Choose an Application</h4> <h4 style="margin-bottom: 20px">Choose an Application</h4>
{#each apps as app} {#each apps as app}
<a href={`/${app}`} class="app-link">{app}</a> <a href={`./${app}`} class="app-link">{app}</a>
{/each} {/each}
</div> </div>
</div> </div>

View File

@ -2,7 +2,7 @@
import { store } from "builderStore" import { store } from "builderStore"
import { fade } from "svelte/transition" import { fade } from "svelte/transition"
import { isActive, goto, url, context } from "@sveltech/routify" import { isActive, goto, url, layout } from "@sveltech/routify"
import { SettingsIcon, PreviewIcon } from "components/common/Icons/" import { SettingsIcon, PreviewIcon } from "components/common/Icons/"
import IconButton from "components/common/IconButton.svelte" import IconButton from "components/common/IconButton.svelte"
@ -23,8 +23,6 @@
throw new Error(pkg) throw new Error(pkg)
} }
} }
$: ({ component } = $context)
$: list = component.parent.children.filter(child => child.isIndexable)
</script> </script>
<div class="root"> <div class="root">
@ -38,7 +36,7 @@
</button> </button>
<!-- List is an array of subfolders in the application folder. --> <!-- List is an array of subfolders in the application folder. -->
{#each list as { path, prettyName, children, meta }} {#each $layout.children as { path, prettyName, children, meta }}
<span <span
class:active={$isActive(path)} class:active={$isActive(path)}
class="topnavitem" class="topnavitem"