Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Unit tests
run: pnpm test.unit

# the website imports the library built above, as Deno Deploy builds it
# the website imports the library built above, as Vercel builds it
- name: Website (types and build)
run: pnpm -C website build.types && pnpm -C website build.client && pnpm -C website build.server

Expand Down
6 changes: 5 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,15 @@ bite in this repo:
## Docs site

The docs live in `website/` (Qwik Router, built as static pages): `pnpm -C website dev` runs it, and
`pnpm build.website` builds the library and the site as Deno Deploy does. The props, data attributes,
`pnpm build.website` builds the library and the site as Vercel does. The props, data attributes,
headless parts and `useCalendar()` fields are data in `website/src/data/`: the pages, the search and
`llms-full.txt` read them. After changing them, or the use cases in `website/scripts/llms-full.md`,
run `pnpm -C website llms` to write `website/public/llms-full.txt` again.

Vercel builds it on every push (`vercel.json`). pnpm's version is the one in `package.json`'s
`packageManager`, for Vercel, the CI and your installs alike: to update it, change that line and run
`pnpm install`, which records it in the lockfile.

## Before opening a pull request

```sh
Expand Down
11 changes: 0 additions & 11 deletions deno.json

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"engines": {
"node": "^20.19.0 || >=22.12.0"
},
"packageManager": "pnpm@12.15.0",
"packageManager": "pnpm@12.16.1",
"private": false,
"type": "module",
"scripts": {
Expand Down
122 changes: 61 additions & 61 deletions pnpm-lock.yaml

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

17 changes: 17 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"framework": null,
"buildCommand": "pnpm build.website",
"outputDirectory": "website/dist",
"trailingSlash": true,
"headers": [
{
"source": "/build/(.*)",
"headers": [{ "key": "Cache-Control", "value": "public, max-age=31536000, immutable" }]
},
{
"source": "/assets/(.*)",
"headers": [{ "key": "Cache-Control", "value": "public, max-age=31536000, immutable" }]
}
]
}
43 changes: 22 additions & 21 deletions website/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# qwik-date website

Demo and docs site for `qwik-date`, built with Qwik v2 + [Qwik Router](https://qwik.dev/docs/) and
deployed to [Deno Deploy](https://docs.deno.com/deploy/) at <https://qwik-date.dieco.dev>.
deployed to [Vercel](https://vercel.com/docs) at <https://qwik-date.dieco.dev>.

It consumes the library through `workspace:*`, i.e. from the built `lib/` folder at the repo root,
so **build the library first** (`pnpm build.types && pnpm build.lib` from the root).
Expand All @@ -12,32 +12,33 @@ so **build the library first** (`pnpm build.types && pnpm build.lib` from the ro
pnpm dev # dev server (SSR)
pnpm build.types # typecheck
pnpm build.client # client build -> dist/
pnpm build.server # Deno server build -> server/, and prerenders every route into dist/ (SSG)
pnpm serve # runs the production build locally with Deno (needs build.client + build.server)
pnpm build.server # prerenders every route into dist/ (SSG)
pnpm preview # production build served locally by Vite
```

From the repo root, `pnpm build.website` runs the whole chain (library + client + server/SSG).

## Deployment (Deno Deploy)
## Deployment (Vercel)

The site is fully prerendered, so it runs as a **static** app on the new Deno Deploy
(console.deno.com). There is no GitHub Actions workflow: Deno Deploy's GitHub integration builds
every push to `main` on its own servers.
The site is fully prerendered, so Vercel serves `dist/` as static files: no functions. Its GitHub
integration builds every push (production for `main`, a preview for the other branches); there is no
GitHub Actions workflow for it.

The build settings live in [`deno.json`](../deno.json) at the repo root, under the `deploy` key.
When that key is present, Deno Deploy takes the configuration from the file and ignores the build
settings in the dashboard:
The build settings live in [`vercel.json`](../vercel.json) at the repo root:

| Setting | Value |
| --------------- | ------------------------------------ |
| App directory | repo root (the default) |
| Install command | `pnpm install --no-frozen-lockfile` |
| Build command | `pnpm build.website` |
| Runtime | Static, directory `./website/dist` |
| Setting | Value |
| ---------------- | ------------------------------------------------------------- |
| Root directory | repo root (the default): the build needs the library |
| Framework preset | none (`"framework": null`) |
| Install command | the default: `pnpm install` |
| Build command | `pnpm build.website` |
| Output directory | `website/dist` |

One-time setup in the dashboard: create an app, link it to the `diecodev/qwik-date` GitHub repo,
leave the app directory as the repo root, and add the custom domain `qwik-date.dieco.dev`.
Both run the pnpm of `package.json`'s `packageManager`: Vercel reads it and picks pnpm 12 (without it,
it would pick pnpm 10 for this lockfile), which then switches to that exact version.

To use SSR instead of static files, change `deploy.runtime` in `deno.json` to
`{ "type": "dynamic", "entrypoint": "./website/server/entry.deno.js" }` (`src/entry.deno.ts` is
that server). Change it in the file, not in the dashboard: the file takes precedence.
`trailingSlash` matches the URLs of the pages (`/calendar/`), `404.html` answers the missing ones, and
`/build/` and `/assets/` (hashed file names) are cached for a year.

One-time setup in the dashboard: import the `diecodev/qwik-date` repo, keep the root directory as the
repo root, and add the custom domain `qwik-date.dieco.dev` (a `CNAME` to Vercel at the DNS provider).
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
import { denoServerAdapter } from "@qwik.dev/router/adapters/deno-server/vite";
import { ssgAdapter } from "@qwik.dev/router/adapters/ssg/vite";
import { extendConfig } from "@qwik.dev/router/vite";
import baseConfig from "../../vite.config";

// every route prerendered into dist/: Vercel serves it as static files
export default extendConfig(baseConfig, () => {
return {
build: {
ssr: true,
rolldownOptions: {
input: ["src/entry.deno.ts"],
input: ["@qwik-router-config"],
},
minify: false,
},
plugins: [
denoServerAdapter({
ssg: {
include: ["/*"],
origin: "https://qwik-date.dieco.dev",
},
ssgAdapter({
origin: "https://qwik-date.dieco.dev",
}),
],
};
Expand Down
3 changes: 1 addition & 2 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"build": "qwik build",
"build.client": "vite build",
"build.preview": "vite build --ssr src/entry.preview.tsx",
"build.server": "vite build -c adapters/deno/vite.config.ts",
"build.server": "vite build -c adapters/ssg/vite.config.ts",
"build.types": "tsc --incremental --noEmit",
"dev": "vite --mode ssr",
"dev.debug": "node --inspect-brk ./node_modules/vite/bin/vite.js --mode ssr --force",
Expand All @@ -24,7 +24,6 @@
"lint": "biome check --write --unsafe",
"llms": "node scripts/llms-full.ts",
"preview": "qwik build preview && vite preview --open",
"serve": "deno run --allow-net --allow-read --allow-env server/entry.deno.js",
"start": "vite --open --mode ssr",
"qwik": "qwik"
},
Expand Down
Loading
Loading