Skip to content

Commit

Permalink
chore: update nitro (#2472)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasdiez authored Aug 1, 2024
1 parent fe708f0 commit 6a7688f
Show file tree
Hide file tree
Showing 6 changed files with 230 additions and 177 deletions.
8 changes: 7 additions & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ export default defineNuxtConfig({
global: './global.ts',
},

/**
* Pre-render routes at build time by default
*/
ssr: true,

nitro: {
azure: {
config: {
Expand All @@ -28,6 +33,8 @@ export default defineNuxtConfig({
// Prevent 'reflect-metadata' and 'json-bigint-patch' from being treeshaked (since we don't explicitly use the import it would otherwise be removed)
moduleSideEffects: ['reflect-metadata', 'json-bigint-patch'],
prerender: {
// Prerender all pages reached from the index page
crawlLinks: true,
// Needed for storybook support (otherwise the file is not created during nuxi generate)
routes: ['/_storybook/external-iframe'],
},
Expand Down Expand Up @@ -178,7 +185,6 @@ export default defineNuxtConfig({
'/gsoc/**': { redirect: '/codeprojects/gsoc' },
'/bluehat2022': { redirect: '/codeprojects/bluehat2022' },
'/surveys/': { redirect: '/surveys/2015' },
'/': { prerender: true },
},

/**
Expand Down
10 changes: 2 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,8 @@
"pnpm": {
"patchedDependencies": {
"[email protected]": "patches/[email protected]",
"[email protected]": "patches/[email protected]",
"@vue/[email protected]": "patches/@[email protected]"
},
"overrides": {
"nitropack": "2.8.1"
"@vue/[email protected]": "patches/@[email protected]",
"[email protected]": "patches/[email protected]"
}
},
"overridesComments": {
"nitropack": "Version 2.9.0 introduced a bug with deployment to Azure: https://github.com/unjs/nitro/issues/2342"
}
}
38 changes: 21 additions & 17 deletions pages/download/[[os]].vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,27 @@
</template>

<script lang="ts" setup>
definePageMeta({ layout: false })
definePageMeta({
layout: false,
const route = useRoute('download-os')
middleware: async (to) => {
let downloadUrl = 'https://www.fosshub.com/JabRef.html'
const os = to.params.os as string | undefined
if (os && ['win', 'mac', 'linux'].includes(os)) {
const { data } = await useFetch('/api/getLatestRelease')
const latestRelease = data.value?.version
if (latestRelease) {
downloadUrl +=
{
win: `?dwl=JabRef-${latestRelease}.msi`,
mac: `?dwl=JabRef-${latestRelease}.pkg`,
linux: `?dwl=jabref_${latestRelease}_amd64.deb`,
}[os] ?? ''
}
}
const { version: latestRelease } = await $fetch('/api/getLatestRelease')
let downloadUrl = 'https://www.fosshub.com/JabRef.html'
const os = route.params.os as string | undefined
if (os && ['win', 'mac', 'linux'].includes(os)) {
downloadUrl +=
{
win: `?dwl=JabRef-${latestRelease}.msi`,
mac: `?dwl=JabRef-${latestRelease}.pkg`,
linux: `?dwl=jabref_${latestRelease}_amd64.deb`,
}[os] ?? ''
}
await navigateTo(downloadUrl, { external: true })
return await navigateTo(downloadUrl, { external: true })
},
})
const downloadUrl = 'https://www.fosshub.com/JabRef.html'
</script>
6 changes: 3 additions & 3 deletions patches/[email protected] → patches/[email protected]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/dist/runtime/entries/azure.mjs b/dist/runtime/entries/azure.mjs
index 2ed72eb8e5f5f6b740d909bb12f62cf761599569..fca9788f9d40e7ac6cc8eeb8d503024ef68a4a1b 100644
index fe72a0be7cd3984a638234280b409a7ca803b5d0..f57378bb6564af89b16ddbca66cbb11abe116115 100644
--- a/dist/runtime/entries/azure.mjs
+++ b/dist/runtime/entries/azure.mjs
@@ -3,6 +3,7 @@ import { parseURL } from "ufo";
Expand Down Expand Up @@ -33,7 +33,7 @@ index 2ed72eb8e5f5f6b740d909bb12f62cf761599569..fca9788f9d40e7ac6cc8eeb8d503024e
+ ],
+ });
+ consola.wrapConsole();
const { body, status, statusText, headers } = await nitroApp.localCall({
const { body, status, headers } = await nitroApp.localCall({
url,
headers: req.headers,
@@ -18,6 +38,7 @@ export async function handle(context, req) {
Expand All @@ -43,4 +43,4 @@ index 2ed72eb8e5f5f6b740d909bb12f62cf761599569..fca9788f9d40e7ac6cc8eeb8d503024e
+ consola.restoreConsole();
context.res = {
status,
// cookies https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-node?tabs=typescript%2Cwindows%2Cazure-cli&pivots=nodejs-model-v4#http-response
cookies: getAzureParsedCookiesFromHeaders(headers),
Loading

0 comments on commit 6a7688f

Please sign in to comment.