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
54 changes: 54 additions & 0 deletions apps/web/components/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import type { ReactNode } from 'react'
import { Button, Link } from '@vercel/examples-ui'
import { SITE_NAME, SOURCE_URL } from '@/lib/site'

// The site's frame: a nav and a footer around every page. It replaces
// @vercel/examples-ui's Layout, whose nav carried the Vercel logo and a
// "Vercel Examples / …" trail and whose footer read "Created by ▲ Vercel".
// The shape and classes are that layout's, so the page looks the same; the
// repository link and the "Clone & Deploy" button both go to SOURCE_URL,
// which instantiating the site rewrites to the product's repository.
export default function Layout({ children }: { children: ReactNode }) {
return (
<div className="mx-auto h-screen flex flex-col">
<nav className="border-b border-gray-200 py-5 relative z-20 bg-background shadow-[0_0_15px_0_rgb(0,0,0,0.1)]">
<div className="flex items-center lg:px-6 px-8 mx-auto max-w-7xl px-14">
<div className="flex flex-row items-center">
<Link
href={SOURCE_URL}
className="font-medium text-accents-6 no-underline transition-colors duration-200 hover:text-accents-8"
target="_blank"
rel="noreferrer"
>
{SITE_NAME}
</Link>
</div>
<div className="flex-1 justify-end hidden md:flex">
<Button
Component="a"
href={SOURCE_URL}
target="_blank"
rel="noreferrer"
>
Clone &amp; Deploy
</Button>
</div>
</div>
</nav>
<div className="px-8 bg-accents-0">{children}</div>
<footer className="py-10 w-full mt-auto border-t flex items-center justify-center bg-accents-1 z-20">
<span className="text-primary">
Runs on Cloudflare Workers · built with{' '}
<a
href="https://orunbase.com"
target="_blank"
rel="noreferrer"
className="font-medium underline underline-offset-4"
>
Orunbase
</a>
</span>
</footer>
</div>
)
}
5 changes: 0 additions & 5 deletions apps/web/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ export default defineConfig([
...nextTs,
{
rules: {
// Rules eslint-config-next 16 brings that the template was not written
// against, turned off by name rather than rewriting upstream code:
// - `getLayout(Component)` in pages/_app.tsx builds the layout during
// render (the @vercel/examples-ui pattern).
"react-hooks/static-components": "off",
// worker.ts imports the generated `.open-next/worker.js` the way the
// OpenNext custom-worker howto does: `@ts-ignore` with a reason, because
// the file does not exist before the build and an `@ts-expect-error`
Expand Down
4 changes: 2 additions & 2 deletions apps/web/lib/site.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// The site's identity, written once. The page heading and its <title> read
// SITE_NAME; the layout's repository link and "Clone & Deploy" button go to
// SOURCE_URL. Instantiating the site under a new name rewrites both to that
// SITE_NAME; the layout's (components/layout.tsx) repository link and
// "Clone & Deploy" button go to SOURCE_URL. Instantiating the site under a new name rewrites both to that
// name and its repository, so keep them literal and on one line each.
export const SITE_NAME = "Cron Triggers on Cloudflare"
export const SOURCE_URL = "https://github.com/sourceplane/cron-starter"
Expand Down
22 changes: 6 additions & 16 deletions apps/web/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
import type { AppProps } from 'next/app'
import type { LayoutProps } from '@vercel/examples-ui/layout'
import Head from 'next/head'
import { CloudflareWebAnalytics } from '@/components/analytics'
import { SITE_NAME, SOURCE_URL } from '@/lib/site'
import Layout from '@/components/layout'
import { SITE_NAME } from '@/lib/site'

import { getLayout } from '@vercel/examples-ui'
import '@vercel/examples-ui/globals.css'

function App({ Component, pageProps }: AppProps) {
const Layout = getLayout<LayoutProps>(Component)

// The <title> is the site's name (lib/site.ts), and it and the description
// are rendered here rather than through the layout's `title`/`description`
// props: the layout's own <Head> does not reach the server-rendered page,
// and it would suffix the title with " - Vercel Examples".
// The <title> is the site's name (lib/site.ts). The frame is the site's
// own (components/layout.tsx): @vercel/examples-ui still supplies the
// styles and the text, code and link components, not the Vercel chrome.
return (
<Layout
deployButton={{
repositoryUrl: SOURCE_URL,
customDeployUrl: SOURCE_URL,
}}
path="solutions/cron"
>
<Layout>
<Head>
<title>{SITE_NAME}</title>
<meta
Expand Down
3 changes: 1 addition & 2 deletions apps/web/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { GetServerSideProps } from 'next'
import { Layout, Text, Code, Page, Link } from '@vercel/examples-ui'
import { Text, Code, Page, Link } from '@vercel/examples-ui'
import Post from '@/components/post'
import Head from 'next/head'
import { SITE_NAME, requestOrigin } from '@/lib/site'
Expand Down Expand Up @@ -123,4 +123,3 @@ export default function Home({ origin }: Props) {
)
}

Home.Layout = Layout
12 changes: 8 additions & 4 deletions specs/epics/cron-starter/IMPLEMENTATION-STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,16 @@ Example" and its description; the deploy button and repository link → this
repository; the OG/Twitter image `https://cron-template.vercel.app/thumbnail.png`
→ `/thumbnail.png` (the file ships in `public/`).

### `@vercel/examples-ui` 1.0.5 kept
### `@vercel/examples-ui` 1.0.5 kept, its Layout replaced

It installs and builds; its React peer range (17–18) against React 19 is
the same pairing upstream's own lockfile carries. Its nav still reads
"Vercel Examples / solutions / cron" and "More Examples →" links to
vercel/examples — the package's chrome, not the template's.
the same pairing upstream's own lockfile carries. Its styles and its text,
code, link and button components are kept. Its `Layout` is not: that nav
drew the Vercel logo, a "Vercel Examples / solutions / cron" trail and a
"More Examples →" link, and its footer read "Created by ▲ Vercel".
`components/layout.tsx` is the same frame with the site's name and
repository link in the nav, the "Clone & Deploy" button, and a footer
naming Cloudflare Workers and Orunbase.

### The Workers build: `next.config.mjs`, `open-next.config.ts`, tsconfig

Expand Down
2 changes: 1 addition & 1 deletion specs/epics/cron-starter/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Tailwind the styles.
| `KV_URL`, `KV_REST_API_URL`, `KV_REST_API_TOKEN`, … | No env vars: the binding's id is rendered into `wrangler.jsonc` from the `cloudflare-kv` root's wiring document |
| A KV store created in the dashboard | `infra/terraform/cloudflare-kv`: one namespace per environment, id and title published as the `WIRING_CLOUDFLARE_KV` secret |
| `@vercel/analytics` | `components/analytics.tsx`: the Cloudflare Web Analytics beacon, rendered when `NEXT_PUBLIC_CF_BEACON_TOKEN` is set at build |
| `@vercel/examples-ui` (layout, nav, text, code, link) | Kept: it is an npm package with no Vercel runtime dependency; its deploy button and repository link point at this repository |
| `@vercel/examples-ui` (layout, nav, text, code, link) | Styles, text, code, link and button kept: an npm package with no Vercel runtime dependency. Its layout, whose nav and footer showed Vercel's logo, is replaced by `components/layout.tsx`, whose repository link and deploy button point at this repository |
| Deploy on push | Orun: `apps/web/component.yaml` (`cloudflare-workers-assets-turbo`) renders the config for `$ORUN_ENVIRONMENT`, builds, and deploys `cron-starter-web-{stage,prod}` on merge to `main` once the product is linked; the trigger is part of the Worker's config, so each environment's Worker carries its own |

The seven schedules, side by side (identical five-field expressions, in
Expand Down
5 changes: 3 additions & 2 deletions specs/epics/cron-starter/risks-and-open-questions.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ The deploy lane renders the real id from the root's wiring document.
"Vercel Cron Jobs Example", the "Vercel Cron Jobs" and "Vercel KV" links,
the deploy button and the Vercel-hosted thumbnail URL read "Cron Triggers on
Cloudflare", link to Cloudflare's docs, point at this repository, and serve
the thumbnail from `public/`. Layout, styles and structure are untouched;
`@vercel/examples-ui`'s nav still shows its own "Vercel Examples" chrome.
the thumbnail from `public/`. Styles and structure are untouched;
`@vercel/examples-ui`'s Vercel nav and footer are replaced by the site's own
`components/layout.tsx`.

## CR-H — The deploy lane checked for a config only the build makes (RESOLVED in CR4)

Expand Down
Loading