Skip to content

Commit

Permalink
Merge branch 'main' into storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
iva2k committed Jul 31, 2024
2 parents 066ad9a + 36be3ee commit 3346a0b
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 203 deletions.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
"svelte:prebuild": "echo RUN svelte:prebuild && rimraf .svelte-kit && rimraf build && svelte-kit sync && tsx scripts/assets-copy.ts",
"svelte:predev": "echo RUN svelte:predev && rimraf dev-dist && svelte-kit sync && tsx scripts/assets-copy.ts",
"dev": " pnpm dev:http",
"dev:http": " echo RUN dev:http && pnpm svelte:predev && cross-env SW_DEV=true DEBUG=vite-plugin-pwa:* NO_HTTPS=1 vite dev --port 3000",
"dev:https": " echo RUN dev:https && pnpm svelte:predev && cross-env SW_DEV=true DEBUG=vite-plugin-pwa:* vite dev --port 3000",
"dev:http": " echo RUN dev:http && pnpm svelte:predev && cross-env DEBUG=vite-plugin-pwa:* NO_HTTPS=1 vite dev --port 3000",
"dev:https": " echo RUN dev:https && pnpm svelte:predev && cross-env DEBUG=vite-plugin-pwa:* vite dev --port 3000",
"dev-sw:http": " echo RUN dev-sw:http && pnpm svelte:predev && cross-env SW_DEV=true DEBUG=vite-plugin-pwa:* NO_HTTPS=1 vite dev --port 3000",
"dev-sw:https": " echo RUN dev-sw:https && pnpm svelte:predev && cross-env SW_DEV=true DEBUG=vite-plugin-pwa:* vite dev --port 3000",
"dev-claims": " echo RUN dev-claims && pnpm svelte:predev && cross-env SW_DEV=true DEBUG=vite-plugin-pwa:* SW=true CLAIMS=true vite dev --port 3000",
"dev-destroy": " echo RUN dev-destroy && pnpm svelte:predev && cross-env SW_DEV=true DEBUG=vite-plugin-pwa:* SW_DESTROY=true vite dev --port 3000",
"dev-claims-destroy": " echo RUN dev-claims-destroy && pnpm svelte:predev && cross-env SW_DEV=true DEBUG=vite-plugin-pwa:* SW=true SW_DESTROY=true CLAIMS=true vite dev --port 3000",
Expand Down
3 changes: 1 addition & 2 deletions pwa-configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ const pwaConfigurationFnc = async (
// default: minify: true,

devOptions: {
// enabled: process.env.SW_DEV === 'true',
enabled: true,
enabled: process.env.SW_DEV === 'true',
/* when using generateSW the PWA plugin will switch to classic */
type: 'module',
navigateFallback: scope
Expand Down
45 changes: 22 additions & 23 deletions src/lib/components/header/PureHeader.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,39 @@
import { onMount } from 'svelte';
import logo from '$lib/images/logo.svg';
import website from '$lib/config/website';
import { prepSiteLinks } from '$lib/config/configUtils';
import { loadSiteLinks, prepSiteLinks } from '$lib/config/configUtils';
import type { SiteLink } from '$lib/types';
const { websiteUrlBase, siteLinks } = website;
export let pathname = '/';
$: path1st = '/' + (pathname ?? '').split('/')[1];
let brandLink: SiteLink;
let headerLinks: SiteLink[] = [];
let brandLink: SiteLink = prepSiteLinks(
siteLinks,
'brand',
1,
/* nodeFilter */ true,
/* flatten */ true,
/* prune */ false // Allow brand without a link
)?.[0];
let headerLinks: SiteLink[] = prepSiteLinks(
siteLinks,
'header',
2,
true,
/* flatten */ true,
/* prune */ true
);
onMount(async () => {
/* DISABLED (see root +layout.svelte)
await loadIonicPWAElements(window);
*/
const mypath = import.meta.url;
brandLink = (
await prepSiteLinks(
siteLinks,
mypath,
'brand',
1,
/* nodeFilter */ true,
/* flatten */ true,
/* prune */ false // Allow brand without a link
)
)?.[0];
headerLinks = await prepSiteLinks(
siteLinks,
mypath,
'header',
2,
true,
/* flatten */ true,
/* prune */ true
);
// [brandLink, ... headerLinks] =
await Promise.all([
loadSiteLinks([brandLink], mypath)?.[0],
...loadSiteLinks(headerLinks, mypath)
]);
console.log('DEBUG: headerLinks=%o', headerLinks);
});
</script>
Expand Down
Loading

0 comments on commit 3346a0b

Please sign in to comment.