From 762c5ebba1a052be419e3f6bf8872a44920bec49 Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Tue, 21 Nov 2023 17:08:13 +0100 Subject: [PATCH] docs: add releases page (#1004) --- docs/app.vue | 3 +- docs/components/releases/ReleasesItem.vue | 52 +++++++++ docs/content/releases.yml | 10 ++ docs/error.vue | 3 +- docs/nuxt.config.ts | 4 +- docs/package.json | 2 + docs/pages/playground.vue | 1 + docs/pages/releases.vue | 125 ++++++++++++++++++++++ docs/pages/roadmap.vue | 1 + docs/server/api/pulls.json.get.ts | 23 ++++ docs/server/api/releases.json.get.ts | 18 ++++ pnpm-lock.yaml | 111 +++++++++++++++++++ 12 files changed, 348 insertions(+), 5 deletions(-) create mode 100644 docs/components/releases/ReleasesItem.vue create mode 100644 docs/content/releases.yml create mode 100644 docs/pages/releases.vue create mode 100644 docs/server/api/pulls.json.get.ts create mode 100644 docs/server/api/releases.json.get.ts diff --git a/docs/app.vue b/docs/app.vue index 028a5ed720..c47a6e2183 100644 --- a/docs/app.vue +++ b/docs/app.vue @@ -98,8 +98,7 @@ const links = computed(() => { }, { label: 'Releases', icon: 'i-heroicons-rocket-launch', - to: 'https://github.com/nuxt/ui/releases', - target: '_blank' + to: '/releases' }].filter(Boolean) }) diff --git a/docs/components/releases/ReleasesItem.vue b/docs/components/releases/ReleasesItem.vue new file mode 100644 index 0000000000..3c08da86d4 --- /dev/null +++ b/docs/components/releases/ReleasesItem.vue @@ -0,0 +1,52 @@ + + + diff --git a/docs/content/releases.yml b/docs/content/releases.yml new file mode 100644 index 0000000000..45f3b29b9c --- /dev/null +++ b/docs/content/releases.yml @@ -0,0 +1,10 @@ +navigation: false +title: Releases +description: Follow the latest releases and updates of Nuxt UI. +links: + - label: View on GitHub + icon: i-simple-icons-github + to: https://github.com/nuxt/ui/releases + target: _blank + size: md + color: white diff --git a/docs/error.vue b/docs/error.vue index f1f7bf409b..a7e3ce3d6d 100644 --- a/docs/error.vue +++ b/docs/error.vue @@ -89,8 +89,7 @@ const links = computed(() => { }, { label: 'Releases', icon: 'i-heroicons-rocket-launch', - to: 'https://github.com/nuxt/ui/releases', - target: '_blank' + to: '/releases' }].filter(Boolean) }) diff --git a/docs/nuxt.config.ts b/docs/nuxt.config.ts index 7715004d59..09b1909c36 100644 --- a/docs/nuxt.config.ts +++ b/docs/nuxt.config.ts @@ -83,7 +83,9 @@ export default defineNuxtConfig({ '/', '/getting-started', '/dev/getting-started', - '/api/search.json' + '/api/search.json', + '/api/releases.json', + '/api/pulls.json' ] } }, diff --git a/docs/package.json b/docs/package.json index fba4b7e961..cf77c7aabe 100644 --- a/docs/package.json +++ b/docs/package.json @@ -16,7 +16,9 @@ "@nuxtjs/google-fonts": "^3.0.2", "@nuxtjs/mdc": "^0.2.6", "@nuxtjs/plausible": "^0.2.3", + "@octokit/rest": "^20.0.2", "@vueuse/nuxt": "^10.5.0", + "date-fns": "^2.30.0", "eslint": "^8.52.0", "joi": "^17.11.0", "nuxt": "^3.8.0", diff --git a/docs/pages/playground.vue b/docs/pages/playground.vue index e699e5b272..8c60becbd2 100644 --- a/docs/pages/playground.vue +++ b/docs/pages/playground.vue @@ -3,6 +3,7 @@ const title = 'Playground' const description = 'Play online with our interactive Nuxt Image playground.' useSeoMeta({ + titleTemplate: '%s - Nuxt UI', title, ogTitle: 'Nuxt UI Playground', description diff --git a/docs/pages/releases.vue b/docs/pages/releases.vue new file mode 100644 index 0000000000..07916fd20a --- /dev/null +++ b/docs/pages/releases.vue @@ -0,0 +1,125 @@ + + + + + diff --git a/docs/pages/roadmap.vue b/docs/pages/roadmap.vue index db2713c7ac..d26b8129c3 100644 --- a/docs/pages/roadmap.vue +++ b/docs/pages/roadmap.vue @@ -3,6 +3,7 @@ const title = 'Roadmap' const description = 'Discover our Volta board for @nuxt/ui development status.' useSeoMeta({ + titleTemplate: '%s - Nuxt UI', title, ogTitle: 'Nuxt UI Roadmap', description diff --git a/docs/server/api/pulls.json.get.ts b/docs/server/api/pulls.json.get.ts new file mode 100644 index 0000000000..97066e038e --- /dev/null +++ b/docs/server/api/pulls.json.get.ts @@ -0,0 +1,23 @@ +import { Octokit } from '@octokit/rest' + +function isUserABot (user) { + return user?.login?.endsWith('-bot') || user?.login?.endsWith('[bot]') +} + +export default cachedEventHandler(async () => { + if (!process.env.NUXT_GITHUB_TOKEN) { + return [] + } + + const octokit = new Octokit({ auth: process.env.NUXT_GITHUB_TOKEN }) + + const pulls = await octokit.paginate(octokit.rest.pulls.list, { + owner: 'nuxt', + repo: 'ui', + state: 'closed' + }) + + return pulls.filter(pull => !!pull.merged_at).filter(pull => !isUserABot(pull.user)) +}, { + maxAge: 60 * 60 +}) diff --git a/docs/server/api/releases.json.get.ts b/docs/server/api/releases.json.get.ts new file mode 100644 index 0000000000..924aa4063f --- /dev/null +++ b/docs/server/api/releases.json.get.ts @@ -0,0 +1,18 @@ +import { Octokit } from '@octokit/rest' + +export default cachedEventHandler(async () => { + if (!process.env.NUXT_GITHUB_TOKEN) { + return [] + } + + const octokit = new Octokit({ auth: process.env.NUXT_GITHUB_TOKEN }) + + const { data: releases } = await octokit.rest.repos.listReleases({ + owner: 'nuxt', + repo: 'ui' + }) + + return releases +}, { + maxAge: 60 * 60 +}) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 399b0ab004..755aa291e7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -172,9 +172,15 @@ importers: '@nuxtjs/plausible': specifier: ^0.2.3 version: 0.2.3(rollup@3.29.1) + '@octokit/rest': + specifier: ^20.0.2 + version: 20.0.2 '@vueuse/nuxt': specifier: ^10.5.0 version: 10.5.0(nuxt@3.8.0)(rollup@3.29.1)(vue@3.3.4) + date-fns: + specifier: ^2.30.0 + version: 2.30.0 eslint: specifier: ^8.52.0 version: 8.52.0 @@ -2118,6 +2124,11 @@ packages: engines: {node: '>= 14'} dev: true + /@octokit/auth-token@4.0.0: + resolution: {integrity: sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==} + engines: {node: '>= 18'} + dev: true + /@octokit/core@4.2.4: resolution: {integrity: sha512-rYKilwgzQ7/imScn3M9/pFfUf4I1AZEH3KhyJmtPdE2zfaXAn2mFfUy4FbKewzc2We5y/LlKLj36fWJLKC2SIQ==} engines: {node: '>= 14'} @@ -2133,6 +2144,19 @@ packages: - encoding dev: true + /@octokit/core@5.0.1: + resolution: {integrity: sha512-lyeeeZyESFo+ffI801SaBKmCfsvarO+dgV8/0gD8u1d87clbEdWsP5yC+dSj3zLhb2eIf5SJrn6vDz9AheETHw==} + engines: {node: '>= 18'} + dependencies: + '@octokit/auth-token': 4.0.0 + '@octokit/graphql': 7.0.2 + '@octokit/request': 8.1.5 + '@octokit/request-error': 5.0.1 + '@octokit/types': 12.3.0 + before-after-hook: 2.2.3 + universal-user-agent: 6.0.0 + dev: true + /@octokit/endpoint@7.0.6: resolution: {integrity: sha512-5L4fseVRUsDFGR00tMWD/Trdeeihn999rTMGRMC1G/Ldi1uWlWJzI98H4Iak5DB/RVvQuyMYKqSK/R6mbSOQyg==} engines: {node: '>= 14'} @@ -2142,6 +2166,15 @@ packages: universal-user-agent: 6.0.0 dev: true + /@octokit/endpoint@9.0.2: + resolution: {integrity: sha512-qhKW8YLIi+Kmc92FQUFGr++DYtkx/1fBv+Thua6baqnjnOsgBYJDCvWZR1YcINuHGOEQt416WOfE+A/oG60NBQ==} + engines: {node: '>= 18'} + dependencies: + '@octokit/types': 12.3.0 + is-plain-object: 5.0.0 + universal-user-agent: 6.0.0 + dev: true + /@octokit/graphql@5.0.6: resolution: {integrity: sha512-Fxyxdy/JH0MnIB5h+UQ3yCoh1FG4kWXfFKkpWqjZHw/p+Kc8Y44Hu/kCgNBT6nU1shNumEchmW/sUO1JuQnPcw==} engines: {node: '>= 14'} @@ -2153,10 +2186,23 @@ packages: - encoding dev: true + /@octokit/graphql@7.0.2: + resolution: {integrity: sha512-OJ2iGMtj5Tg3s6RaXH22cJcxXRi7Y3EBqbHTBRq+PQAqfaS8f/236fUrWhfSn8P4jovyzqucxme7/vWSSZBX2Q==} + engines: {node: '>= 18'} + dependencies: + '@octokit/request': 8.1.5 + '@octokit/types': 12.3.0 + universal-user-agent: 6.0.0 + dev: true + /@octokit/openapi-types@18.0.0: resolution: {integrity: sha512-V8GImKs3TeQRxRtXFpG2wl19V7444NIOTDF24AWuIbmNaNYOQMWRbjcGDXV5B+0n887fgDcuMNOmlul+k+oJtw==} dev: true + /@octokit/openapi-types@19.0.2: + resolution: {integrity: sha512-8li32fUDUeml/ACRp/njCWTsk5t17cfTM1jp9n08pBrqs5cDFJubtjsSnuz56r5Tad6jdEPJld7LxNp9dNcyjQ==} + dev: true + /@octokit/plugin-paginate-rest@6.1.2(@octokit/core@4.2.4): resolution: {integrity: sha512-qhrmtQeHU/IivxucOV1bbI/xZyC/iOBhclokv7Sut5vnejAIAEXVcGQeRpQlU39E0WwK9lNvJHphHri/DB6lbQ==} engines: {node: '>= 14'} @@ -2168,6 +2214,16 @@ packages: '@octokit/types': 9.3.2 dev: true + /@octokit/plugin-paginate-rest@9.1.4(@octokit/core@5.0.1): + resolution: {integrity: sha512-MvZx4WvfhBnt7PtH5XE7HORsO7bBk4er1FgRIUr1qJ89NR2I6bWjGyKsxk8z42FPQ34hFQm0Baanh4gzdZR4gQ==} + engines: {node: '>= 18'} + peerDependencies: + '@octokit/core': '>=5' + dependencies: + '@octokit/core': 5.0.1 + '@octokit/types': 12.3.0 + dev: true + /@octokit/plugin-request-log@1.0.4(@octokit/core@4.2.4): resolution: {integrity: sha512-mLUsMkgP7K/cnFEw07kWqXGF5LKrOkD+lhCrKvPHXWDywAwuDUeDwWBpc69XK3pNX0uKiVt8g5z96PJ6z9xCFA==} peerDependencies: @@ -2176,6 +2232,25 @@ packages: '@octokit/core': 4.2.4 dev: true + /@octokit/plugin-request-log@4.0.0(@octokit/core@5.0.1): + resolution: {integrity: sha512-2uJI1COtYCq8Z4yNSnM231TgH50bRkheQ9+aH8TnZanB6QilOnx8RMD2qsnamSOXtDj0ilxvevf5fGsBhBBzKA==} + engines: {node: '>= 18'} + peerDependencies: + '@octokit/core': '>=5' + dependencies: + '@octokit/core': 5.0.1 + dev: true + + /@octokit/plugin-rest-endpoint-methods@10.1.5(@octokit/core@5.0.1): + resolution: {integrity: sha512-LMEdsMV8TTMjMTqVoqMzV95XTbv0ZsWxCxQtjAunQOCdwoDH4BVF/Ke5JMSZEVCWGI2kzxnUNbFnK/MxwV7NjA==} + engines: {node: '>= 18'} + peerDependencies: + '@octokit/core': '>=5' + dependencies: + '@octokit/core': 5.0.1 + '@octokit/types': 12.3.0 + dev: true + /@octokit/plugin-rest-endpoint-methods@7.2.3(@octokit/core@4.2.4): resolution: {integrity: sha512-I5Gml6kTAkzVlN7KCtjOM+Ruwe/rQppp0QU372K1GP7kNOYEKe8Xn5BW4sE62JAHdwpq95OQK/qGNyKQMUzVgA==} engines: {node: '>= 14'} @@ -2195,6 +2270,15 @@ packages: once: 1.4.0 dev: true + /@octokit/request-error@5.0.1: + resolution: {integrity: sha512-X7pnyTMV7MgtGmiXBwmO6M5kIPrntOXdyKZLigNfQWSEQzVxR4a4vo49vJjTWX70mPndj8KhfT4Dx+2Ng3vnBQ==} + engines: {node: '>= 18'} + dependencies: + '@octokit/types': 12.3.0 + deprecation: 2.3.1 + once: 1.4.0 + dev: true + /@octokit/request@6.2.8: resolution: {integrity: sha512-ow4+pkVQ+6XVVsekSYBzJC0VTVvh/FCTUUgTsboGq+DTeWdyIFV8WSCdo0RIxk6wSkBTHqIK1mYuY7nOBXOchw==} engines: {node: '>= 14'} @@ -2209,6 +2293,17 @@ packages: - encoding dev: true + /@octokit/request@8.1.5: + resolution: {integrity: sha512-zVKbNbX1xUluD9ZR4/tPs1yuYrK9xeh5fGZUXA6u04XGsTvomg0YO8/ZUC0FqAd49hAOEMFPAVUTh+2lBhOhLA==} + engines: {node: '>= 18'} + dependencies: + '@octokit/endpoint': 9.0.2 + '@octokit/request-error': 5.0.1 + '@octokit/types': 12.3.0 + is-plain-object: 5.0.0 + universal-user-agent: 6.0.0 + dev: true + /@octokit/rest@19.0.13: resolution: {integrity: sha512-/EzVox5V9gYGdbAI+ovYj3nXQT1TtTHRT+0eZPcuC05UFSWO3mdO9UY1C0i2eLF9Un1ONJkAk+IEtYGAC+TahA==} engines: {node: '>= 14'} @@ -2221,6 +2316,16 @@ packages: - encoding dev: true + /@octokit/rest@20.0.2: + resolution: {integrity: sha512-Ux8NDgEraQ/DMAU1PlAohyfBBXDwhnX2j33Z1nJNziqAfHi70PuxkFYIcIt8aIAxtRE7KVuKp8lSR8pA0J5iOQ==} + engines: {node: '>= 18'} + dependencies: + '@octokit/core': 5.0.1 + '@octokit/plugin-paginate-rest': 9.1.4(@octokit/core@5.0.1) + '@octokit/plugin-request-log': 4.0.0(@octokit/core@5.0.1) + '@octokit/plugin-rest-endpoint-methods': 10.1.5(@octokit/core@5.0.1) + dev: true + /@octokit/tsconfig@1.0.2: resolution: {integrity: sha512-I0vDR0rdtP8p2lGMzvsJzbhdOWy405HcGovrspJ8RRibHnyRgggUSNO5AIox5LmqiwmatHKYsvj6VGFHkqS7lA==} dev: true @@ -2231,6 +2336,12 @@ packages: '@octokit/openapi-types': 18.0.0 dev: true + /@octokit/types@12.3.0: + resolution: {integrity: sha512-nJ8X2HRr234q3w/FcovDlA+ttUU4m1eJAourvfUUtwAWeqL8AsyRqfnLvVnYn3NFbUnsmzQCzLNdFerPwdmcDQ==} + dependencies: + '@octokit/openapi-types': 19.0.2 + dev: true + /@octokit/types@9.3.2: resolution: {integrity: sha512-D4iHGTdAnEEVsB8fl95m1hiz7D5YiRdQ9b/OEb3BYRVwbLsGHcRVPz+u+BgRLNk0Q0/4iZCBqDN96j2XNxfXrA==} dependencies: