Skip to content

Commit 5591b2e

Browse files
committed
SSR
1 parent 0baafb3 commit 5591b2e

File tree

10 files changed

+34
-20
lines changed

10 files changed

+34
-20
lines changed

.github/workflows/firebase-hosting-merge.yml

+2
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ jobs:
1818
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NICEE_LIB }}'
1919
channelId: live
2020
projectId: nicee-lib
21+
env:
22+
FIREBASE_CLI_EXPERIMENTS: webframeworks

.github/workflows/firebase-hosting-pull-request.yml

+2
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ jobs:
1515
repoToken: '${{ secrets.GITHUB_TOKEN }}'
1616
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NICEE_LIB }}'
1717
projectId: nicee-lib
18+
env:
19+
FIREBASE_CLI_EXPERIMENTS: webframeworks

firebase.json

+3-12
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
{
22
"hosting": {
3-
"public": "src/example/dist",
4-
"ignore": [
5-
"firebase.json",
6-
"**/.*",
7-
"**/node_modules/**"
8-
],
9-
"rewrites": [
10-
{
11-
"source": "**",
12-
"destination": "/index.html"
13-
}
14-
]
3+
"source": "src/example",
4+
"cleanUrls": true,
5+
"trailingSlash": false
156
}
167
}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"scripts": {
1313
"dev": "cd src/example && yarn dev",
1414
"build:example": "cd src/example && yarn build",
15+
"serve": "firebase emulators:start",
1516
"make": "yarn make:types && yarn make:lib:cjs && yarn make:lib:esm",
1617
"make:types": "tsc --project ./tsconfig.out.json",
1718
"make:lib:cjs": "esbuild ./src/nice/index.ts --bundle --minify --outfile=out/index.cjs --format=cjs",

src/example/astro.config.mjs

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import node from "@astrojs/node";
55

66
// https://astro.build/config
77
export default defineConfig({
8-
// output: 'server',
9-
// devToolbar: {
10-
// enabled: false
11-
// },
12-
// integrations: [critters()],
8+
output: 'server',
9+
devToolbar: {
10+
enabled: false
11+
},
12+
integrations: [critters()],
1313
adapter: node({
1414
mode: "middleware"
1515
})

src/example/src/app.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { app as niceApp, store } from "../../nice";
2-
import { Blog } from "./pages/blog";
3-
import { Home } from "./pages/home";
2+
import { Blog } from "./app/blog";
3+
import { Error } from "./app/error";
4+
import { Home } from "./app/home";
45

56
export const globalStore = store({
67
appName: 'haydn',
@@ -16,7 +17,7 @@ export default (path?: string) => {
1617

1718
switch (trimmedPath) {
1819
default:
19-
return Home();
20+
return Error();
2021
case '':
2122
return Home();
2223
case 'blog':
File renamed without changes.

src/example/src/app/error.ts

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { render } from "../../../nice";
2+
import { Navigation } from "../components/nav";
3+
import { ThemeWidget } from "../components/theme-widget";
4+
import { CalloutSection } from "../sections/callout";
5+
import { Footer } from "../sections/footer";
6+
7+
8+
export const Error = () => render`
9+
<main>
10+
${ThemeWidget()}
11+
${Navigation()}
12+
13+
${CalloutSection({ header: 'Something went wrong.' })}
14+
15+
${Footer()}
16+
</main>
17+
`;
File renamed without changes.

0 commit comments

Comments
 (0)