Add search plugin, build docs task

This commit is contained in:
aNNiMON 2024-01-11 22:12:14 +02:00 committed by Victor Melnik
parent 9581c09e79
commit b719420770
6 changed files with 45 additions and 4 deletions

1
docs/.gitignore vendored
View File

@ -2,4 +2,5 @@ node_modules
.temp .temp
.cache .cache
docs/.vuepress/configs/modules.js docs/.vuepress/configs/modules.js
docs/.vuepress/dist/
docs/*/modules/ docs/*/modules/

View File

@ -30,12 +30,20 @@ tasks.register('generateMarkdownModules') {
tasks.register('runDocsDev', Exec) { tasks.register('runDocsDev', Exec) {
group = "documentation" group = "documentation"
description = "Run sample program" description = "Start docs dev server"
dependsOn generateMarkdownModules dependsOn generateMarkdownModules
workingDir '../docs/docs' workingDir '../docs/docs'
commandLine 'pnpm', 'docs:dev' commandLine 'pnpm', 'docs:dev'
} }
tasks.register('buildDocs', Exec) {
group = "documentation"
description = "Build docs to static site"
dependsOn generateMarkdownModules
workingDir '../docs/docs'
commandLine 'pnpm', 'docs:build'
}
tasks.register('generateModuleInfo', JavaExec) { tasks.register('generateModuleInfo', JavaExec) {
group = "documentation" group = "documentation"
description = "Run sample program" description = "Run sample program"

View File

@ -2,6 +2,7 @@ import { defineUserConfig, defaultTheme } from 'vuepress'
import { getDirname, path } from '@vuepress/utils' import { getDirname, path } from '@vuepress/utils'
import { registerComponentsPlugin } from '@vuepress/plugin-register-components' import { registerComponentsPlugin } from '@vuepress/plugin-register-components'
import { prismjsPlugin } from '@vuepress/plugin-prismjs' import { prismjsPlugin } from '@vuepress/plugin-prismjs'
import { searchPlugin } from '@vuepress/plugin-search'
import { sidebarConfig } from './configs/sidebar' import { sidebarConfig } from './configs/sidebar'
import { navbarConfig } from './configs/navbar' import { navbarConfig } from './configs/navbar'
import Prism from 'prismjs'; import Prism from 'prismjs';
@ -11,6 +12,7 @@ definePrismOwnLang(Prism)
const __dirname = getDirname(import.meta.url) const __dirname = getDirname(import.meta.url)
export default defineUserConfig({ export default defineUserConfig({
base: "/docs/ownlang/",
locales: { locales: {
'/en/': { '/en/': {
lang: 'en-US', lang: 'en-US',
@ -50,6 +52,12 @@ export default defineUserConfig({
}), }),
registerComponentsPlugin({ registerComponentsPlugin({
componentsDir: path.resolve(__dirname, './components'), componentsDir: path.resolve(__dirname, './components'),
}) }),
searchPlugin({
locales: {
'/en/': { placeholder: 'Search' },
'/ru/': { placeholder: 'Поиск' },
},
}),
], ],
}) })

View File

@ -7,7 +7,7 @@ actions:
- text: 🇺🇸 English - text: 🇺🇸 English
link: /en/ link: /en/
type: primary type: primary
- text: 🇷🇺 Русский - text: 🇪🇷 Русский
link: /ru/ link: /ru/
type: primary type: primary
footer: © 2024 aNNiMON footer: © 2024 aNNiMON

View File

@ -7,13 +7,18 @@
"docs:dev": "vuepress dev docs", "docs:dev": "vuepress dev docs",
"docs:build": "vuepress build docs" "docs:build": "vuepress build docs"
}, },
"keywords": ["documentation", "ownlang", "programming-language"], "keywords": [
"documentation",
"ownlang",
"programming-language"
],
"author": "aNNiMON", "author": "aNNiMON",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@vuepress/client": "2.0.0-rc.0", "@vuepress/client": "2.0.0-rc.0",
"@vuepress/plugin-prismjs": "2.0.0-rc.0", "@vuepress/plugin-prismjs": "2.0.0-rc.0",
"@vuepress/plugin-register-components": "2.0.0-rc.0", "@vuepress/plugin-register-components": "2.0.0-rc.0",
"@vuepress/plugin-search": "2.0.0-rc.0",
"@vuepress/utils": "2.0.0-rc.0", "@vuepress/utils": "2.0.0-rc.0",
"prismjs": "^1.29.0", "prismjs": "^1.29.0",
"vue": "^3.3.8", "vue": "^3.3.8",

View File

@ -14,6 +14,9 @@ devDependencies:
'@vuepress/plugin-register-components': '@vuepress/plugin-register-components':
specifier: 2.0.0-rc.0 specifier: 2.0.0-rc.0
version: 2.0.0-rc.0 version: 2.0.0-rc.0
'@vuepress/plugin-search':
specifier: 2.0.0-rc.0
version: 2.0.0-rc.0
'@vuepress/utils': '@vuepress/utils':
specifier: 2.0.0-rc.0 specifier: 2.0.0-rc.0
version: 2.0.0-rc.0 version: 2.0.0-rc.0
@ -831,6 +834,22 @@ packages:
- typescript - typescript
dev: true dev: true
/@vuepress/plugin-search@2.0.0-rc.0:
resolution: {integrity: sha512-1ikJUgIN+7QrcAftxpWUKTrNVHEN2+k/az0Sjz7Ok7EthMHcG6qQsIb+AoK4WIQMsJkwVPLxwym/M1FbBTZDWQ==}
dependencies:
'@vuepress/client': 2.0.0-rc.0
'@vuepress/core': 2.0.0-rc.0
'@vuepress/shared': 2.0.0-rc.0
'@vuepress/utils': 2.0.0-rc.0
chokidar: 3.5.3
vue: 3.3.8
vue-router: 4.2.5(vue@3.3.8)
transitivePeerDependencies:
- '@vue/composition-api'
- supports-color
- typescript
dev: true
/@vuepress/plugin-theme-data@2.0.0-rc.0: /@vuepress/plugin-theme-data@2.0.0-rc.0:
resolution: {integrity: sha512-FXY3/Ml+rM6gNKvwdBF6vKAcwnSvtXCzKgQwJAw3ppQTKUkLcbOxqM+h4d8bzHWAAvdnEvQFug5uEZgWllBQbA==} resolution: {integrity: sha512-FXY3/Ml+rM6gNKvwdBF6vKAcwnSvtXCzKgQwJAw3ppQTKUkLcbOxqM+h4d8bzHWAAvdnEvQFug5uEZgWllBQbA==}
dependencies: dependencies: