Skip to content

Commit 82d2ce7

Browse files
committed
fix(docs): handle redirects
1 parent dfef449 commit 82d2ce7

File tree

102 files changed

+125
-104
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+125
-104
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ dist/
22
node_modules
33
node_modules/
44
patches/
5+
types/
56
!packages/.vitepress
67
!/.eslintrc.js
78
!/rollup.config.js

packages/.vitepress/theme/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import Layout from './Layout.vue'
22
import NotFound from './NotFound.vue'
33
import DemoContainer from './components/DemoContainer.vue'
44
import Note from './components/Note.vue'
5+
import { handleRedirects } from './redirects'
56

67
import './styles/vars.css'
78
import './styles/layout.css'
@@ -18,6 +19,9 @@ const theme = {
1819
app.component('DemoContainer', DemoContainer)
1920
app.component('Note', Note)
2021

22+
if (typeof window !== 'undefined')
23+
handleRedirects(router)
24+
2125
// @ts-ignore
2226
import('vite-plugin-editor-nav/client').then(i => i.default(router))
2327
},
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import functions from '../../../meta/function-indexes'
2+
import { Router } from 'vitepress'
3+
4+
export function handleRedirects(router: Router) {
5+
const query = new URLSearchParams(location.search)
6+
7+
// redirects for the legacy storybook
8+
if (query.get('path')?.startsWith('/story/')) {
9+
const name = query.get('path').split('-').slice(-1)[0]?.toLowerCase()
10+
const fn = functions.functions.find(i => i.name.toLowerCase() === name)
11+
if (fn)
12+
router.go(`/${fn.package}/${fn.name}/`)
13+
}
14+
}

packages/core/asyncComputed/index.md

Lines changed: 1 addition & 1 deletion

packages/core/createGlobalState/index.md

Lines changed: 1 addition & 1 deletion

packages/core/onClickOutside/index.md

Lines changed: 1 addition & 1 deletion

packages/core/onStartTyping/index.md

Lines changed: 1 addition & 1 deletion

packages/core/templateRef/index.md

Lines changed: 1 addition & 1 deletion

packages/core/useAsyncState/index.md

Lines changed: 1 addition & 1 deletion

packages/core/useBattery/index.md

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)