docs(site): downgrade sirv, commonjs plugin, preserve rollup signatures, minor seo tweak (#950)

* fix: sirv, commonjs plugin, add rollup sig

* replace deprecated rollup plugins

* remove dollarsign
This commit is contained in:
Max Peintner
2020-11-11 11:50:38 +01:00
committed by GitHub
parent 43a807c54b
commit 8dbf0cfee0
10 changed files with 141 additions and 283 deletions

View File

@@ -5,6 +5,7 @@
import manifest from '../../static/manifest.json';
export let owner = "caos";
export let path = "docs";
export let project = "zitadel";
export let dir = "";
export let edit_title = "edit this section";
export let sections;
@@ -486,7 +487,7 @@
{@html section.metadata.title}
<small>
<a
href="https://github.com/{owner}/zitadel/edit/master/site/{path}/{dir}/{section.file}"
href="https://github.com/{owner}/{project}/edit/master/site/{path}/{dir}/{section.file}"
title={edit_title}>
<Icon name="las la-external-link-alt" size="24px" />
</a>

View File

@@ -15,7 +15,6 @@
export let seo;
import { onMount } from 'svelte';
import { initPhotoSwipeFromDOM } from '../utils/photoswipe.js';
import SearchSelector from '../components/SearchSelector.svelte';
onMount(() => {
initPhotoSwipeFromDOM('.zitadel-gallery');
@@ -33,10 +32,10 @@
<svelte:head>
<title>{manifest.name}{slug}</title>
{ @html seo}
{#if seo}
{ @html seo}
{/if}
</svelte:head>
<DocsHeader {slug}></DocsHeader>
<Docs {sections} project="zitadel/site" dir="{slug}"/>
<!-- <SearchSelector></SearchSelector> -->
<Docs {sections} dir="{slug}"/>

View File

@@ -6,6 +6,8 @@
import manifest from '../../static/manifest.json';
import PhotoSwipe from '../components/PhotoSwipe.svelte';
const { page } = stores();
export let segment;
console.log('seg:'+segment);
</script>
<script context="module">

View File

@@ -259,12 +259,6 @@
<a class="link" href="integrate#Server_Side_Application">{$_('integratelink_ssr')}</a>
<a class="link" href="integrate#Mobile_App_Native_App">{$_('integratelink_nativeapp')}</a>
</div>
<!-- {:else if $locale == 'de'}
<div class="sectionlinks">
<a class="link" href="integrate#Single_Page_Application">{$_('integratelink_spa')}</a>
<a class="link" href="integrate#Server_Side_Application">{$_('integratelink_ssr')}</a>
<a class="link" href="integrate#Mobile_App_Native_App">{$_('integratelink_nativeapp')}</a>
</div> -->
{/if}
</div>
<img src="img/develop2.png" alt="Develop" />

View File

@@ -1,4 +1,4 @@
import { timestamp, files, shell, routes } from '@sapper/service-worker';
import { files, routes, shell, timestamp } from '@sapper/service-worker';
const ASSETS = `cache${timestamp}`;
@@ -8,75 +8,75 @@ const to_cache = shell.concat(files);
const cached = new Set(to_cache);
self.addEventListener('install', event => {
event.waitUntil(
caches
.open(ASSETS)
.then(cache => cache.addAll(to_cache))
.then(() => {
self.skipWaiting();
})
);
event.waitUntil(
caches
.open(ASSETS)
.then(cache => cache.addAll(to_cache))
.then(() => {
self.skipWaiting();
})
);
});
self.addEventListener('activate', event => {
event.waitUntil(
caches.keys().then(async keys => {
// delete old caches
for (const key of keys) {
if (key !== ASSETS) await caches.delete(key);
}
event.waitUntil(
caches.keys().then(async keys => {
// delete old caches
for (const key of keys) {
if (key !== ASSETS) await caches.delete(key);
}
self.clients.claim();
})
);
self.clients.claim();
})
);
});
self.addEventListener('fetch', event => {
if (event.request.method !== 'GET' || event.request.headers.has('range')) return;
if (event.request.method !== 'GET' || event.request.headers.has('range')) return;
const url = new URL(event.request.url);
const url = new URL(event.request.url);
// don't try to handle e.g. data: URIs
if (!url.protocol.startsWith('http')) return;
// don't try to handle e.g. data: URIs
if (!url.protocol.startsWith('http')) return;
// ignore dev server requests
if (url.hostname === self.location.hostname && url.port !== self.location.port) return;
// ignore dev server requests
if (url.hostname === self.location.hostname && url.port !== self.location.port) return;
// always serve static files and bundler-generated assets from cache
if (url.host === self.location.host && cached.has(url.pathname)) {
event.respondWith(caches.match(event.request));
return;
}
// always serve static files and bundler-generated assets from cache
if (url.host === self.location.host && cached.has(url.pathname)) {
event.respondWith(caches.match(event.request));
return;
}
// for pages, you might want to serve a shell `service-worker-index.html` file,
// which Sapper has generated for you. It's not right for every
// app, but if it's right for yours then uncomment this section
/*
if (url.origin === self.origin && routes.find(route => route.pattern.test(url.pathname))) {
event.respondWith(caches.match('/service-worker-index.html'));
return;
}
*/
// for pages, you might want to serve a shell `service-worker-index.html` file,
// which Sapper has generated for you. It's not right for every
// app, but if it's right for yours then uncomment this section
if (event.request.cache === 'only-if-cached') return;
// if (url.origin === self.origin && routes.find(route => route.pattern.test(url.pathname))) {
// event.respondWith(caches.match('/service-worker-index.html'));
// return;
// }
// for everything else, try the network first, falling back to
// cache if the user is offline. (If the pages never change, you
// might prefer a cache-first approach to a network-first one.)
event.respondWith(
caches
.open(`offline${timestamp}`)
.then(async cache => {
try {
const response = await fetch(event.request);
cache.put(event.request, response.clone());
return response;
} catch(err) {
const response = await cache.match(event.request);
if (response) return response;
throw err;
}
})
);
if (event.request.cache === 'only-if-cached') return;
// for everything else, try the network first, falling back to
// cache if the user is offline. (If the pages never change, you
// might prefer a cache-first approach to a network-first one.)
event.respondWith(
caches
.open(`offline${timestamp}`)
.then(async cache => {
try {
const response = await fetch(event.request);
cache.put(event.request, response.clone());
return response;
} catch (err) {
const response = await cache.match(event.request);
if (response) return response;
throw err;
}
})
);
});