diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1909f09..3127ffb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dedc39e..5addd37 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 diff --git a/deno.json b/deno.json deleted file mode 100644 index 14c0a25..0000000 --- a/deno.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "lock": false, - "deploy": { - "install": "pnpm install --no-frozen-lockfile", - "build": "pnpm build.website", - "runtime": { - "type": "static", - "cwd": "./website/dist" - } - } -} diff --git a/package.json b/package.json index 877d16d..b42fa2d 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 11480f8..1aee3ad 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7,153 +7,153 @@ importers: configDependencies: {} packageManagerDependencies: pnpm: - specifier: 12.15.0 - version: 12.15.0 + specifier: 12.16.1 + version: 12.16.1 packages: - '@pnpm/exe.android-arm64@12.15.0': - resolution: {integrity: sha512-eVCqmscY70LGvgRzu3mi8IBWBFGix+a6mNZoWmXxESsBdeiKEF9xQSuaeel10yn+zI7TXy2jlI63vFLzETk+aQ==} + '@pnpm/exe.android-arm64@12.16.1': + resolution: {integrity: sha512-PKf78Ew+i0CBYf0Xc+eMcqQiqyBT+u8XCVg1F5roc98/6wWfdYlWhrUMmEBiKWaJ3JqHxrtt8l1NwZ7qfJt2/Q==} cpu: [arm64] os: [android] - '@pnpm/exe.android-x64@12.15.0': - resolution: {integrity: sha512-Gx/WbkFcdUFUg8g8AShezcS9EiQxfYvdAm2hfKLO8sfJmJvKOCt5fzlgHWDzmGhoclibgW+tUGZ/KF4F4wOTCA==} + '@pnpm/exe.android-x64@12.16.1': + resolution: {integrity: sha512-xdu7gMbB98pdvhwMeA6612Of515FDlRUtfA/1f7nWPZfPLnEdSRBO2u+1N0XBtQ/ennhPH/lrxB1gC6gnR/cdg==} cpu: [x64] os: [android] - '@pnpm/exe.darwin-arm64@12.15.0': - resolution: {integrity: sha512-N0ZykiDWCvqSBJvt71j7cSoBR993FqvYZFtmpCtqvW3pguiI+NAgraLPA5OTwu5mV+/d8hYpVcPktJA3xFDLtA==} + '@pnpm/exe.darwin-arm64@12.16.1': + resolution: {integrity: sha512-pVbmIIbhixiLvADLu1WA3TaW8FZy/D72R1De27WbbFx8/2mxvnsTyFVm4fO9kjpjMY7RzJd48CiQ96p8fO3ebQ==} cpu: [arm64] os: [darwin] - '@pnpm/exe.darwin-x64@12.15.0': - resolution: {integrity: sha512-7Ntr2HlBUxzwWOg7NwDxCbRW/3vXuqKO+hcXm+w3SBi9rrHY53li1wLqWVT7Gjxd+lVEHM1QJZo6WJEGFU8C6A==} + '@pnpm/exe.darwin-x64@12.16.1': + resolution: {integrity: sha512-xZvQBFqcZjO7vFKTK3XsJpqY6lnBL9EWSLCzVUPq3kZ94+D96gwJCa76xxGNK8Cj32f4eeM91Qg+yNRR4sRpDw==} cpu: [x64] os: [darwin] - '@pnpm/exe.freebsd-x64@12.15.0': - resolution: {integrity: sha512-btOiyL7fL7W4uQGH0aqFai2TNC3IoKcZ7gNHBVbEFZt2dWrnrD0SufL3iGs3fLlmb4OtuU35uf4Zpr9V9Jh9mA==} + '@pnpm/exe.freebsd-x64@12.16.1': + resolution: {integrity: sha512-zTtunfi9mBhRXiXEJYfwiJj0tk7MgTSfqDSRh+Az9FZ9THazVIiQiVNS8jpcsftDOqu7LKNffQdjmgwHDThfUg==} cpu: [x64] os: [freebsd] - '@pnpm/exe.linux-arm64-musl@12.15.0': - resolution: {integrity: sha512-pNC38k+O+90FOjbPNSnw0E7apq1PKTmz3fFe1amn+lys/U5kL++uzir8bRiho8ONcyA3d9EU7wdqcY0DKkj+JA==} + '@pnpm/exe.linux-arm64-musl@12.16.1': + resolution: {integrity: sha512-BJ3mOmcmQgcUo92Ee/WfEOt1pRiv3y2MMAkhEiYHd85UiPpHTfFhv+SpCbALmfExzXk3UlaRtMYwHlkQymc4VA==} cpu: [arm64] os: [linux] libc: [musl] - '@pnpm/exe.linux-arm64@12.15.0': - resolution: {integrity: sha512-qML/8aCXslh8td/w4U+HJNqUcZ2+m6EfTbWScIzZRmyPsRFN+xB4LP1U/hymxc1iSJiKtG56HJx2fvUErWFIGw==} + '@pnpm/exe.linux-arm64@12.16.1': + resolution: {integrity: sha512-JaRd5gNxwdNGBBkrZFt8bknrK4YmHVJBW0JMhUQ0fJ0dEYp6C2GT9ExaCqOO8EwYEyqM+jpKgJIK+8WFaJy3ew==} cpu: [arm64] os: [linux] libc: [glibc] - '@pnpm/exe.linux-ppc64@12.15.0': - resolution: {integrity: sha512-tjRDUUl7RCJ6T/6eoNPxOqkwU4Mzi5RtTXmSAxujyz37OTwwsMU7Ps087Zk4gHcUvRSeyF40ZFsew3vtE+nmUA==} + '@pnpm/exe.linux-ppc64@12.16.1': + resolution: {integrity: sha512-FnSV0Jv40S1cMv7vFNWwvu0X567Lec4L4HCRead3CFcD6zQDNbGw81s8N5bcKPahtPD9ApVuhsbmFCx4rw6RMw==} cpu: [ppc64] os: [linux] libc: [glibc] - '@pnpm/exe.linux-riscv64@12.15.0': - resolution: {integrity: sha512-bF1uBWEfbwaeryz6lIiaJ8AWD082otZfvzGX5l+6LZRpRwUEpJHUsJrORaYP5/cNMv5ZR2p6TvvcJcQzwtDzmw==} + '@pnpm/exe.linux-riscv64@12.16.1': + resolution: {integrity: sha512-C1Sww4FN5IttD4atRRhAKmQtSGWVp04ZAKNxO8pfu2bkRPwOW+7v+2DH1Xs1W+kZYYpO86BYDvUcadefF+AgaQ==} cpu: [riscv64] os: [linux] libc: [glibc] - '@pnpm/exe.linux-s390x@12.15.0': - resolution: {integrity: sha512-zKMhIzsexYMToeLmqV5jPsvV/f9vwsJb2kUH2NFYzalbxImeBrlA4kL7GwF8gD4pagV6jYYcJb8RjbZIdjHptg==} + '@pnpm/exe.linux-s390x@12.16.1': + resolution: {integrity: sha512-kn2fautsTcxIMODoovQVqZyfpDRdNgGkoeVqNdrKqbeBBvrEl+fXLkmZiq5xDht1LMr4sYiCNcsMfNMT6JPFmg==} cpu: [s390x] os: [linux] libc: [glibc] - '@pnpm/exe.linux-x64-musl@12.15.0': - resolution: {integrity: sha512-A9J0Jg0Rdx+qQU4qXtwyST5tto9IOu1zi4fDk35nbc6DWahggbcKtFvZPKFwL2qgUXGXOX//hXv6z/sp6emO8A==} + '@pnpm/exe.linux-x64-musl@12.16.1': + resolution: {integrity: sha512-PM6ccHCOe/O9SsTflTJTYWfwogJZa6EmUvpnwZgiPguJBddh20wDQKgxUPXf48rDsPm9vMsIij0uHswwwbXL8g==} cpu: [x64] os: [linux] libc: [musl] - '@pnpm/exe.linux-x64@12.15.0': - resolution: {integrity: sha512-yc+QlZR+9+nr29J4fRzhMoapgxTBDndq/+peyoq1XUufnQFnfbXUMFudDIKzHi545linGqmOmXfn0NoufNgcOg==} + '@pnpm/exe.linux-x64@12.16.1': + resolution: {integrity: sha512-RK//8ZLcXGW8A2k8bQOXZDBN1Qu92zN4dYnG1bzj1zoQ1fkZ6jNzZ1AvXtsfGVma795CJtvoaF5bLXf4l/FIUw==} cpu: [x64] os: [linux] libc: [glibc] - '@pnpm/exe.win32-arm64@12.15.0': - resolution: {integrity: sha512-fPXZxuY1VclkOga9bc53qNCXcegfeoBR8+Ue+AospDwKzuGGSHll0oDxkLfkmpjyRqpe7bH5DyQPYp/xSMaIVA==} + '@pnpm/exe.win32-arm64@12.16.1': + resolution: {integrity: sha512-Ox3kNNVxtGw6pK7SVejmeOUgHhUTZgAM7NQQ6cU7frPw3ix9+j7d2MGbRg3fyEFAaKWq8ZAZLTQGcDyLnAu+qA==} cpu: [arm64] os: [win32] - '@pnpm/exe.win32-x64@12.15.0': - resolution: {integrity: sha512-nrd+Tp1We1DGj4DGG5Bea9lZNh9y1PjlLBdEwdInS4D0h0UIDtM7JaGGGDJhNzIwcHASyihWI7HLV+dtG+fhYg==} + '@pnpm/exe.win32-x64@12.16.1': + resolution: {integrity: sha512-k+FhRJ0ttphFoFIVB1Sk4v76YJAulafmA/Ly57cysesUhhIzVlApeOShUz0jXubKx317TThlEfpQrukldnqORA==} cpu: [x64] os: [win32] - pnpm@12.15.0: - resolution: {integrity: sha512-s5UdbW/0qfE9x89WzSjSuOs328ycaOUuHhGRhz6p+CoBcoerULqtxczElPA2xnwOR+sTYIwvo29HcRth6hKOYQ==} + pnpm@12.16.1: + resolution: {integrity: sha512-CR0d7nknV1Zhsl2rPCrjHK/BxU1rce1qZgDPDByxBDSkR+rhQBXxsj4ua+3u1535SpMuIWTSgyKA3OP7MvZW0Q==} engines: {node: '>=18'} hasBin: true snapshots: - '@pnpm/exe.android-arm64@12.15.0': + '@pnpm/exe.android-arm64@12.16.1': optional: true - '@pnpm/exe.android-x64@12.15.0': + '@pnpm/exe.android-x64@12.16.1': optional: true - '@pnpm/exe.darwin-arm64@12.15.0': + '@pnpm/exe.darwin-arm64@12.16.1': optional: true - '@pnpm/exe.darwin-x64@12.15.0': + '@pnpm/exe.darwin-x64@12.16.1': optional: true - '@pnpm/exe.freebsd-x64@12.15.0': + '@pnpm/exe.freebsd-x64@12.16.1': optional: true - '@pnpm/exe.linux-arm64-musl@12.15.0': + '@pnpm/exe.linux-arm64-musl@12.16.1': optional: true - '@pnpm/exe.linux-arm64@12.15.0': + '@pnpm/exe.linux-arm64@12.16.1': optional: true - '@pnpm/exe.linux-ppc64@12.15.0': + '@pnpm/exe.linux-ppc64@12.16.1': optional: true - '@pnpm/exe.linux-riscv64@12.15.0': + '@pnpm/exe.linux-riscv64@12.16.1': optional: true - '@pnpm/exe.linux-s390x@12.15.0': + '@pnpm/exe.linux-s390x@12.16.1': optional: true - '@pnpm/exe.linux-x64-musl@12.15.0': + '@pnpm/exe.linux-x64-musl@12.16.1': optional: true - '@pnpm/exe.linux-x64@12.15.0': + '@pnpm/exe.linux-x64@12.16.1': optional: true - '@pnpm/exe.win32-arm64@12.15.0': + '@pnpm/exe.win32-arm64@12.16.1': optional: true - '@pnpm/exe.win32-x64@12.15.0': + '@pnpm/exe.win32-x64@12.16.1': optional: true - pnpm@12.15.0: + pnpm@12.16.1: optionalDependencies: - '@pnpm/exe.android-arm64': 12.15.0 - '@pnpm/exe.android-x64': 12.15.0 - '@pnpm/exe.darwin-arm64': 12.15.0 - '@pnpm/exe.darwin-x64': 12.15.0 - '@pnpm/exe.freebsd-x64': 12.15.0 - '@pnpm/exe.linux-arm64': 12.15.0 - '@pnpm/exe.linux-arm64-musl': 12.15.0 - '@pnpm/exe.linux-ppc64': 12.15.0 - '@pnpm/exe.linux-riscv64': 12.15.0 - '@pnpm/exe.linux-s390x': 12.15.0 - '@pnpm/exe.linux-x64': 12.15.0 - '@pnpm/exe.linux-x64-musl': 12.15.0 - '@pnpm/exe.win32-arm64': 12.15.0 - '@pnpm/exe.win32-x64': 12.15.0 + '@pnpm/exe.android-arm64': 12.16.1 + '@pnpm/exe.android-x64': 12.16.1 + '@pnpm/exe.darwin-arm64': 12.16.1 + '@pnpm/exe.darwin-x64': 12.16.1 + '@pnpm/exe.freebsd-x64': 12.16.1 + '@pnpm/exe.linux-arm64': 12.16.1 + '@pnpm/exe.linux-arm64-musl': 12.16.1 + '@pnpm/exe.linux-ppc64': 12.16.1 + '@pnpm/exe.linux-riscv64': 12.16.1 + '@pnpm/exe.linux-s390x': 12.16.1 + '@pnpm/exe.linux-x64': 12.16.1 + '@pnpm/exe.linux-x64-musl': 12.16.1 + '@pnpm/exe.win32-arm64': 12.16.1 + '@pnpm/exe.win32-x64': 12.16.1 --- lockfileVersion: '9.0' diff --git a/vercel.json b/vercel.json new file mode 100644 index 0000000..ad71ea7 --- /dev/null +++ b/vercel.json @@ -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" }] + } + ] +} diff --git a/website/README.md b/website/README.md index 7e196fa..7c25fbb 100644 --- a/website/README.md +++ b/website/README.md @@ -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 . +deployed to [Vercel](https://vercel.com/docs) at . 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). @@ -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). diff --git a/website/adapters/deno/vite.config.ts b/website/adapters/ssg/vite.config.ts similarity index 50% rename from website/adapters/deno/vite.config.ts rename to website/adapters/ssg/vite.config.ts index 0c727cd..a78d482 100644 --- a/website/adapters/deno/vite.config.ts +++ b/website/adapters/ssg/vite.config.ts @@ -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", }), ], }; diff --git a/website/package.json b/website/package.json index 5f8834d..eaa6443 100644 --- a/website/package.json +++ b/website/package.json @@ -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", @@ -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" }, diff --git a/website/src/entry.deno.ts b/website/src/entry.deno.ts deleted file mode 100644 index 82752dc..0000000 --- a/website/src/entry.deno.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * WHAT IS THIS FILE? - * - * It's the entry point for the Deno HTTP server when building for production. - * - * Deno Deploy serves the prerendered `dist/` folder as a static app (see - * `deno.json` at the repo root), so this server is only needed to run the - * production build locally (`pnpm serve`) or to switch the app to the - * "Dynamic" runtime in the Deno Deploy dashboard. - * - * Learn more about the Deno integration here: - * - https://qwik.dev/docs/deployments/deno/ - * - https://docs.deno.com/runtime/tutorials/http_server - * - */ -import { createQwikRouter } from "@qwik.dev/router/middleware/deno"; -import render from "./entry.ssr"; - -// Create the Qwik Router Deno middleware -const { router, staticFile } = createQwikRouter({ - render, - static: { - cacheControl: "public, max-age=31536000, immutable", - }, -}); - -// Allow for dynamic port -const port = Number(Deno.env.get("PORT") ?? 3009); - -/* eslint-disable */ -console.log(`Server starter: http://localhost:${port}/`); - -Deno.serve({ port }, async (request: Request, info: any) => { - const staticResponse = await staticFile(request); - if (staticResponse) { - return staticResponse; - } - - // Server-side render this request with Qwik Router - return (await router(request, info))!; -}); - -declare const Deno: any;