Skip to content

Commit

Permalink
fix: use latest version of the Vike V1 design
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Nov 17, 2023
1 parent 22d01f3 commit a446524
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 25 deletions.
2 changes: 1 addition & 1 deletion examples/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"node-fetch": "^3.3.2",
"solid-js": "^1.7.11",
"vike-solid": "workspace:*",
"vike": "^0.4.144"
"vike": "^0.4.147"
},
"devDependencies": {
"typescript": "^5.1.6"
Expand Down
2 changes: 1 addition & 1 deletion examples/ssr-spa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dependencies": {
"solid-js": "^1.7.11",
"vike-solid": "workspace:*",
"vike": "^0.4.144"
"vike": "^0.4.147"
},
"devDependencies": {
"typescript": "^5.1.6"
Expand Down
22 changes: 11 additions & 11 deletions pnpm-lock.yaml

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

4 changes: 2 additions & 2 deletions vike-solid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"peerDependencies": {
"solid-js": "^1.8.5",
"vite": "^4.5.0",
"vike": "^0.4.144"
"vike": "^0.4.147"
},
"devDependencies": {
"@babel/core": "^7.23.3",
Expand All @@ -37,7 +37,7 @@
"tslib": "^2.6.2",
"typescript": "^5.2.2",
"vite": "^4.5.0",
"vike": "^0.4.144"
"vike": "^0.4.147"
},
"typesVersions": {
"*": {
Expand Down
18 changes: 9 additions & 9 deletions vike-solid/renderer/+config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const toggleSsrRelatedConfig: ConfigEffect = ({
// accessible only in the client's renderer.
Page: {
env: configValue
? "server-and-client" // default
: "client-only",
? { server: true, client: true } // default
: { client: true },
},
},
};
Expand All @@ -42,25 +42,25 @@ export default {
hydrationCanBeAborted: true,
meta: {
Head: {
env: "server-only",
env: { server: true },
},
Layout: {
env: "server-and-client",
env: { server: true, client: true },
},
title: {
env: "server-and-client",
env: { server: true, client: true },
},
description: {
env: "server-only",
env: { server: true },
},
favicon: {
env: "server-only",
env: { server: true },
},
lang: {
env: "server-only",
env: { server: true },
},
ssr: {
env: "config-only",
env: { config: true },
effect: toggleSsrRelatedConfig,
},
},
Expand Down
14 changes: 13 additions & 1 deletion vike-solid/renderer/+onRenderHtml.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import {
renderToStream,
renderToString,
} from "solid-js/web";
import { dangerouslySkipEscape, escapeInject, stampPipe } from "vike/server";
import { dangerouslySkipEscape, escapeInject, stampPipe, version } from "vike/server";
import { getTitle } from "./getTitle";
import { getPageElement } from "./getPageElement";
import type { OnRenderHtmlAsync } from "vike/types";
import { PageContextProvider } from "./PageContextProvider";

checkVikeVersion()

const onRenderHtml: OnRenderHtmlAsync = async (
pageContext
): ReturnType<OnRenderHtmlAsync> => {
Expand Down Expand Up @@ -63,3 +65,13 @@ const onRenderHtml: OnRenderHtmlAsync = async (

return documentHtml;
};

function checkVikeVersion() {
if (version) {
const versionParts = version.split('.').map((s) => parseInt(s, 10)) as [number, number, number]
if (versionParts[0] > 0) return
if (versionParts[1] > 4) return
if (versionParts[2] >= 147) return
}
throw new Error('Update Vike to its latest version (or [email protected] and any version above)')
}

0 comments on commit a446524

Please sign in to comment.