Skip to content

Commit

Permalink
chore: Обновление vitepress
Browse files Browse the repository at this point in the history
  • Loading branch information
GulomovCreative committed Jul 22, 2023
1 parent 050a08d commit 64438d5
Show file tree
Hide file tree
Showing 46 changed files with 193 additions and 204 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.idea
.DS_Store
docs/.vitepress/cache
docs/.vitepress/dist
.vitepress/cache
.vitepress/dist
node_modules

.temp
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { createWriteStream } from 'node:fs'
import { resolve } from 'node:path'
import { slugify } from 'transliteration'
import { fileURLToPath, URL } from 'node:url'
import { modhost, modstore, modxpro, telegram } from '../../icons'
import { coreMembers } from '../../authors'
import { modhost, modstore, modxpro, telegram } from '../../docs/icons'
import { coreMembers } from '../../docs/authors'
import { normalize } from 'vitepress/dist/client/shared'

const SITE_HOST = 'https://docs.modx.pro/'
Expand All @@ -25,6 +25,7 @@ export default defineConfigWithTheme<DocsTheme.Config>({

title: SITE_TITLE,
titleTemplate: ':title' + SITE_TITLE_SEPARATOR + SITE_TITLE,
srcDir: './docs',

markdown: {
// @ts-expect-error
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { type Ref, computed } from 'vue'
import { type PageData, useData } from 'vitepress'
import type { DocsPageData } from '../plugins/component'
import { type Author, authors } from '../../../authors'
import { type Author, authors } from '../../../docs/authors'
import VPImage from 'vitepress/dist/client/theme-default/components/VPImage.vue'
import VPLink from 'vitepress/dist/client/theme-default/components/VPLink.vue'
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,20 @@ const showFooter = computed(() => {
</div>
</div>

<div v-if="control.prev?.link || control.next?.link" class="prev-next">
<nav v-if="control.prev?.link || control.next?.link" class="prev-next">
<div class="pager">
<a v-if="control.prev?.link" class="pager-link prev" :href="normalizeLink(control.prev.link)">
<span class="desc" v-html="theme.docFooter?.prev || 'Previous page'"></span>
<span class="title" v-html="control.prev.text"></span>
</a>
</div>
<div class="pager" :class="{ 'has-prev': control.prev?.link }">
<div class="pager">
<a v-if="control.next?.link" class="pager-link next" :href="normalizeLink(control.next.link)">
<span class="desc" v-html="theme.docFooter?.next || 'Next page'"></span>
<span class="title" v-html="control.next.text"></span>
</a>
</div>
</div>
</nav>
</footer>
</template>
Expand Down Expand Up @@ -118,29 +118,14 @@ const showFooter = computed(() => {
.prev-next {
border-top: 1px solid var(--vp-c-divider);
padding-top: 24px;
display: grid;
grid-row-gap: 8px;
}
@media (min-width: 640px) {
.prev-next {
display: flex;
}
}
.pager.has-prev {
padding-top: 8px;
}
@media (min-width: 640px) {
.pager {
display: flex;
flex-direction: column;
flex-shrink: 0;
width: 50%;
}
.pager.has-prev {
padding-top: 0;
padding-left: 16px;
grid-template-columns: repeat(2, 1fr);
grid-column-gap: 16px;
}
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { computed } from 'vue'
import type { DefaultTheme } from 'vitepress/theme'
import type { DefaultTheme } from 'vitepress/theme-without-fonts'
import DocsFeature from './DocsFeature.vue'
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import DefaultTheme from 'vitepress/theme'
import DefaultTheme from 'vitepress/theme-without-fonts'
import DocsHome from './DocsHome.vue'
import DocsComponentWidget from './DocsComponentWidget.vue'
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ const searchIndex = computedAsync(async () =>
fuzzy: 0.2,
prefix: true,
boost: { title: 4, text: 1, titles: 1 },
...(theme.value.search?.provider === 'local' &&
theme.value.search.options?.miniSearch?.searchOptions),
boostDocument: (documentId) => {
const component = documentId.match(/components\/([^\/#]*)/)?.[1]
const pathArr = documentId.replace(/\#.*/, '').replace(/^\//, '').replace(/\/$/, '').split('/')
Expand All @@ -92,7 +94,9 @@ const searchIndex = computedAsync(async () =>
return 1.0
}
}
},
...(theme.value.search?.provider === 'local' &&
theme.value.search.options?.miniSearch?.options)
}
)
)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { type Ref, computed } from 'vue'
import { type PageData, useData } from 'vitepress'
import type { DocsPageData } from '../plugins/component'
import { type Author, authors } from '../../../authors'
import { type Author, authors } from '../../../docs/authors'
import VPImage from 'vitepress/dist/client/theme-default/components/VPImage.vue'
import VPLink from 'vitepress/dist/client/theme-default/components/VPLink.vue'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { ref, watchPostEffect, watch, computed } from 'vue'
import { disableBodyScroll, clearAllBodyScrollLocks } from 'body-scroll-lock'
import { DefaultTheme, useRoute, useData } from 'vitepress'
import { useSidebar } from 'vitepress/theme'
import { useSidebar } from 'vitepress/dist/client/theme-default/composables/sidebar'
import VPSidebarItem from 'vitepress/dist/client/theme-default/components/VPSidebarItem.vue'
const { sidebar: flatSidebar, sidebarGroups, hasSidebar } = useSidebar()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script setup lang="ts">
import { computed } from 'vue'
import { useData } from 'vitepress'
import { VPTeamMembers } from 'vitepress/theme'
import { coreMembers } from '../../../authors'
import { VPTeamMembers } from 'vitepress/theme-without-fonts'
import { coreMembers } from '../../../docs/authors'
const { lang, theme } = useData()
const members = computed(() => coreMembers.map(member => ({ ...member, name: member.name[lang.value] })))
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import matter from 'gray-matter'

import { generateSidebarItem, getTitleFromContent } from './sidebar'

import type { Author } from '../../../authors'
import type { Author } from '../../../docs/authors'
import { findPath } from '../utils'

export interface ComponentData {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { DefaultTheme } from 'vitepress'
import { normalize } from 'vitepress/dist/client/shared'
import faqCategories from '../../../faq/categories.json'
import faqCategories from '../../../docs/faq/categories.json'

import { readFileSync } from 'fs'
import { join, basename } from 'path'
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions docs/.vitepress/theme/utils.ts → .vitepress/theme/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import type { DefaultTheme, UserConfig } from 'vitepress'
import type { ComponentData, DocsPageData } from './plugins/component'
import { normalize } from 'vitepress/dist/client/shared'

import type { Author } from '../../authors'
import { authors } from '../../authors'
import { type Author, authors } from '../../docs/authors'
import { DocsTheme } from './types'

export function findPath(
Expand Down
2 changes: 1 addition & 1 deletion docs/authors.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import authors from './authors.json'
import type { DocsTheme } from './.vitepress/theme/types'
import type { DocsTheme } from '../.vitepress/theme/types'
import { modxpro } from './icons'

export interface Author {
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
],
"license": "MIT",
"scripts": {
"dev": "vitepress dev docs",
"build": "node --max_old_space_size=4096 ./node_modules/vitepress/bin/vitepress.js build docs",
"preview": "vitepress preview docs",
"dev": "vitepress dev",
"build": "node --max_old_space_size=4096 ./node_modules/vitepress/bin/vitepress.js build",
"preview": "vitepress preview",
"generate": "plop",
"lint": "markdownlint **/*.md --disable MD045"
},
Expand All @@ -39,7 +39,7 @@
"plop": "^3.1.2",
"sitemap": "^7.1.1",
"transliteration": "^2.3.5",
"vitepress": "^1.0.0-beta.5",
"vitepress": "^1.0.0-beta.6",
"vue": "^3.3.4"
},
"pnpm": {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
]
},
"include": [
"docs/.vitepress/theme/**/*",
".vitepress/theme/**/*",
"node_modules/vitepress/dist/client/theme-default/components/**/*.vue"
]
}
Loading

0 comments on commit 64438d5

Please sign in to comment.