From b11feaf2ce4eee4d3560ea66260e893c07e9deb4 Mon Sep 17 00:00:00 2001 From: bcakmakoglu <78412429+bcakmakoglu@users.noreply.github.com> Date: Mon, 27 Jun 2022 22:32:56 +0200 Subject: [PATCH] docs: add seo plugins --- docs/package.json | 2 + docs/src/.vuepress/config.ts | 17 +++- docs/src/.vuepress/copy-plugin.ts | 14 +--- docs/src/.vuepress/theme/index.ts | 36 ++++---- pnpm-lock.yaml | 134 ++++++++++++++++++++++-------- 5 files changed, 133 insertions(+), 70 deletions(-) diff --git a/docs/package.json b/docs/package.json index ead32f95..169bff23 100644 --- a/docs/package.json +++ b/docs/package.json @@ -34,6 +34,8 @@ "unplugin-vue-components": "^0.19.9", "vite-plugin-windicss": "^1.8.4", "vuepress": "2.0.0-beta.48", + "vuepress-plugin-seo2": "2.0.0-beta.84", + "vuepress-plugin-sitemap2": "2.0.0-beta.84", "windicss": "^3.5.5" } } diff --git a/docs/src/.vuepress/config.ts b/docs/src/.vuepress/config.ts index 8b635dc6..c363bdfd 100644 --- a/docs/src/.vuepress/config.ts +++ b/docs/src/.vuepress/config.ts @@ -1,5 +1,5 @@ -import { config } from 'dotenv' import { resolve } from 'path' +import { config } from 'dotenv' import { defineUserConfig } from 'vuepress' import type { HeadConfig } from 'vuepress' import { docsearchPlugin } from '@vuepress/plugin-docsearch' @@ -9,8 +9,10 @@ import Icons from 'unplugin-icons/vite' import IconsResolver from 'unplugin-icons/resolver' import Components from 'unplugin-vue-components/vite' import AutoImport from 'unplugin-auto-import/vite' +import seoPlugin from 'vuepress-plugin-seo2' +import sitemapPlugin from 'vuepress-plugin-sitemap2' import { copyVueFlowPlugin } from './copy-plugin' -import head from './head' +import head, { meta } from './head' import Theme from './theme' config({ path: resolve(__dirname, '.env') }) @@ -51,7 +53,7 @@ export default defineUserConfig({ compiler: 'vue3', }), ], - } + }, }), plugins: [ @@ -60,7 +62,14 @@ export default defineUserConfig({ appId: 'F7BJNSM4M5', apiKey: process.env.ALGOLIA_API_KEY!, indexName: 'vueflow', - }) + }), + seoPlugin({ + hostname: meta.url, + author: 'Burak Cakmakoglu', + }), + sitemapPlugin({ + hostname: meta.url, + }), ], ], diff --git a/docs/src/.vuepress/copy-plugin.ts b/docs/src/.vuepress/copy-plugin.ts index deab81d5..7bcfa0a8 100644 --- a/docs/src/.vuepress/copy-plugin.ts +++ b/docs/src/.vuepress/copy-plugin.ts @@ -1,20 +1,14 @@ -import { Plugin } from 'vite' import { existsSync, readFileSync } from 'fs' import { resolve } from 'path' +import type { Plugin } from 'vite' export function copyVueFlowPlugin(): Plugin { return { name: 'copy-vue-flow', generateBundle() { - const filePath = resolve( - __dirname, - '../../node_modules/@braks/vue-flow/dist/vue-flow.es.js' - ) + const filePath = resolve(__dirname, '../../node_modules/@braks/vue-flow/dist/vue-flow.es.js') if (!existsSync(filePath)) { - throw new Error( - `@braks/vue-flow/dist/vue-flow.es.js not built. ` + - `Run "pnpm -w build" first.` - ) + throw new Error(`@braks/vue-flow/dist/vue-flow.es.js not built. ` + `Run "pnpm -w build" first.`) } this.emitFile({ @@ -22,6 +16,6 @@ export function copyVueFlowPlugin(): Plugin { fileName: 'vue-flow.es.js', source: readFileSync(filePath, 'utf-8'), }) - } + }, } } diff --git a/docs/src/.vuepress/theme/index.ts b/docs/src/.vuepress/theme/index.ts index db0218ec..84918e9b 100644 --- a/docs/src/.vuepress/theme/index.ts +++ b/docs/src/.vuepress/theme/index.ts @@ -1,13 +1,14 @@ import { resolve } from 'path' -import { defaultTheme, SidebarConfigArray, Theme } from 'vuepress' +import { readdirSync, statSync } from 'fs' +import type { SidebarConfigArray, Theme } from 'vuepress' +import { defaultTheme } from 'vuepress' import { path } from '@vuepress/utils' import { useVueFlow } from '@braks/vue-flow' -import { readdirSync, statSync } from 'fs' const { vueFlowVersion } = useVueFlow() function capitalize(str: string) { - return str.charAt(0).toUpperCase() + str.slice(1); + return str.charAt(0).toUpperCase() + str.slice(1) } const typedocSidebarEntries = (): SidebarConfigArray => { @@ -16,7 +17,7 @@ const typedocSidebarEntries = (): SidebarConfigArray => { const docsModules = readdirSync(filePath).filter((name) => statSync(`${filePath}/${name}`).isDirectory()) const sidebarItems = docsModules.map((module) => { - let children = readdirSync(`${filePath}/${module}/`).map(entry => `/typedocs/${module}/${entry}`) + let children = readdirSync(`${filePath}/${module}/`).map((entry) => `/typedocs/${module}/${entry}`) if (module === 'variables') { children = children.filter((child) => { @@ -31,10 +32,8 @@ const typedocSidebarEntries = (): SidebarConfigArray => { { text: 'Modules', link: '/typedocs/', - children: [ - ...sidebarItems, - ], - } + children: [...sidebarItems], + }, ] } @@ -45,7 +44,8 @@ export default { docsBranch: 'master', lastUpdated: true, contributors: true, - darkMode: true, + colorMode: 'auto', + colorModeSwitch: true, logo: '/favicons/android-chrome-512x512.png', sidebar: { '/guide/': [ @@ -70,9 +70,9 @@ export default { }, { text: 'Events', - link: '/typedocs/interfaces/FlowEvents.html' + link: '/typedocs/interfaces/FlowEvents.html', }, - '/guide/vue-flow/slots' + '/guide/vue-flow/slots', ], }, '/guide/node', @@ -80,11 +80,7 @@ export default { '/guide/composables', { text: 'Utilities', - children: [ - '/guide/utils/graph', - '/guide/utils/instance', - '/guide/utils/edge', - ] + children: ['/guide/utils/graph', '/guide/utils/instance', '/guide/utils/edge'], }, { text: 'Components', @@ -106,11 +102,7 @@ export default { '/examples/', { text: 'Nodes', - children: [ - '/examples/nodes/', - '/examples/nodes/update-node', - '/examples/nodes/nesting', - ] + children: ['/examples/nodes/', '/examples/nodes/update-node', '/examples/nodes/nesting'], }, { text: 'Edges', @@ -119,7 +111,7 @@ export default { '/examples/edges/updatable-edge', '/examples/edges/connection-line', '/examples/edges/validation', - ] + ], }, '/examples/save', '/examples/dnd', diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4940c77b..7593ee14 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -49,6 +49,8 @@ importers: unplugin-vue-components: ^0.19.9 vite-plugin-windicss: ^1.8.4 vuepress: 2.0.0-beta.48 + vuepress-plugin-seo2: 2.0.0-beta.84 + vuepress-plugin-sitemap2: 2.0.0-beta.84 windicss: ^3.5.5 dependencies: '@animxyz/core': 0.6.6 @@ -68,13 +70,15 @@ importers: '@windicss/plugin-scrollbar': 1.2.3 dotenv: 16.0.1 ohmyfetch: 0.4.18 - typedoc: 0.22.18_typescript@4.7.3 + typedoc: 0.22.18_typescript@4.7.4 typedoc-plugin-markdown: 3.12.1_typedoc@0.22.18 unplugin-auto-import: 0.9.1_rollup@2.75.6+vite@2.9.10 unplugin-icons: 0.14.5_rollup@2.75.6+vite@2.9.10 unplugin-vue-components: 0.19.9_cimrprb54snhagk4tjmarxnbhm vite-plugin-windicss: 1.8.4_vite@2.9.10 vuepress: 2.0.0-beta.48_ky4o5iv42nfwog2gkj2rnr6kla + vuepress-plugin-seo2: 2.0.0-beta.84 + vuepress-plugin-sitemap2: 2.0.0-beta.84 windicss: 3.5.5 e2e: @@ -167,12 +171,12 @@ importers: '@braks/vue-flow': link:../vue-flow '@types/pathfinding': 0.0.5 '@vitejs/plugin-vue': 2.3.3_vite@2.9.10+vue@3.2.37 - ts-patch: 2.0.1_typescript@4.7.3 - typescript-transform-paths: 3.3.1_typescript@4.7.3 + ts-patch: 2.0.1_typescript@4.7.4 + typescript-transform-paths: 3.3.1_typescript@4.7.4 unplugin-auto-import: 0.7.2_vite@2.9.10 vite: 2.9.10 vite-plugin-vue-type-imports: 0.2.0_2yymnzrok6eda47acnj2yjm3ae - vue-tsc: 0.35.2_typescript@4.7.3 + vue-tsc: 0.35.2_typescript@4.7.4 packages/resize-rotate-node: specifiers: @@ -192,12 +196,12 @@ importers: devDependencies: '@braks/vue-flow': link:../vue-flow '@vitejs/plugin-vue': 2.3.3_vite@2.9.10+vue@3.2.37 - ts-patch: 2.0.1_typescript@4.7.3 - typescript-transform-paths: 3.3.1_typescript@4.7.3 + ts-patch: 2.0.1_typescript@4.7.4 + typescript-transform-paths: 3.3.1_typescript@4.7.4 unplugin-auto-import: 0.7.2_tci2uj2i5wdrrn53tzwatf6w64 vite: 2.9.10 vite-plugin-vue-type-imports: 0.1.3_2yymnzrok6eda47acnj2yjm3ae - vue-tsc: 0.35.2_typescript@4.7.3 + vue-tsc: 0.35.2_typescript@4.7.4 packages/vue-flow: specifiers: @@ -235,14 +239,14 @@ importers: postcss: 8.4.14 postcss-cli: 9.1.0_postcss@8.4.14 postcss-nested: 5.0.6_postcss@8.4.14 - ts-patch: 2.0.1_typescript@4.7.3 - typedoc: 0.22.17_typescript@4.7.3 - typescript-transform-paths: 3.3.1_typescript@4.7.3 + ts-patch: 2.0.1_typescript@4.7.4 + typedoc: 0.22.17_typescript@4.7.4 + typescript-transform-paths: 3.3.1_typescript@4.7.4 unplugin-auto-import: 0.9.0_gieuh5fsa53rimmmwzrmuhelrq vite: 2.9.10 vite-plugin-vue-type-imports: 0.2.0_2yymnzrok6eda47acnj2yjm3ae vite-svg-loader: 3.3.0 - vue-tsc: 0.38.1_typescript@4.7.3 + vue-tsc: 0.38.1_typescript@4.7.4 packages: @@ -2814,6 +2818,12 @@ packages: '@types/node': 17.0.41 dev: true + /@types/sax/1.2.4: + resolution: {integrity: sha512-pSAff4IAxJjfAXUG6tFkO7dsSbTmf8CtUpfhhZ5VhkRpC4628tJhh3+V6H1E+/Gs9piSzYKT5yzHO5M4GG9jkw==} + dependencies: + '@types/node': 18.0.0 + dev: true + /@types/scheduler/0.16.2: resolution: {integrity: sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==} dev: true @@ -3265,7 +3275,7 @@ packages: '@vue/devtools-api': 6.1.4 '@vuepress/shared': 2.0.0-beta.45 vue: 3.2.37 - vue-router: 4.0.15_vue@3.2.37 + vue-router: 4.0.16_vue@3.2.37 dev: true /@vuepress/client/2.0.0-beta.48: @@ -3313,7 +3323,7 @@ packages: '@vuepress/utils': 2.0.0-beta.48 ts-debounce: 4.0.0 vue: 3.2.37 - vue-router: 4.0.15_vue@3.2.37 + vue-router: 4.0.16_vue@3.2.37 transitivePeerDependencies: - supports-color dev: true @@ -3406,7 +3416,7 @@ packages: '@vuepress/core': 2.0.0-beta.48 '@vuepress/utils': 2.0.0-beta.48 vue: 3.2.37 - vue-router: 4.0.15_vue@3.2.37 + vue-router: 4.0.16_vue@3.2.37 transitivePeerDependencies: - supports-color dev: true @@ -3857,6 +3867,10 @@ packages: readable-stream: 3.6.0 dev: true + /arg/5.0.2: + resolution: {integrity: sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==} + dev: true + /argparse/1.0.10: resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} dependencies: @@ -10948,7 +10962,7 @@ packages: dev: true /set-blocking/2.0.0: - resolution: {integrity: sha1-BF+XgtARrppoA93TgrJDkrPYkPc=} + resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==} dev: true /setprototypeof/1.2.0: @@ -11013,6 +11027,17 @@ packages: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} dev: true + /sitemap/7.1.1: + resolution: {integrity: sha512-mK3aFtjz4VdJN0igpIJrinf3EO8U8mxOPsTBzSsy06UtjZQJ3YY3o3Xa7zSc5nMqcMrRwlChHZ18Kxg0caiPBg==} + engines: {node: '>=12.0.0', npm: '>=5.6.0'} + hasBin: true + dependencies: + '@types/node': 17.0.41 + '@types/sax': 1.2.4 + arg: 5.0.2 + sax: 1.2.4 + dev: true + /slash/3.0.0: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} @@ -11568,7 +11593,7 @@ packages: resolution: {integrity: sha512-+1iDGY6NmOGidq7i7xZGA4cm8DAa6fqdYcvO5Z6yBevH++Bdo9Qt/mN0TzHUgcCcKv1gmh9+W5dHqz8pMWbCbg==} dev: true - /ts-patch/2.0.1_typescript@4.7.3: + /ts-patch/2.0.1_typescript@4.7.4: resolution: {integrity: sha512-mP7beU1QkmyDs1+SzXYVaSTD6Xo7ZCibOJ3sZkb/xsQjoAQXvn4oPjk0keC2LfCNAgilqtqgjiWp3pQri1uz4w==} hasBin: true peerDependencies: @@ -11581,7 +11606,7 @@ packages: resolve: 1.22.0 shelljs: 0.8.5 strip-ansi: 6.0.1 - typescript: 4.7.3 + typescript: 4.7.4 dev: true /tsconfig-paths/3.14.1: @@ -11826,10 +11851,10 @@ packages: typedoc: '>=0.22.0' dependencies: handlebars: 4.7.7 - typedoc: 0.22.18_typescript@4.7.3 + typedoc: 0.22.18_typescript@4.7.4 dev: true - /typedoc/0.22.17_typescript@4.7.3: + /typedoc/0.22.17_typescript@4.7.4: resolution: {integrity: sha512-h6+uXHVVCPDaANzjwzdsj9aePBjZiBTpiMpBBeyh1zcN2odVsDCNajz8zyKnixF93HJeGpl34j/70yoEE5BfNg==} engines: {node: '>= 12.10.0'} hasBin: true @@ -11841,10 +11866,10 @@ packages: marked: 4.0.16 minimatch: 5.1.0 shiki: 0.10.1 - typescript: 4.7.3 + typescript: 4.7.4 dev: true - /typedoc/0.22.18_typescript@4.7.3: + /typedoc/0.22.18_typescript@4.7.4: resolution: {integrity: sha512-NK9RlLhRUGMvc6Rw5USEYgT4DVAUFk7IF7Q6MYfpJ88KnTZP7EneEa4RcP+tX1auAcz7QT1Iy0bUSZBYYHdoyA==} engines: {node: '>= 12.10.0'} hasBin: true @@ -11856,22 +11881,16 @@ packages: marked: 4.0.16 minimatch: 5.1.0 shiki: 0.10.1 - typescript: 4.7.3 + typescript: 4.7.4 dev: true - /typescript-transform-paths/3.3.1_typescript@4.7.3: + /typescript-transform-paths/3.3.1_typescript@4.7.4: resolution: {integrity: sha512-c+8Cqd2rsRtTU68rJI0NX/OtqgBDddNs1fIxm1nCNyhn0WpoyqtpUxc1w9Ke5c5kgE4/OT5xYbKf2cf694RYEg==} peerDependencies: typescript: '>=3.6.5' dependencies: minimatch: 3.1.2 - typescript: 4.7.3 - dev: true - - /typescript/4.7.3: - resolution: {integrity: sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA==} - engines: {node: '>=4.2.0'} - hasBin: true + typescript: 4.7.4 dev: true /typescript/4.7.4: @@ -12705,24 +12724,33 @@ packages: '@vue/devtools-api': 6.1.4 vue: 3.2.37 - /vue-tsc/0.35.2_typescript@4.7.3: + /vue-router/4.0.16_vue@3.2.37: + resolution: {integrity: sha512-JcO7cb8QJLBWE+DfxGUL3xUDOae/8nhM1KVdnudadTAORbuxIC/xAydC5Zr/VLHUDQi1ppuTF5/rjBGzgzrJNA==} + peerDependencies: + vue: ^3.2.0 + dependencies: + '@vue/devtools-api': 6.1.4 + vue: 3.2.37 + dev: true + + /vue-tsc/0.35.2_typescript@4.7.4: resolution: {integrity: sha512-aqY16VlODHzqtKGUkqdumNpH+s5ABCkufRyvMKQlL/mua+N2DfSVnHufzSNNUMr7vmOO0YsNg27jsspBMq4iGA==} hasBin: true peerDependencies: typescript: '*' dependencies: '@volar/vue-typescript': 0.35.2 - typescript: 4.7.3 + typescript: 4.7.4 dev: true - /vue-tsc/0.38.1_typescript@4.7.3: + /vue-tsc/0.38.1_typescript@4.7.4: resolution: {integrity: sha512-jwR4uwTkjsYhAW8o/BvnkeZsariNoi2Y53XSqWIbjtj7X9Laob+qwC2iVuQyRymYdqbbiqqX+CxfPWtwLACXfg==} hasBin: true peerDependencies: typescript: '*' dependencies: '@volar/vue-typescript': 0.38.1 - typescript: 4.7.3 + typescript: 4.7.4 dev: true /vue/3.2.37: @@ -12743,6 +12771,44 @@ packages: - '@types/react' dev: false + /vuepress-plugin-seo2/2.0.0-beta.84: + resolution: {integrity: sha512-ppmMTGrM36k34D/2EQfUrI3jj2ri2xaVfOcSceU2fY8IfphCCDy3mxv2jY99XBfiawvT12Q5pHg+KATSoOcErQ==} + dependencies: + '@vuepress/shared': 2.0.0-beta.48 + '@vuepress/utils': 2.0.0-beta.48 + vuepress-shared: 2.0.0-beta.84 + transitivePeerDependencies: + - supports-color + dev: true + + /vuepress-plugin-sitemap2/2.0.0-beta.84: + resolution: {integrity: sha512-pBDeBirYHrJQrQp84i0ksqq8vlicQiAsSc97DyCbXnRArymIKajZayapyn46q/nGAraOAIHu+6RcHRoLjM24pg==} + dependencies: + '@vuepress/shared': 2.0.0-beta.48 + '@vuepress/utils': 2.0.0-beta.48 + sitemap: 7.1.1 + vuepress-shared: 2.0.0-beta.84 + transitivePeerDependencies: + - supports-color + dev: true + + /vuepress-shared/2.0.0-beta.84: + resolution: {integrity: sha512-yfN2ng7X0oFlIPLX3AJMK8PuQYrqcKrKa8Gm77sH3bGKJjhKBr7UO9jXh/io3vBIoqd4vjiKHYyOHJqB/nIWoQ==} + dependencies: + '@vuepress/client': 2.0.0-beta.48 + '@vuepress/plugin-git': 2.0.0-beta.48 + '@vuepress/plugin-theme-data': 2.0.0-beta.48 + '@vuepress/shared': 2.0.0-beta.48 + '@vuepress/utils': 2.0.0-beta.48 + dayjs: 1.11.3 + execa: 5.1.1 + ora: 5.4.1 + vue: 3.2.37 + vue-router: 4.0.16_vue@3.2.37 + transitivePeerDependencies: + - supports-color + dev: true + /vuepress-vite/2.0.0-beta.48_ky4o5iv42nfwog2gkj2rnr6kla: resolution: {integrity: sha512-1TKEXg26W7VlTBU9J6BcJTW/NFtzkAveM33jccVs6HieYgvK7lyTpbhs5eRu9fUWawGR8ULa+b5kdk0dSLpjew==} hasBin: true