chore: add prettier as linter

This commit is contained in:
Mr.Hope
2023-04-26 11:57:55 +08:00
parent c0ca9e0966
commit ac4a955bd1
12 changed files with 153 additions and 97 deletions

View File

@@ -25,4 +25,4 @@ body:
description: 如果你请求更新现有文档,请在这里填写对应文档的链接
placeholder: https://hut.ao/
validations:
required: false
required: false

4
.husky/pre-commit Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
pnpm nano-staged

12
.prettierignore Normal file
View File

@@ -0,0 +1,12 @@
# VuePress Cache
**/.vuepress/.cache/**
# VuePress Temp
**/.vuepress/.temp/**
# VuePress static files
**/.vuepress/public/**
# Node modules
node_modules/
# pnpm lock file
pnpm-lock.yaml

View File

@@ -1,6 +1,6 @@
# Code of Conduct
> Snap Hutao is adapting the following rules to keep the community safety.
> Snap Hutao is adapting the following rules to keep the community safety.
When participating in our open source community, we want all members to respect and support each other. To ensure the comfort and safety of our community members, we have established the following code of conduct:

View File

@@ -1,13 +1,18 @@
# Snap.Hutao.Docs
Documents for [Snap Hutao project](https://github.com/DGP-Studio/Snap.Hutao). You can always view its live version at [https://hut.ao](https://hut.ao)
**Please check our [localization document](https://hut.ao/i18n.html) if you want to contribute to the document**
## How to Test
### Fist Time Installation
- Install [NodeJS 18](https://nodejs.org/en/download/)
- Use [GitHub Desktop](https://desktop.github.com/) or Git command to clone this repository (`git clone`)
- Run `npm install` in the root directory of the project
### Local Test
- Run `npm run docs:dev` in the root directory of the project
- The document will run at `http://localhost:8080` by default

View File

@@ -2,7 +2,7 @@ import { navbar } from "vuepress-theme-hope";
export const enNavbar = navbar([
"/en/",
{ text: "Document", icon: "article", link: "/en/features/"},
{ text: "Document", icon: "article", link: "/en/features/" },
{
text: "Download",
icon: "install",
@@ -11,6 +11,6 @@ export const enNavbar = navbar([
{
text: "Community",
icon: "community",
link: "/en/community.md"
link: "/en/community",
},
]);

View File

@@ -2,7 +2,7 @@ import { navbar } from "vuepress-theme-hope";
export const zhNavbar = navbar([
"/zh/",
{ text: "文档", icon: "article", link: "/zh/features/"},
{ text: "文档", icon: "article", link: "/zh/features/" },
{
text: "下载",
icon: "install",
@@ -11,6 +11,6 @@ export const zhNavbar = navbar([
{
text: "加入社区讨论",
icon: "community",
link: "/zh/community.md"
link: "/zh/community",
},
]);

View File

@@ -2,39 +2,39 @@ import { sidebar } from "vuepress-theme-hope";
export const enSidebar = sidebar({
"/en/": [
"",
{
icon: "workingDirectory",
text: "Project",
link: "project.md"
},
{
icon: "network",
text: "Localization",
link: "i18n.md"
},
{
icon: "play",
text: "Quick Start",
link: "quick-start.md"
},
{
icon: "read",
text: "Features",
prefix: "features/",
children: "structure"
},
{
icon: "advance",
text: "Advanced",
prefix: "advanced/",
children: "structure"
},
{
icon: "article",
text: "Statements",
prefix: "statements/",
children: "structure"
}
"",
{
icon: "workingDirectory",
text: "Project",
link: "project",
},
{
icon: "network",
text: "Localization",
link: "i18n",
},
{
icon: "play",
text: "Quick Start",
link: "quick-start",
},
{
icon: "read",
text: "Features",
prefix: "features/",
children: "structure",
},
{
icon: "advance",
text: "Advanced",
prefix: "advanced/",
children: "structure",
},
{
icon: "article",
text: "Statements",
prefix: "statements/",
children: "structure",
},
],
});

View File

@@ -2,39 +2,39 @@ import { sidebar } from "vuepress-theme-hope";
export const zhSidebar = sidebar({
"/zh/": [
"",
{
icon: "workingDirectory",
text: "项目介绍",
link: "project.md"
},
{
icon: "network",
text: "国际化支持",
link: "i18n.md"
},
{
icon: "play",
text: "快速开始",
link: "quick-start.md"
},
{
icon: "read",
text: "功能指南",
prefix: "features/",
children: "structure"
},
{
icon: "advance",
text: "高级",
prefix: "advanced/",
children: "structure"
},
{
icon: "article",
text: "声明和公告",
prefix: "statements/",
children: "structure"
}
"",
{
icon: "workingDirectory",
text: "项目介绍",
link: "project",
},
{
icon: "network",
text: "国际化支持",
link: "i18n",
},
{
icon: "play",
text: "快速开始",
link: "quick-start",
},
{
icon: "read",
text: "功能指南",
prefix: "features/",
children: "structure",
},
{
icon: "advance",
text: "高级",
prefix: "advanced/",
children: "structure",
},
{
icon: "article",
text: "声明和公告",
prefix: "statements/",
children: "structure",
},
],
});

View File

@@ -1,16 +1,5 @@
// place your custom styles here
header.navbar {
/*
// 隐藏导航栏外链图标
.navbar-items-wrapper > nav > div > a > span > svg.external-link-icon {
position: relative;
display: none;
color: var(--external-link-icon-color);
vertical-align: middle;
top: -1px;
}
*/
// 隐藏导航栏和导航栏菜单外链图标
svg.external-link-icon {
position: relative;
@@ -21,7 +10,7 @@ header.navbar {
}
}
.link-box{
.link-box {
ol {
display: inherit;
li {
@@ -32,30 +21,34 @@ header.navbar {
font-size: 16px;
border: 1px solid var(--c-border-dark);
border-radius: 5px;
transition: all .3s;
transition: all 0.3s;
text-align: right;
a {
display: inline-block;
position: relative;
width: 100%;
height: 100%;
opacity: .8;
opacity: 0.8;
padding: 10px 20px;
box-sizing: border-box;
transition: all .3s;
transition: all 0.3s;
strong {
position: absolute;
left: 25px;
}
&:hover{
&:hover {
opacity: 1;
text-decoration:none!important;
text-decoration: none !important;
}
}
&:hover{
&:hover {
transform: translate3d(0, -2px, 0);
box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
}
}
}
}
}

View File

@@ -7,18 +7,31 @@
"scripts": {
"docs:build": "vuepress build docs",
"docs:clean-dev": "vuepress dev docs --clean-cache",
"docs:dev": "vuepress dev docs"
"docs:dev": "vuepress dev docs",
"lint": "prettier --check --write .",
"prepare": "husky install"
},
"devDependencies": {
"@vuepress/client": "2.0.0-beta.61",
"@vuepress/bundler-vite": "2.0.0-beta.61",
"@vuepress/client": "2.0.0-beta.61",
"@vuepress/plugin-docsearch": "2.0.0-beta.61",
"@vuepress/plugin-google-analytics": "2.0.0-beta.61",
"vue": "^3.2.47",
"husky": "8.0.3",
"nano-staged": "0.8.0",
"prettier": "2.8.8",
"vue": "3.2.47",
"vuepress": "2.0.0-beta.61",
"vuepress-plugin-redirect": "2.0.0-beta.206",
"vuepress-theme-hope": "2.0.0-beta.206"
},
"engines": {
"node": ">=16.0.0"
},
"nano-staged": {
"*.md": [
"prettier --write"
]
},
"packageManager": "pnpm@8.3.1",
"pnpm": {
"peerDependencyRules": {

31
pnpm-lock.yaml generated
View File

@@ -13,8 +13,17 @@ devDependencies:
'@vuepress/plugin-google-analytics':
specifier: 2.0.0-beta.61
version: 2.0.0-beta.61
husky:
specifier: 8.0.3
version: 8.0.3
nano-staged:
specifier: 0.8.0
version: 0.8.0
prettier:
specifier: 2.8.8
version: 2.8.8
vue:
specifier: ^3.2.47
specifier: 3.2.47
version: 3.2.47
vuepress:
specifier: 2.0.0-beta.61
@@ -3909,6 +3918,12 @@ packages:
engines: {node: '>=14.18.0'}
dev: true
/husky@8.0.3:
resolution: {integrity: sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==}
engines: {node: '>=14'}
hasBin: true
dev: true
/iconv-lite@0.6.3:
resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==}
engines: {node: '>=0.10.0'}
@@ -4504,6 +4519,14 @@ packages:
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
dev: true
/nano-staged@0.8.0:
resolution: {integrity: sha512-QSEqPGTCJbkHU2yLvfY6huqYPjdBrOaTMKatO1F8nCSrkQGXeKwtCiCnsdxnuMhbg3DTVywKaeWLGCE5oJpq0g==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
hasBin: true
dependencies:
picocolors: 1.0.0
dev: true
/nanoid@3.3.6:
resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==}
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
@@ -4729,6 +4752,12 @@ packages:
resolution: {integrity: sha512-q44QFLhOhty2Bd0Y46fnYW0gD/cbVM9dUVtNTDKPcdXSMA7jfY+Jpd6rk3GB0lcQss0z5s/6CmVP0Z/hV+g6pw==}
dev: true
/prettier@2.8.8:
resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==}
engines: {node: '>=10.13.0'}
hasBin: true
dev: true
/pretty-bytes@5.6.0:
resolution: {integrity: sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==}
engines: {node: '>=6'}