Skip to content

Commit

Permalink
fix: fixed version display and active search plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
favna committed Jan 27, 2023
1 parent a3f63fd commit 6e2a592
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 962 deletions.
18 changes: 18 additions & 0 deletions docs/.vuepress/components/Version/Version.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<template>
Latest stable version: <span class="bold">{{ version }}</span>
</template>

<script setup lang="ts">
import { useThemeData } from '@vuepress/plugin-theme-data/client'
import { ref } from 'vue'
const themeData = useThemeData()
const version = ref(themeData.value.version)
</script>

<style scoped>
.bold {
font-weight: bolder;
}
</style>
6 changes: 6 additions & 0 deletions docs/.vuepress/components/Version/module-declaration.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
declare module '@vuepress/plugin-theme-data/client' {
import type { DefaultThemeData } from '@vuepress/theme-default'
import type { Ref } from 'vue'

export declare function useThemeData(): Ref<DefaultThemeData>
}
13 changes: 12 additions & 1 deletion docs/.vuepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import tabsPlugin from '@snippetors/vuepress-plugin-tabs'
import { googleAnalyticsPlugin } from '@vuepress/plugin-google-analytics'
import { pwaPlugin } from '@vuepress/plugin-pwa'
import { registerComponentsPlugin } from '@vuepress/plugin-register-components'
import { searchPlugin } from '@vuepress/plugin-search'
import { defaultTheme } from '@vuepress/theme-default'
import {
defineUserConfig,
Expand All @@ -12,6 +13,7 @@ import {
type HeadConfig,
type HeadTagEmpty
} from 'vuepress'
import { version } from '../../package.json'

const GA_MEASUREMENT_ID = 'UA-82107035-1'
const GOOGLE_SITE_VERIFICATION = '4nm40QLVcDJmEJSAbrMfZ7fpBJZIXL1oSngBAYrZopY'
Expand All @@ -28,6 +30,7 @@ export default defineUserConfig({
head: getHead(),
plugins: getPlugins(),
theme: defaultTheme({
version,
logo: '/assets/img/logo.png',
repo: 'krisk/fuse',
docsDir: 'docs',
Expand Down Expand Up @@ -93,6 +96,7 @@ function getPlugins(): PluginConfig {
// id: GOOGLE_AD_CLIENT_ID,
// },
// ],
searchPlugin(),
googleAnalyticsPlugin({
id: GA_MEASUREMENT_ID
}),
Expand All @@ -105,7 +109,8 @@ function getPlugins(): PluginConfig {
...getComponent('Team'),
...getComponent('Jobs'),
...getComponent('Donate'),
...getComponent('TwitterFollow')
...getComponent('TwitterFollow'),
...getComponent('Version')
}
}),
pwaPlugin()
Expand Down Expand Up @@ -178,3 +183,9 @@ function getHead(): HeadConfig[] {
...scripts
]
}

declare module '@vuepress/theme-default' {
export interface DefaultThemeLocaleData {
version: string
}
}
6 changes: 3 additions & 3 deletions docs/getting-started/installation.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Installation

Latest stable version: **{{ $themeConfig.version }}**
<Version />

### NPM

```sh
$ npm install fuse.js
npm install fuse.js
```

### Yarn

```sh
$ yarn add fuse.js
yarn add fuse.js
```

#### Importing
Expand Down
Loading

0 comments on commit 6e2a592

Please sign in to comment.