Skip to content

Commit

Permalink
Merge pull request #2 from CQUPTMirror/zhouhang
Browse files Browse the repository at this point in the history
feat: 功能优化与代码重构
  • Loading branch information
Sajotim authored Nov 17, 2024
2 parents 0372fec + 4f332e6 commit 96dae5b
Show file tree
Hide file tree
Showing 68 changed files with 8,632 additions and 4,669 deletions.
82 changes: 0 additions & 82 deletions .eslintrc.js

This file was deleted.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ local.json
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Editor directories and files
.idea
Expand All @@ -22,3 +23,6 @@ yarn-error.log*
*.njsproj
*.sln
*.sw?

# pnpm specific files
.pnpm-store/
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
shamefully-hoist=true
strict-peer-dependencies=false
auto-install-peers=true
9 changes: 9 additions & 0 deletions docs/theme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# 主题切换功能说明

## 功能概述
该主题切换系统支持亮色/暗色模式,具有以下特性:
- 自动跟随系统主题
- 根据时间自动切换(晚6点到早6点自动切换为暗色模式)
- 支持手动切换并记住用户偏好

## 使用方法
8 changes: 8 additions & 0 deletions env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/// <reference types="vite/client" />

declare module '*.vue' {
import type { DefineComponent } from 'vue'

const component: DefineComponent<unknown, unknown, any>
export default component
}
13 changes: 13 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import antfu from '@antfu/eslint-config'

export default antfu({
// 启用 TypeScript 支持
typescript: true,
// 启用 Vue 支持
vue: true,
// 启用 JSON 支持
jsonc: true,
// 启用 YAML 支持
yaml: true,
// 覆盖一些规则
})
17 changes: 17 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<script>
(function() {
try {
const savedTheme = localStorage.getItem('theme-preference')
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches
const hour = new Date().getHours()
const isNight = hour >= 18 || hour < 6

const shouldBeDark = savedTheme
? JSON.parse(savedTheme)
: prefersDark || isNight

if (shouldBeDark)
document.documentElement.classList.add('dark')
} catch (e) {}
})()
</script>
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>重庆邮电大学开源镜像站 | CQUPT OpenSource Mirror</title>
Expand Down
102 changes: 48 additions & 54 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,72 +1,66 @@
{
"name": "template-vue3",
"description": "A template of vue3",
"type": "module",
"version": "0.0.0",
"description": "A template of vue3",
"scripts": {
"dev": "vite",
"build": "vue-tsc --noEmit --skipLibCheck && vite build",
"only-build": "vite build",
"serve": "vite preview",
"commit": "git-cz"
"build": "pnpm vue-tsc --noEmit && pnpm vite build",
"preview": "pnpm vite preview",
"lint": "eslint . --cache",
"format": "prettier --write ."
},
"dependencies": {
"ant-design-vue": "^2.1.6",
"axios": "^0.21.1",
"js-cookie": "^2.2.1",
"sass": "^1.34.0",
"vue": "3.0.11",
"vue-router": "^4.0.5",
"vuex": "^4.0.0"
"@unocss/reset": "^0.58.5",
"@vueuse/core": "^10.7.2",
"ant-design-vue": "^4.0.0",
"axios": "^1.6.7",
"js-cookie": "^3.0.5",
"naive-ui": "^2.40.1",
"pinia": "^2.1.7",
"sass": "^1.71.0",
"vue": "^3.4.19",
"vue-router": "^4.2.5"
},
"devDependencies": {
"@commitlint/cli": "^8.2.0",
"@commitlint/config-conventional": "^8.2.0",
"@soerenmartius/vue3-clipboard": "^0.1.2",
"@types/js-cookie": "^2.2.6",
"@types/node": "^14.14.41",
"@typescript-eslint/eslint-plugin": "^4.19.0",
"@typescript-eslint/parser": "^4.19.0",
"@vitejs/plugin-legacy": "^1.3.1",
"@vitejs/plugin-vue": "^1.1.5",
"@vitejs/plugin-vue-jsx": "^1.1.2",
"@vue/compiler-sfc": "^3.0.11",
"@vue/eslint-config-standard": "^4.0.0",
"@vue/eslint-config-typescript": "^4.0.0",
"@vueuse/core": "^4.8.3",
"body-parser": "^1.19.0",
"commitizen": "^4.2.3",
"conventional-changelog-cli": "^2.1.1",
"cross-env": "^7.0.3",
"dotenv": "^8.2.0",
"eslint": "^7.22.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-vue": "^7.8.0",
"lint-staged": "^10.5.4",
"stylelint": "^13.12.0",
"stylelint-config-standard": "^21.0.0",
"stylelint-order": "^4.1.0",
"typescript": "^4.1.3",
"vite": "^2.1.0",
"vue-eslint-parser": "^7.6.0",
"vue-tsc": "^0.0.8",
"yorkie": "^2.0.0"
"@antfu/eslint-config": "^2.8.0",
"@commitlint/cli": "^18.6.1",
"@commitlint/config-conventional": "^18.6.2",
"@iconify-json/carbon": "^1.2.4",
"@iconify-json/devicon": "^1.2.5",
"@iconify-json/file-icons": "^1.2.0",
"@iconify-json/logos": "^1.2.3",
"@iconify-json/ri": "^1.2.3",
"@iconify-json/simple-icons": "^1.2.11",
"@iconify/utils": "^2.1.33",
"@types/js-cookie": "^3.0.6",
"@types/node": "^20.11.24",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"@unocss/preset-attributify": "^0.58.9",
"@unocss/preset-icons": "^0.58.9",
"@unocss/preset-uno": "^0.58.9",
"@vitejs/plugin-vue": "^5.0.4",
"@vitejs/plugin-vue-jsx": "^3.1.0",
"@vue/eslint-config-typescript": "^12.0.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-vue": "^9.21.1",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
"typescript": "^5.3.3",
"unocss": "^0.58.9",
"vite": "^5.1.3",
"vue-tsc": "^1.8.27"
},
"gitHooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint -e"
},
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"lint-staged": {
"*.{js,vue,ts}": [
"eslint --ext .ts,.vue,.tsx src",
"git add"
"*.{js,vue,ts,tsx}": [
"eslint --fix",
"prettier --write"
]
}
}
Loading

0 comments on commit 96dae5b

Please sign in to comment.