Skip to content

Commit

Permalink
feat: integrate vercel analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
ntnyq committed Feb 6, 2025
1 parent b01fc3e commit da9248d
Show file tree
Hide file tree
Showing 8 changed files with 429 additions and 356 deletions.
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"eslint.validate": [
"vue",
"yaml",
"html",
"json",
"jsonc",
"json5",
Expand Down
7 changes: 6 additions & 1 deletion app.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
<script lang="ts" setup>
import { Analytics } from '@vercel/analytics/nuxt'
</script>

<template>
<Suspense>
<main class="flex flex-col lg:h-screen">
<NuxtLayout />
<Analytics />
<NuxtPwaManifest />
</main>

<template #fallback>
<div class="h-screen flex flex-center gap-1 text-3xl font-bold">
<div class="h-screen flex flex-center gap-1 text-3xl font-medium">
<div class="i-ri:loader-4-fill animate-spin" />
Loading...
</div>
Expand Down
2 changes: 2 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
"Hubot",
"iconify",
"nuxt",
"nuxtjs",
"shiki",
"unocss",
"vercel",
"vitesse",
"vueuse",
"weapp"
Expand Down
4 changes: 2 additions & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// @ts-check

import { defineESLintConfig } from '@ntnyq/eslint-config'
import nuxt from './.nuxt/eslint.config.mjs'
import withNuxt from './.nuxt/eslint.config.mjs'

const configs = await defineESLintConfig({
svgo: true,
})

export default nuxt(configs)
export default withNuxt(configs)
31 changes: 25 additions & 6 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { META } from './composables/constants'

export default defineNuxtConfig({
compatibilityDate: '2025-01-10',
compatibilityDate: '2025-02-06',

css: ['@unocss/reset/tailwind.css', '~/styles/vars.css', '~/styles/index.css'],

Expand Down Expand Up @@ -40,8 +40,25 @@ export default defineNuxtConfig({
},

nitro: {
prerender: {
routes: ['/'],
preset: 'static',
esbuild: {
options: {
target: 'esnext',
},
},
routeRules: {
'/': {
prerender: true,
},
'/*': {
prerender: false,
},
'/200.html': {
prerender: true,
},
'/404.html': {
prerender: true,
},
},
},

Expand All @@ -65,7 +82,7 @@ export default defineNuxtConfig({
},

devtools: {
enabled: true,
enabled: false,
},

eslint: {
Expand All @@ -75,9 +92,11 @@ export default defineNuxtConfig({
},

experimental: {
// should be disabled when `ssr: false`
appManifest: true,
appManifest: false,
clientNodeCompat: true,
payloadExtraction: false,
renderJsonPayloads: true,
typedPages: true,
},

future: {
Expand Down
22 changes: 16 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@
"type": "module",
"version": "0.0.0",
"private": true,
"packageManager": "[email protected].0",
"packageManager": "[email protected].1",
"description": "ntnyq.com",
"keywords": [],
"author": {
"name": "ntnyq",
"email": "[email protected]",
"url": "https://ntnyq.com"
},
"repository": "ntnyq/ntnyq.com",
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
Expand All @@ -15,13 +21,14 @@
"postinstall": "nuxt prepare",
"prepare": "husky",
"preview": "nuxt preview",
"release": "bumpp && pnpm publish",
"release": "bumpp",
"typecheck": "nuxt typecheck"
},
"dependencies": {
"@nuxt/content": "^3.1.0",
"@nuxt/image": "^1.9.0",
"@unocss/nuxt": "^65.4.3",
"@vercel/analytics": "^1.4.1",
"@vite-pwa/nuxt": "^0.10.6",
"@vueuse/nuxt": "^12.5.0",
"floating-vue": "^5.2.2",
Expand All @@ -40,7 +47,7 @@
"@nuxt/eslint": "^1.0.0",
"@types/prompts": "^2.4.9",
"@unocss/reset": "^65.4.3",
"bumpp": "^10.0.1",
"bumpp": "^10.0.2",
"consola": "^3.4.0",
"eslint": "^9.19.0",
"husky": "^9.1.7",
Expand All @@ -56,11 +63,14 @@
},
"pnpm": {
"onlyBuiltDependencies": [
"better-sqlite3"
"better-sqlite3",
"@parcel/watcher",
"esbuild",
"sharp"
]
},
"nano-staged": {
"*.{js,ts,mjs,cjs,vue,html,svg,json,md,yml,yaml}": "eslint --fix",
"*.{css,scss}": "prettier -uw"
"*.{js,ts,mjs,cjs,vue,svg,json,md,yml,yaml}": "eslint --fix",
"*.{css,scss,html}": "prettier -uw"
}
}
Loading

0 comments on commit da9248d

Please sign in to comment.