diff --git a/.prettierignore b/.prettierignore
new file mode 100644
index 00000000..96cfb892
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1,10 @@
+# Ignore artifacts:
+build
+/dist
+/dev-dist
+coverage
+/src-tauri/target
+
+node_modules
+/public/api
+yarn.lock
\ No newline at end of file
diff --git a/.prettierrc.json b/.prettierrc.json
new file mode 100644
index 00000000..684c7f48
--- /dev/null
+++ b/.prettierrc.json
@@ -0,0 +1,23 @@
+{
+ "semi": false,
+ "printWidth": 120,
+ "trailingComma": "none",
+ "singleAttributePerLine": false,
+ "endOfLine": "auto",
+ "embeddedLanguageFormatting": "auto",
+ "arrowParens": "always",
+ "useTabs": false,
+ "tabWidth": 2,
+ "quoteProps": "as-needed",
+ "bracketSpacing": true,
+ "singleQuote": false,
+ "overrides": [
+ {
+ "files": ["**/*.js", "**/*.ts", "**/*.vue"],
+ "options": {
+ "singleQuote": true
+ }
+ }
+ ],
+ "proseWrap": "preserve"
+}
diff --git a/.vitepress/config.ts b/.vitepress/config.ts
index 98326d19..905cc74b 100644
--- a/.vitepress/config.ts
+++ b/.vitepress/config.ts
@@ -1,175 +1,165 @@
-import { DefaultTheme, defineConfig } from "vitepress"
-import fs from "fs"
-import path from "path"
+import { DefaultTheme, defineConfig } from 'vitepress'
+import fs from 'fs'
interface ThemeConfig extends DefaultTheme.Config {
[key: string]: any
}
// 原始文档日期
-const ORIGIN_DOCUMENT_DATE = "2023年05月13日"
-const ORIGIN_DELTA_DOCUMENT_DATE = "2023年08月15日"
+const ORIGIN_DOCUMENT_DATE = '2023年05月13日'
+const ORIGIN_DELTA_DOCUMENT_DATE = '2023年08月15日'
const MATCH_RELEASE_REG = /- \[(v[\d.]*)\]\((\d*).md\)/g
-const base = "/MagiskChineseDocument/"
+const base = '/MagiskChineseDocument/'
-const releaseItems: (
- | DefaultTheme.NavItemChildren
- | DefaultTheme.NavItemWithLink
-)[] = []
+const releaseItems: (DefaultTheme.NavItemChildren | DefaultTheme.NavItemWithLink)[] = []
const NORMAL_LINKS: DefaultTheme.NavItem[] | DefaultTheme.SidebarItem[] = [
{
- text: "面向普通用户",
+ text: '面向普通用户',
// collapsed: false,
items: [
- { text: "安装说明", link: "/install.html" },
- { text: "常见问题", link: "/faq.html" },
+ { text: '安装说明', link: '/install.html' },
+ { text: '常见问题', link: '/faq.html' },
{
- text: "发布日志",
- link: "/releases/",
+ text: '发布日志',
+ link: '/releases/',
items: releaseItems,
- collapsed: true,
+ collapsed: true
},
- { text: "Magisk 更新日志", link: "/changes.html" },
- ],
- },
+ { text: 'Magisk 更新日志', link: '/changes.html' }
+ ]
+ }
]
const DEVELOPER_LINKS: DefaultTheme.NavItem[] | DefaultTheme.SidebarItem[] = [
{
- text: "面向开发人员",
+ text: '面向开发人员',
// collapsed: false,
items: [
- { text: "构建和开发 Magisk", link: "/build.html" },
- { text: "开发者指南", link: "/guides.html" },
- { text: "Magisk 工具", link: "/tools.html" },
- { text: "内部细节", link: "/details.html" },
- { text: "Android 引导诡计", link: "/boot.html" },
- ],
- },
+ { text: '构建和开发 Magisk', link: '/build.html' },
+ { text: '开发者指南', link: '/guides.html' },
+ { text: 'Magisk 工具', link: '/tools.html' },
+ { text: '内部细节', link: '/details.html' },
+ { text: 'Android 引导诡计', link: '/boot.html' }
+ ]
+ }
]
const DELTA_LINKS: DefaultTheme.NavItem[] | DefaultTheme.SidebarItem[] = [
{
- text: "Magisk Delta",
+ text: 'Magisk Delta',
// collapsed: false,
- activeMatch: "/delta/",
+ activeMatch: '/delta/',
items: [
- { text: "常见问题", link: "/delta/faq.html" },
- { text: "内部文档", link: "/delta/internal-guide.html" },
- ],
- },
+ { text: '常见问题', link: '/delta/faq.html' },
+ { text: '内部文档', link: '/delta/internal-guide.html' }
+ ]
+ }
]
const sidebar: DefaultTheme.Sidebar = {
- "/delta/": DELTA_LINKS,
+ '/delta/': DELTA_LINKS
}
-let allItems: DefaultTheme.NavItem[] | DefaultTheme.SidebarItem[] = [
- ...NORMAL_LINKS,
- ...DEVELOPER_LINKS,
-]
+let allItems: DefaultTheme.NavItem[] | DefaultTheme.SidebarItem[] = [...NORMAL_LINKS, ...DEVELOPER_LINKS]
// 生成侧边栏
for (let group of allItems)
- if (group.items)
- for (let item of group.items)
- if (item.link) sidebar[item.link.replace(".html", "")] = [group]
+ if (group.items) for (let item of group.items) if (item.link) sidebar[item.link.replace('.html', '')] = [group]
// 匹配版本号
-const releaseFileContent = fs.readFileSync("./releases/index.md", "utf8")
+const releaseFileContent = fs.readFileSync('./releases/index.md', 'utf8')
for (const iterator of releaseFileContent.matchAll(MATCH_RELEASE_REG)) {
const verName = iterator[1]
const verCode = iterator[2]
releaseItems.push({
text: verName,
- link: `/releases/${verCode}.html`,
+ link: `/releases/${verCode}.html`
})
}
export default defineConfig({
- lang: "zh-CN",
- title: "Magisk 中文文档",
- description: "Magisk 中文文档,由 Jesse205 手动机翻。",
+ lang: 'zh-CN',
+ title: 'Magisk 中文文档',
+ description: 'Magisk 中文文档,由 Jesse205 手动机翻。',
base,
ignoreDeadLinks: true,
lastUpdated: true,
head: [
- ["link", { rel: "icon", href: `${base}favicon.ico`, sizes: "any" }],
+ ['link', { rel: 'icon', href: `${base}favicon.ico`, sizes: 'any' }],
[
- "link",
+ 'link',
{
- rel: "apple-touch-icon",
- href: `${base}apple-touch-icon.png`,
- },
- ],
+ rel: 'apple-touch-icon',
+ href: `${base}apple-touch-icon.png`
+ }
+ ]
],
themeConfig: {
originDocumentDate: ORIGIN_DOCUMENT_DATE,
- logo: "/favicon.ico",
- outlineTitle: "本页内容",
- lastUpdatedText: "更新时间",
- darkModeSwitchLabel: "深色模式",
- sidebarMenuLabel: "菜单",
- returnToTopLabel: "回到顶部",
+ logo: '/favicon.ico',
+ outlineTitle: '本页内容',
+ lastUpdatedText: '更新时间',
+ darkModeSwitchLabel: '深色模式',
+ sidebarMenuLabel: '菜单',
+ returnToTopLabel: '回到顶部',
docFooter: {
- prev: "上一篇",
- next: "下一篇",
+ prev: '上一篇',
+ next: '下一篇'
},
outline: [2, 3],
socialLinks: [
{
icon: {
- svg: '',
+ svg: ''
},
- link: "https://gitee.com/Jesse205/magisk-chinese-document",
+ link: 'https://gitee.com/Jesse205/magisk-chinese-document'
},
{
- icon: "github",
- link: "https://github.com/Jesse205/MagiskChineseDocument",
- },
+ icon: 'github',
+ link: 'https://github.com/Jesse205/MagiskChineseDocument'
+ }
],
nav: [
...NORMAL_LINKS,
...DEVELOPER_LINKS,
...DELTA_LINKS,
- { text: "官方文档", link: "https://topjohnwu.github.io/Magisk/" },
+ { text: '官方文档', link: 'https://topjohnwu.github.io/Magisk/' }
] as DefaultTheme.NavItem[],
sidebar,
footer: {
message: `原始 Magisk 文档版本: ${ORIGIN_DOCUMENT_DATE}
原始 Magisk Delta 文档版本: ${ORIGIN_DELTA_DOCUMENT_DATE}
- 在 GPL-3.0 许可下发布`,
+ 在 GPL-3.0 许可下发布`
},
editLink: {
- pattern:
- "https://gitee.com/Jesse205/magisk-chinese-document/edit/master/:path",
- text: "在 Gitee 上编辑此页面",
+ pattern: 'https://gitee.com/Jesse205/magisk-chinese-document/edit/master/:path',
+ text: '在 Gitee 上编辑此页面'
},
search: {
- provider: "local",
+ provider: 'local',
options: {
translations: {
button: {
- buttonText: "搜索",
+ buttonText: '搜索'
},
modal: {
- displayDetails: "显示具详情信息",
- resetButtonTitle: "清空内容",
- backButtonTitle: "关闭搜索",
- noResultsText: "未找到",
+ displayDetails: '显示具详情信息',
+ resetButtonTitle: '清空内容',
+ backButtonTitle: '关闭搜索',
+ noResultsText: '未找到',
footer: {
- selectText: "选择",
- selectKeyAriaLabel: "进入",
- navigateText: "导航",
- navigateUpKeyAriaLabel: "向上",
- navigateDownKeyAriaLabel: "向下",
- closeText: "关闭",
- closeKeyAriaLabel: "退出",
- },
- },
- },
- },
+ selectText: '选择',
+ selectKeyAriaLabel: '进入',
+ navigateText: '导航',
+ navigateUpKeyAriaLabel: '向上',
+ navigateDownKeyAriaLabel: '向下',
+ closeText: '关闭',
+ closeKeyAriaLabel: '退出'
+ }
+ }
+ }
+ }
},
- externalLinkIcon: true,
- } as ThemeConfig,
+ externalLinkIcon: true
+ } as ThemeConfig
})