Skip to content

Commit

Permalink
update Vike usage
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Dec 7, 2023
1 parent d083cca commit 937f972
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/authentication/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"ts-node": "^10.9.1",
"typescript": "^5.3.3",
"vite": "^5.0.6",
"vike": "^0.4.142"
"vike": "^0.4.149"
},
"imports": {
"#app/*": "./*.ts",
Expand Down
5 changes: 3 additions & 2 deletions examples/authentication/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ async function startServer() {
const pageContext = await renderPage(pageContextInit)
const { httpResponse } = pageContext
if (!httpResponse) return next()
const { statusCode, contentType } = httpResponse
res.status(statusCode).type(contentType)
const { statusCode, headers } = httpResponse
res.status(statusCode)
headers.forEach(([name, value]) => res.setHeader(name, value))
httpResponse.pipe(res)
})

Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 32 additions & 1 deletion test-e2e.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ function getCiJobs() {
}

function tolerateError({ logSource, logText }) {
return isRollupEmptyChunkWarning() || isSveltekitTypesGenWarning()
return (
isRollupEmptyChunkWarning() ||
isSveltekitTypesGenWarning() ||
isCJSVikeWarning() ||
isCJSViteWarning() ||
isVikeOldDesignWarning()
)

function isRollupEmptyChunkWarning() {
return logSource === 'stderr' && logText.includes('Generated an empty chunk: "hooks"')
Expand All @@ -77,4 +83,29 @@ function tolerateError({ logSource, logText }) {
function isSveltekitTypesGenWarning() {
return logSource === 'stderr' && logText.includes('Cannot find base config file "./.svelte-kit/tsconfig.json"')
}

function isCJSVikeWarning() {
return (
logSource === 'stderr' &&
logText.includes('We recommend setting ') &&
logText.includes('/package.json#type to "module", see https://vike.dev/CJS')
)
}
function isCJSViteWarning() {
return (
logSource === 'stderr' &&
logText.includes(
"The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details."
)
)
}

function isVikeOldDesignWarning() {
return (
logSource === 'stderr' &&
logText.includes(
'You are using the old deprecated design, update to the new V1 design, see https://vike.dev/migration/v1-design'
)
)
}
}

0 comments on commit 937f972

Please sign in to comment.