forked from vexip-ui/vexip-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: refactor and switch to vitepress for performance and SEO (vexip…
…-ui#308) * wip: trensfer * wip: transfer * wip: split layout * wip: transfer * wip: transfer * refactor(docs): split vite config * chore: adjust config * chore: update lock file * wip: transfer * fix(docs): fix not-found page display * refactor: transfer demo markdown * fix(docs): fix the demo display * chore: add tag shortcut * docs: display optimize * fix: markdown style * chore: add title tag style * chore: adjust aside menu since logic * docs: add since tag display * docs: fix markdown match info rule * wip: search component * fix: homepage component button link * wip: mobile sub header * refactor: mobile sub header * feat(utils): enhance flatTree to support depth first and filter * chore: proofread and improve README.md [skip ci] * fix(utils): correct flatTree filter method * feat: add page-links component * feat: add edit-link component * feat: add lastTime display * feat: search component add keyboard shortcut * fix: repair ts error in vite.config * feat: component docs add contributor display * refactor: include contributors logic into component * chore: add footer * chore: optimize import order * style: optimize mobile display * build: ensure effective build * chore: update * wip: demo target * fix: hash target for demo * chore: imrpve search * chore: improve guides * wip: add footer links * feat: add footer links * chore: improve i18n * chore: remove code * fix: section off docs layout and demo styles * docs: add i18n and ssr docs * docs: add custom-form-control guide * chore: update create script * docs: add development guide * chore: improve * docs: optimize footer title display * chore: update vitepress version * fix: repair dark mode value * docs: update markdown desc * fix: homepage button link * chore: ajust * chore: remove useless files * chore: remove useless files * chore: remove useless meta json * chore: check and clear --------- Co-authored-by: winches <“[email protected]”> Co-authored-by: winches <[email protected]>
- Loading branch information
1 parent
ee639e3
commit 5f08a93
Showing
1,597 changed files
with
22,562 additions
and
16,716 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
shell-emulator=true | ||
shell-emulator=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,215 @@ | ||
import { getPackageInfoSync, resolveModule } from 'local-pkg' | ||
import { getGuideConfig } from './config/guide' | ||
import { getComponentConfig } from './config/component' | ||
import { highlight } from '../build/highlight' | ||
import { markdownItSetup } from '../build/markdown' | ||
import { toKebabCase } from '@vexip-ui/utils' | ||
import * as compiler from '@vue/compiler-sfc' | ||
|
||
import type { UserConfig } from 'vitepress' | ||
import type { ThemeConfig } from './theme/types' | ||
|
||
compiler.parseCache.max = 10000 | ||
|
||
export default <UserConfig<ThemeConfig>>{ | ||
srcExclude: ['demos', 'guides', 'README.md'], | ||
ignoreDeadLinks: true, | ||
titleTemplate: 'Vexip UI', | ||
lastUpdated: true, | ||
head: [ | ||
['meta', { 'http-equiv': 'Expires', content: '0' }], | ||
['meta', { 'http-equiv': 'Pragma', content: 'no-cache' }], | ||
['meta', { 'http-equiv': 'Cache', content: 'no-cache' }], | ||
['meta', { 'http-equiv': 'Cache-control', content: 'no-store,no-cache,must-revalidate' }], | ||
['link', { rel: 'icon', type: 'image/svg+xml', href: '/vexip-ui.svg' }] | ||
], | ||
markdown: { | ||
highlight, | ||
config: markdownItSetup | ||
}, | ||
vue: { | ||
template: { | ||
ssr: true | ||
}, | ||
compiler: compiler as any | ||
}, | ||
themeConfig: { | ||
/** | ||
* 自定义配置信息 | ||
* asideMenus 侧边栏菜单 | ||
*/ | ||
asideMenus: getAsideMenus(), | ||
|
||
nav: [ | ||
{ key: 'guides', i18n: 'common.guides', link: '/guide/vexip-ui', activeMatch: '/guide/' }, | ||
{ | ||
key: 'components', | ||
i18n: 'common.components', | ||
link: '/component/button', | ||
activeMatch: '/component/' | ||
}, | ||
{ key: 'playground', i18n: 'common.playground', link: 'https://playground.vexipui.com' } | ||
], | ||
outline: { | ||
'/guide/': 2, | ||
'/component/': 3 | ||
}, | ||
editLink: { | ||
pattern: 'https://github.com/vexip-ui/vexip-ui/edit/main/docs/:path' | ||
}, | ||
|
||
footerLinks: [] | ||
}, | ||
locales: { | ||
'en-US': { | ||
label: 'English', | ||
lang: 'en-US', | ||
themeConfig: { | ||
footerLinks: getFooterLinks('en-US') | ||
} | ||
}, | ||
'zh-CN': { | ||
label: '中文', | ||
lang: 'zh-CN', | ||
themeConfig: { | ||
footerLinks: getFooterLinks('zh-CN') | ||
} | ||
} | ||
} | ||
} | ||
|
||
let version: string | undefined | ||
|
||
function queryLibVersion() { | ||
if (version) return version | ||
|
||
try { | ||
version = | ||
getPackageInfoSync('vexip-ui')?.version ?? | ||
getPackageInfoSync('vexip-ui', { paths: [resolveModule('vexip-ui') || process.cwd()] }) | ||
?.version | ||
} catch (e) { | ||
console.error(e) | ||
} | ||
|
||
if (!version) { | ||
throw new Error('[vexip-ui:docs] failed to load vexip-ui version, please check') | ||
} | ||
|
||
return version | ||
} | ||
|
||
function getAsideMenus(): ThemeConfig['asideMenus'] { | ||
const versionPrefix = queryLibVersion().split('.').slice(0, 2).join('.') + '.' | ||
|
||
return { | ||
'/guide/': getGuideConfig().map(group => { | ||
return { | ||
key: group.name, | ||
i18n: `guide.${group.name}`, | ||
items: group.guides.map(guide => { | ||
return { | ||
key: guide.name, | ||
link: `/guide/${guide.name}`, | ||
i18n: `guide.${guide.i18n}` | ||
} | ||
}) | ||
} | ||
}), | ||
'/component/': getComponentConfig().map(group => { | ||
return { | ||
key: group.name, | ||
i18n: `group.${group.name}`, | ||
count: true, | ||
items: group.components.map(component => ({ | ||
key: component.name, | ||
link: `/component/${toKebabCase(component.name)}`, | ||
i18n: `component.${component.name}`, | ||
tag: component.since?.startsWith(versionPrefix) ? 'New' : '', | ||
origin: component.name | ||
})) | ||
} | ||
}) | ||
} | ||
} | ||
|
||
function getFooterLinks(lang: 'zh-CN' | 'en-US'): ThemeConfig['footerLinks'] { | ||
const t = (s: string) => `footer.${s}` | ||
|
||
return [ | ||
{ | ||
i18n: t('resources'), | ||
items: [ | ||
{ | ||
text: 'Vexip Nuxt Module', | ||
link: 'https://github.com/vexip-ui/nuxt' | ||
}, | ||
{ | ||
text: 'Vexip Lint Config', | ||
subi18n: t('lintConfigSet'), | ||
link: 'https://github.com/vexip-ui/lint-config' | ||
}, | ||
{ | ||
text: 'Create Vexip', | ||
subi18n: t('createProject'), | ||
link: 'https://github.com/vexip-ui/create-vexip' | ||
}, | ||
{ | ||
text: 'Grid Layout Plus', | ||
subi18n: t('gridLayout'), | ||
link: `https://grid-layout-plus.netlify.app/${lang === 'zh-CN' ? 'zh/' : ''}` | ||
}, | ||
{ | ||
text: 'vite-plugin-dts', | ||
link: 'https://github.com/qmhc/vite-plugin-dts' | ||
}, | ||
{ | ||
text: 'vue-hooks-plus', | ||
subi18n: t('hooksLib'), | ||
link: `https://inhiblabcore.github.io/docs/hooks/${lang !== 'zh-CN' ? 'en/' : ''}` | ||
}, | ||
{ | ||
text: 'Vexip SFC Playground', | ||
link: 'https://playground.vexipui.com/' | ||
}, | ||
{ | ||
text: 'RedBlues-1980', | ||
subi18n: t('logoDesign'), | ||
link: 'https://richuangangban1980.lofter.com/' | ||
} | ||
] | ||
}, | ||
{ | ||
i18n: t('help'), | ||
items: [ | ||
{ | ||
text: 'GitHub', | ||
link: 'https://github.com/vexip-ui/vexip-ui' | ||
}, | ||
{ | ||
i18n: t('changelog'), | ||
link: 'https://github.com/vexip-ui/vexip-ui/blob/main/CHANGELOG.md' | ||
}, | ||
{ | ||
i18n: t('issue'), | ||
link: 'https://github.com/vexip-ui/vexip-ui/issues' | ||
}, | ||
{ | ||
i18n: t('contribute'), | ||
link: 'https://github.com/vexip-ui/vexip-ui/blob/main/CONTRIBUTING.md' | ||
}, | ||
{ | ||
i18n: t('qqGroup'), | ||
link: 'https://jq.qq.com/?_wv=1027&k=5KlA84xG' | ||
}, | ||
{ | ||
i18n: t('sponsor'), | ||
link: | ||
lang === 'zh-CN' | ||
? '/zh-CN/guide/vexip-ui.html#%E8%B4%A1%E7%8C%AE' | ||
: '/en-US/guide/vexip-ui.html#contributing' | ||
} | ||
] | ||
} | ||
] | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
export interface GuideConfig { | ||
name: string, | ||
i18n: string | ||
} | ||
|
||
export interface GuideGroup { | ||
name: string, | ||
guides: GuideConfig[] | ||
} | ||
|
||
export function getGuideConfig(): GuideGroup[] { | ||
return [ | ||
{ | ||
name: 'introduction', | ||
guides: [ | ||
{ name: 'vexip-ui', i18n: 'vexipui' }, | ||
{ name: 'getting-started', i18n: 'gettingStarted' }, | ||
{ name: 'name-origin', i18n: 'nameOrigin' }, | ||
{ name: 'logo-origin', i18n: 'logoOrigin' } | ||
] | ||
}, | ||
{ | ||
name: 'further', | ||
guides: [ | ||
{ name: 'global-config', i18n: 'globalConfig' }, | ||
{ name: 'style-config', i18n: 'styleConfig' }, | ||
{ name: 'i18n', i18n: 'i18n' }, | ||
{ name: 'ssr', i18n: 'ssr' }, | ||
{ name: 'custom-form-control', i18n: 'customFormControl' }, | ||
{ name: 'development-guide', i18n: 'developmentGuide' } | ||
] | ||
} | ||
] | ||
} |
Oops, something went wrong.