|
1 | | -"use strict"; |
| 1 | +import { fileURLToPath } from "url"; |
| 2 | +import { defineConfig as defineConfigBase } from "vitepress"; |
| 3 | +import { withMermaid } from "vitepress-plugin-mermaid"; |
| 4 | +import { Module } from "module"; |
| 5 | +import markdownItTaskLists from "markdown-it-task-lists"; |
| 6 | +import markdownItFootnote from "markdown-it-footnote"; |
| 7 | +import markdownItHeaderShift from "./lib/markdown-it-plugin-header-shift.mjs"; |
| 8 | +import * as plantumlLanguage from "./lib/plantuml.tmlanguage.mjs"; |
| 9 | +const __filename = fileURLToPath(import.meta.url); |
| 10 | +const pkg = Module.createRequire(__filename)("../package.json"); |
2 | 11 |
|
| 12 | +const repoUrl = pkg.repository.url |
| 13 | + .replace(/\.git$/u, "") |
| 14 | + .replace(/^git\+/u, ""); |
| 15 | + |
| 16 | +/** @type {import("vitepress").DefaultTheme.Sidebar} */ |
3 | 17 | const links = { |
4 | | - "/documents/forJava/Javaコーディング規約_for_11.html": [ |
5 | | - "/documents/forJava/", |
6 | | - "/documents/forJava/Javaコーディング規約.html", |
7 | | - "/documents/forJava/Javaコーディング規約_for_11.html", |
8 | | - ], |
9 | | - "/documents/forJava/Javaコーディング規約_for_8.html": [ |
10 | | - "/documents/forJava/", |
11 | | - "/documents/forJava/Javaコーディング規約.html", |
12 | | - "/documents/forJava/Javaコーディング規約_for_8.html", |
13 | | - ], |
14 | 18 | "/documents/forJava/": [ |
15 | | - "/documents/forJava/", |
16 | | - "/documents/forJava/Javaコーディング規約.html", |
| 19 | + { text: "Home", link: "/documents/forJava/" }, |
| 20 | + { |
| 21 | + text: "Javaコーディング規約", |
| 22 | + link: "/documents/forJava/Javaコーディング規約.html", |
| 23 | + }, |
| 24 | + { |
| 25 | + text: "For Java11", |
| 26 | + link: "/documents/forJava/Javaコーディング規約_for_11.html", |
| 27 | + }, |
| 28 | + { |
| 29 | + text: "For Java8", |
| 30 | + link: "/documents/forJava/Javaコーディング規約_for_8.html", |
| 31 | + }, |
17 | 32 | ], |
18 | 33 | "/documents/forSQL/": [ |
19 | | - "/documents/forSQL/", |
20 | | - "/documents/forSQL/SQLコーディング規約(Oracle).html", |
21 | | - "/documents/forSQL/SQLコーディング規約(PostgreSQL).html", |
| 34 | + { text: "Home", link: "/documents/forSQL/" }, |
| 35 | + { |
| 36 | + text: "SQLコーディング規約(PostgreSQL)", |
| 37 | + link: "/documents/forSQL/SQLコーディング規約(PostgreSQL).html", |
| 38 | + }, |
| 39 | + { |
| 40 | + text: "SQLコーディング規約(Oracle)", |
| 41 | + link: "/documents/forSQL/SQLコーディング規約(Oracle).html", |
| 42 | + }, |
22 | 43 | ], |
23 | 44 | "/documents/forAWSResource/": [ |
24 | | - "/documents/forAWSResource/", |
25 | | - "/documents/forAWSResource/AWSインフラリソース命名規約.html", |
| 45 | + { text: "Home", link: "/documents/forAWSResource/" }, |
| 46 | + { |
| 47 | + text: "AWSインフラ命名規約", |
| 48 | + link: "/documents/forAWSResource/AWSインフラリソース命名規約.html", |
| 49 | + }, |
26 | 50 | ], |
27 | 51 | "/documents/forOpenAPISpecification/": [ |
28 | | - "/documents/forOpenAPISpecification/", |
29 | | - "/documents/forOpenAPISpecification/OpenAPI_Specification_2.0.html", |
30 | | - "/documents/forOpenAPISpecification/OpenAPI_Specification_3.0.3.html", |
| 52 | + { text: "Home", link: "/documents/forOpenAPISpecification/" }, |
| 53 | + { |
| 54 | + text: "OpenAPI Specification 2.0規約", |
| 55 | + link: "/documents/forOpenAPISpecification/OpenAPI_Specification_2.0.html", |
| 56 | + }, |
| 57 | + { |
| 58 | + text: "OpenAPI Specification 3.0.3規約", |
| 59 | + link: "/documents/forOpenAPISpecification/OpenAPI_Specification_3.0.3.html", |
| 60 | + }, |
31 | 61 | ], |
32 | 62 | "/documents/forGitBranch/": [ |
33 | | - "/documents/forGitBranch/", |
34 | | - "/documents/forGitBranch/git_branch_standards.html", |
35 | | - "/documents/forGitBranch/merge_develop_to_feature.html", |
36 | | - "/documents/forGitBranch/merge_feature_to_develop.html", |
37 | | - "/documents/forGitBranch/commit_message_rule.html", |
38 | | - "/documents/forGitBranch/vscode_git_ope.html", |
| 63 | + { text: "Home", link: "/documents/forGitBranch/" }, |
| 64 | + { |
| 65 | + text: "Gitブランチフロー規約", |
| 66 | + link: "/documents/forGitBranch/git_branch_standards.html", |
| 67 | + }, |
| 68 | + { |
| 69 | + text: "機能ブランチに開発ブランチの変更を取り込む方法", |
| 70 | + link: "/documents/forGitBranch/merge_develop_to_feature.html", |
| 71 | + }, |
| 72 | + { |
| 73 | + text: "開発ブランチに機能ブランチの変更を取り込む方法", |
| 74 | + link: "/documents/forGitBranch/merge_feature_to_develop.html", |
| 75 | + }, |
| 76 | + { |
| 77 | + text: "コミットメッセージ規約", |
| 78 | + link: "/documents/forGitBranch/commit_message_rule.html", |
| 79 | + }, |
| 80 | + { |
| 81 | + text: "VSCode上でのGit操作", |
| 82 | + link: "/documents/forGitBranch/vscode_git_ope.html", |
| 83 | + }, |
39 | 84 | ], |
40 | 85 | "/documents/forSlack/": [ |
41 | | - "/documents/forSlack/", |
42 | | - "/documents/forSlack/slack_usage_guidelines.html", |
| 86 | + { text: "Home", link: "/documents/forSlack/" }, |
| 87 | + { |
| 88 | + text: "Slack利用ガイドライン", |
| 89 | + link: "/documents/forSlack/slack_usage_guidelines.html", |
| 90 | + }, |
43 | 91 | ], |
44 | 92 | }; |
45 | | -console.log(links); |
46 | 93 |
|
47 | | -module.exports = { |
48 | | - base: "/coding-standards/", |
| 94 | +/** |
| 95 | + * @typedef {import('vitepress').UserConfig<import('vitepress').DefaultTheme.Config>} VitepressConfig |
| 96 | + */ |
| 97 | +/** |
| 98 | + * @param {VitepressConfig} config config |
| 99 | + * @returns {VitepressConfig} config |
| 100 | + */ |
| 101 | +function defineConfig(config) { |
| 102 | + return withMermaid(defineConfigBase(config)); |
| 103 | +} |
| 104 | + |
| 105 | +export default defineConfig({ |
49 | 106 | title: "Future Enterprise Coding Standards", |
50 | 107 | description: |
51 | 108 | "フューチャー株式会社が作成するエンタープライズ領域に特化したコーディング規約", |
52 | | - dest: "docs", |
53 | | - serviceWorker: false, |
| 109 | + outDir: "docs", |
| 110 | + ignoreDeadLinks: "localhostLinks", |
54 | 111 | markdown: { |
55 | 112 | lineNumbers: true, |
56 | | - extendMarkdown: (md) => { |
57 | | - md.use(require("./markdown-it-plugin-header-shift")); |
58 | | - md.use(require("markdown-it-task-lists")); |
| 113 | + config(md) { |
| 114 | + md.use(markdownItHeaderShift); |
| 115 | + md.use(markdownItTaskLists); |
| 116 | + md.use(markdownItFootnote); |
59 | 117 | }, |
60 | | - plugins: ["vuepress-plugin-mermaidjs"], |
| 118 | + languages: [plantumlLanguage], |
61 | 119 | }, |
62 | | - head: [], |
63 | 120 | locales: { |
64 | | - "/": { |
| 121 | + root: { |
65 | 122 | lang: "ja", |
66 | 123 | }, |
67 | 124 | }, |
68 | | - plugins: ["vuepress-plugin-mermaidjs"], |
| 125 | + head: [["link", { rel: "icon", href: `/coding-standards/logo.png` }]], |
| 126 | + srcExclude: ["./README.md"], |
| 127 | + base: "/coding-standards/", |
69 | 128 | themeConfig: { |
70 | | - logo: "/images/logo.svg", |
71 | | - repo: "https://github.com/future-architect/coding-standards", |
72 | | - docsRepo: "https://github.com/future-architect/coding-standards", |
73 | | - docsBranch: "master", |
74 | | - editLinks: true, |
75 | | - lastUpdated: true, |
| 129 | + siteTitle: "Future Enterprise <wbr>Coding Standards", |
| 130 | + logo: { |
| 131 | + light: "/images/logo.svg", |
| 132 | + dark: "/images/logo-dark.svg", |
| 133 | + }, |
| 134 | + footer: { |
| 135 | + copyright: |
| 136 | + "©2015 - 2024 Future Enterprise Coding Standards - Future Corporation", |
| 137 | + }, |
| 138 | + search: { |
| 139 | + provider: "local", |
| 140 | + options: { |
| 141 | + detailedView: true, |
| 142 | + }, |
| 143 | + }, |
| 144 | + editLink: { |
| 145 | + pattern: repoUrl + "/edit/master/:path", |
| 146 | + }, |
| 147 | + outline: { |
| 148 | + level: "deep", |
| 149 | + }, |
76 | 150 | nav: [ |
77 | 151 | { |
78 | 152 | text: "Java", |
@@ -167,7 +241,7 @@ module.exports = { |
167 | 241 | }, |
168 | 242 | { |
169 | 243 | text: "サンプルプロジェクト", |
170 | | - link: "/documents/forGitBranch/future_muscle_partner/", |
| 244 | + link: "/documents/forMarkdown/future_muscle_partner/", |
171 | 245 | }, |
172 | 246 | ], |
173 | 247 | }, |
@@ -216,6 +290,14 @@ module.exports = { |
216 | 290 | ], |
217 | 291 | }, |
218 | 292 | ], |
| 293 | + |
219 | 294 | sidebar: links, |
| 295 | + |
| 296 | + socialLinks: [ |
| 297 | + { |
| 298 | + icon: "github", |
| 299 | + link: repoUrl, |
| 300 | + }, |
| 301 | + ], |
220 | 302 | }, |
221 | | -}; |
| 303 | +}); |
0 commit comments