diff --git a/apps/astro/.gitignore b/apps/astro/.gitignore new file mode 100644 index 0000000..16d54bb --- /dev/null +++ b/apps/astro/.gitignore @@ -0,0 +1,24 @@ +# build output +dist/ +# generated types +.astro/ + +# dependencies +node_modules/ + +# logs +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + + +# environment variables +.env +.env.production + +# macOS-specific files +.DS_Store + +# jetbrains setting folder +.idea/ diff --git a/apps/astro/README.md b/apps/astro/README.md new file mode 100644 index 0000000..2350e47 --- /dev/null +++ b/apps/astro/README.md @@ -0,0 +1,37 @@ +# Astro Demo application for Vercel Speed-insights + +## Setup + +This application was created with the following commands: + +- `cd apps` +- `pnpm create astro@latest astro` (answers: empty, no to all) +- `cd astro` +- manually edit package.json to add `"@vercel/analytics": "workspace:*"` dependency +- `pnpm i` + +Then we've added: + +1. a simple collection of Markdown blog posts in `src/contents/blog` folder +2. a blog post page in `src/pages/blog/[...slug].astro` +3. an index page in `src/pages/index.astro` which list all available blog posts +4. a layout in `src/components/Base.astro`, used in both page, which includes our Analytics.astro component: + +```astro +--- +import Analytics from '@vercel/analytics/astro'; +--- + + + + + + + + + +``` + +## Usage + +Start it with `pnpm -F nuxt dev` and browse to [http://localhost:4321](http://localhost:4321) diff --git a/apps/astro/astro.config.mjs b/apps/astro/astro.config.mjs new file mode 100644 index 0000000..882e651 --- /dev/null +++ b/apps/astro/astro.config.mjs @@ -0,0 +1,4 @@ +import { defineConfig } from 'astro/config'; + +// https://astro.build/config +export default defineConfig({}); diff --git a/apps/astro/package.json b/apps/astro/package.json new file mode 100644 index 0000000..90e0b83 --- /dev/null +++ b/apps/astro/package.json @@ -0,0 +1,22 @@ +{ + "name": "astro", + "version": "0.0.1", + "private": true, + "type": "module", + "scripts": { + "astro": "astro", + "build": "astro build", + "dev": "astro dev", + "preview": "astro preview", + "start": "astro dev" + }, + "dependencies": { + "@vercel/analytics": "workspace:*", + "astro": "latest" + }, + "devDependencies": { + "@astrojs/check": "^0.5.4", + "@vercel/analytics": "workspace:*", + "typescript": "^5.3.3" + } +} diff --git a/apps/astro/public/favicon.svg b/apps/astro/public/favicon.svg new file mode 100644 index 0000000..f157bd1 --- /dev/null +++ b/apps/astro/public/favicon.svg @@ -0,0 +1,9 @@ + + + + diff --git a/apps/astro/src/components/BaseHead.astro b/apps/astro/src/components/BaseHead.astro new file mode 100644 index 0000000..7bfda32 --- /dev/null +++ b/apps/astro/src/components/BaseHead.astro @@ -0,0 +1,4 @@ +--- +import Analytics from '@vercel/analytics/astro'; +--- + diff --git a/apps/astro/src/content/blog/bruno.md b/apps/astro/src/content/blog/bruno.md new file mode 100644 index 0000000..ca4b673 --- /dev/null +++ b/apps/astro/src/content/blog/bruno.md @@ -0,0 +1,6 @@ +--- +title: About Bruno +slug: bruno +--- + +We don't talk about Bruno diff --git a/apps/astro/src/content/blog/henry.md b/apps/astro/src/content/blog/henry.md new file mode 100644 index 0000000..d763c6c --- /dev/null +++ b/apps/astro/src/content/blog/henry.md @@ -0,0 +1,6 @@ +--- +title: About Henry +slug: henry +--- + +Henry is a gentleman diff --git a/apps/astro/src/env.d.ts b/apps/astro/src/env.d.ts new file mode 100644 index 0000000..e16c13c --- /dev/null +++ b/apps/astro/src/env.d.ts @@ -0,0 +1 @@ +/// diff --git a/apps/astro/src/layouts/Base.astro b/apps/astro/src/layouts/Base.astro new file mode 100644 index 0000000..c506df1 --- /dev/null +++ b/apps/astro/src/layouts/Base.astro @@ -0,0 +1,18 @@ +--- +import Analytics from '@vercel/analytics/astro'; + +const { title } = Astro.props; +--- + + + + + + + {title} + + + + + + diff --git a/apps/astro/src/pages/blog/[...slug].astro b/apps/astro/src/pages/blog/[...slug].astro new file mode 100644 index 0000000..0945e4e --- /dev/null +++ b/apps/astro/src/pages/blog/[...slug].astro @@ -0,0 +1,18 @@ +--- +import { getCollection } from 'astro:content'; +import Layout from '../../layouts/Base.astro'; + +export async function getStaticPaths() { + const blogEntries = await getCollection('blog'); + return blogEntries.map(entry => ({ + params: { slug: entry.slug }, props: { entry }, + })); +} + +const { entry } = Astro.props; +const { Content } = await entry.render(); +--- + + +

back

+
\ No newline at end of file diff --git a/apps/astro/src/pages/index.astro b/apps/astro/src/pages/index.astro new file mode 100644 index 0000000..ad3f2a9 --- /dev/null +++ b/apps/astro/src/pages/index.astro @@ -0,0 +1,16 @@ +--- +import { getCollection } from 'astro:content'; +import Layout from '../layouts/Base.astro'; + +const blogEntries = await getCollection('blog'); +--- + +

Welcome to Astro

+ +
diff --git a/apps/astro/tsconfig.json b/apps/astro/tsconfig.json new file mode 100644 index 0000000..e51e062 --- /dev/null +++ b/apps/astro/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "astro/tsconfigs/base", + "compilerOptions": { + "strictNullChecks": true + } +} diff --git a/apps/nextjs-15/src/app/blog/[slug]/page.tsx b/apps/nextjs-15/src/app/blog/[slug]/page.tsx new file mode 100644 index 0000000..4cd80c9 --- /dev/null +++ b/apps/nextjs-15/src/app/blog/[slug]/page.tsx @@ -0,0 +1,16 @@ +import Link from 'next/link'; + +export default async function BlogPage({ + params, +}: { + params: Promise<{ slug: string }>; +}) { + const { slug } = await params; + return ( +
+

{slug}

+ + Back to blog +
+ ); +} diff --git a/apps/nextjs-15/src/app/blog/layout.tsx b/apps/nextjs-15/src/app/blog/layout.tsx new file mode 100644 index 0000000..cb532b0 --- /dev/null +++ b/apps/nextjs-15/src/app/blog/layout.tsx @@ -0,0 +1,12 @@ +import Link from 'next/link'; + +export default function Layout({ children }: { children: React.ReactNode }) { + return ( +
+ My first blog post  + Feature just got released +
+
{children}
+
+ ); +} diff --git a/apps/nextjs-15/src/app/blog/page.tsx b/apps/nextjs-15/src/app/blog/page.tsx new file mode 100644 index 0000000..1278d9f --- /dev/null +++ b/apps/nextjs-15/src/app/blog/page.tsx @@ -0,0 +1,3 @@ +export default function Blog() { + return
Welcome to the blog
; +} diff --git a/apps/nextjs/app/blog/layout.tsx b/apps/nextjs/app/blog/layout.tsx index 3c9c95f..d123119 100644 --- a/apps/nextjs/app/blog/layout.tsx +++ b/apps/nextjs/app/blog/layout.tsx @@ -3,8 +3,9 @@ import Link from 'next/link'; export default function Layout({ children }: { children: React.ReactNode }) { return (
- My first blog post + My first blog post {' '} Feature just got released +
{children}
); diff --git a/apps/nextjs/app/blog/page.tsx b/apps/nextjs/app/blog/page.tsx index d0888e0..904127d 100644 --- a/apps/nextjs/app/blog/page.tsx +++ b/apps/nextjs/app/blog/page.tsx @@ -1,3 +1,3 @@ export default function Blog() { - return
Welcome on the blog
; + return
Welcome to the app-router blog
; } diff --git a/apps/nextjs/pages/blog-pages/[slug].tsx b/apps/nextjs/pages/blog-pages/[slug].tsx new file mode 100644 index 0000000..6fe3cd3 --- /dev/null +++ b/apps/nextjs/pages/blog-pages/[slug].tsx @@ -0,0 +1,7 @@ +export default function BlogPage() { + return ( +
+

Blog Page

+
+ ); +} diff --git a/apps/nextjs/pages/index.tsx b/apps/nextjs/pages/index.tsx index 67e0859..1d4526d 100644 --- a/apps/nextjs/pages/index.tsx +++ b/apps/nextjs/pages/index.tsx @@ -1,3 +1,20 @@ +import Link from 'next/link'; + export default function Page() { - return null; + return ( + <> +
Testing web analytics
+
    +
  • + Pages directory A +
  • +
  • + Pages directory B +
  • +
  • + App directory +
  • +
+ + ); } diff --git a/apps/nuxt/README.md b/apps/nuxt/README.md index 3c5cc99..8201ba3 100644 --- a/apps/nuxt/README.md +++ b/apps/nuxt/README.md @@ -8,7 +8,7 @@ This application was created with the following commands: - `pnpx nuxi@latest init nuxt` (answers: npm, no git) - `cd nuxt` - `rm -rf node_modules .nuxt` -- manually edit package.json to add `"@vercel/speed-insights": "workspace:*"` dependency +- manually edit package.json to add `"@vercel/analytics": "workspace:*"` dependency - `pnpm i` Then we moved some code from vue's official template (styles, HelloWorld SFC) and added a few dynamic route to illustrate the use. diff --git a/apps/nuxt/layouts/default.vue b/apps/nuxt/layouts/default.vue index d18ab4d..af7337b 100644 --- a/apps/nuxt/layouts/default.vue +++ b/apps/nuxt/layouts/default.vue @@ -1,5 +1,5 @@