Skip to content

Commit

Permalink
feat: show docus version and notice for new version (#685)
Browse files Browse the repository at this point in the history
  • Loading branch information
atinux authored Nov 26, 2022
1 parent 03f1062 commit f0f1ae6
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { createResolver } from '@nuxt/kit'
import { createResolver, logger } from '@nuxt/kit'
import { $fetch } from 'ofetch'
import { version } from './package.json'

logger.success(`Using Docus v${version}`)

const { resolve } = createResolver(import.meta.url)

Expand All @@ -20,7 +24,16 @@ export default defineNuxtConfig({
'@nuxtjs/color-mode',
'@nuxt/content',
'@vueuse/nuxt',
resolve('./app/module')
resolve('./app/module'),
(_, nuxt) => {
if (nuxt.options.dev) {
$fetch('https://ungh.unjs.io/repos/nuxt-themes/docus/releases/latest').then(({ release }) => {
if (release.tag !== `v${version}`) {
logger.warn(`A new version of Docus (${release.tag}) is available: https://github.com/nuxt-themes/docus/releases/tag/${release.tag}`)
}
}).catch((_) => {})
}
}
],

css: [
Expand Down

1 comment on commit f0f1ae6

@vercel
Copy link

@vercel vercel bot commented on f0f1ae6 Nov 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.