feat(init): initialize new project

This commit is contained in:
2025-11-15 22:58:33 +08:00
commit ec99b0cf6a
16 changed files with 285 additions and 0 deletions

25
.gitignore vendored Normal file
View File

@@ -0,0 +1,25 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
pnpm-lock.yaml
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

1
.husky/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
_

0
.husky/pre-commit Normal file
View File

9
.prettierignore Normal file
View File

@@ -0,0 +1,9 @@
dist/
solid-router/
pnpm-lock.yaml
.husky
.prettierignore
.gitignore
*.ttf
*.otf
*.woff2

64
.prettierrc.cjs Normal file
View File

@@ -0,0 +1,64 @@
// Prettier 配置文件CommonJS 写法)
// 保存文件后 Prettier 插件会自动读取并格式化项目代码
module.exports = {
// 使用的 Prettier 插件,这里启用 TailwindCSS 排序插件
plugins: ["prettier-plugin-tailwindcss"],
// 每行最大长度,超过后自动换行
printWidth: 80,
// 每个缩进层级使用的空格数
tabWidth: 2,
// 使用制表符tab而不是空格进行缩进
useTabs: true,
// 每句结尾加分号
semi: true,
// 使用单引号而不是双引号
singleQuote: true,
// 对象属性引号的使用规则:
// as-needed仅在必要时添加
// consistent同一对象中保持一致
// preserve保持原样
quoteProps: "as-needed",
// 在 JSX 中是否使用单引号
jsxSingleQuote: false,
// 多行结构时是否在末尾加逗号
// 可选值none | es5 | all
trailingComma: "es5",
// 在对象字面量中,是否在大括号之间加空格
bracketSpacing: true,
// 标签的 `>` 是否与最后一行标签同一行
bracketSameLine: false,
// 箭头函数参数是否总是加括号
// always总是加如 (x) => x
// avoid当只有一个参数时省略括号如 x => x
arrowParens: "always",
// 控制 Markdown 文本的换行策略
// preserve保持原样
// never不换行
// always超过 printWidth 自动换行
proseWrap: "preserve",
// 控制 HTML 空白敏感度
// css遵循 CSS 的 display 属性
// strict严格保留
// ignore忽略空白
htmlWhitespaceSensitivity: "css",
// 在 Vue 文件的 <script> 和 <style> 标签内是否缩进
vueIndentScriptAndStyle: false,
// 文件换行符风格
// 可选值auto | lf | crlf | cr
endOfLine: "lf",
};

12
README.md Normal file
View File

@@ -0,0 +1,12 @@
## Usage
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
### 提交格式
- feat: 用于添加新的功能或特性。
- fix: 用于修复 Bug。
- chore: 用于一些日常的任务,例如更新依赖、构建工具的更改等。
- docs: 用于文档的修改。
- style: 用于格式(不影响代码逻辑的修改,如空格、格式等)。
- refactor: 用于代码重构(修改了代码结构,但不改变外部行为)。
- test: 用于添加或修改测试。

16
index.html Normal file
View File

@@ -0,0 +1,16 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>导航站</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>

36
package.json Normal file
View File

@@ -0,0 +1,36 @@
{
"name": "cn.kmux.navsite",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"preview": "vite preview",
"prepare": "husky",
"cm": "cz"
},
"dependencies": {
"@radix-ui/themes": "^3.2.1",
"solid-js": "^1.9.10",
"tailwindcss": "^4.1.17"
},
"devDependencies": {
"@eslint/js": "^9.39.1",
"@tailwindcss/vite": "^4.1.17",
"@types/node": "^24.10.0",
"cz-conventional-changelog": "^3.3.0",
"husky": "^9.1.7",
"prettier": "^3.6.2",
"prettier-plugin-tailwindcss": "^0.7.1",
"typescript": "~5.9.3",
"typescript-eslint": "^8.46.4",
"vite": "^7.2.2",
"vite-plugin-solid": "^2.11.10"
},
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
}
}

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

5
src/App.tsx Normal file
View File

@@ -0,0 +1,5 @@
function App() {
return <div></div>;
}
export default App;

11
src/index.css Normal file
View File

@@ -0,0 +1,11 @@
@import 'tailwindcss';
@plugin 'tailwind-scrollbar';
@import "@radix-ui/themes/styles.css";
html,
body,
#root {
@apply flex h-full w-full items-center;
}
@custom-variant dark (&:where(.dark, .dark *));

16
src/index.tsx Normal file
View File

@@ -0,0 +1,16 @@
/* @refresh reload */
import { render } from 'solid-js/web';
import './index.css';
import App from './App.tsx';
import { Theme } from '@radix-ui/themes';
const root = document.getElementById('root');
render(
() => (
<Theme>
<App />
</Theme>
),
root!
);

34
tsconfig.app.json Normal file
View File

@@ -0,0 +1,34 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"~/*": ["src/*"]
},
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"target": "ES2022",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"types": ["vite/client"],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "preserve",
"jsxImportSource": "solid-js",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["src"]
}

7
tsconfig.json Normal file
View File

@@ -0,0 +1,7 @@
{
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
]
}

26
tsconfig.node.json Normal file
View File

@@ -0,0 +1,26 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"target": "ES2023",
"lib": ["ES2023"],
"module": "ESNext",
"types": ["node"],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["vite.config.ts"]
}

23
vite.config.ts Normal file
View File

@@ -0,0 +1,23 @@
import { defineConfig } from 'vite';
import path from 'path';
import solid from 'vite-plugin-solid';
import tailwind from '@tailwindcss/vite';
export default defineConfig({
plugins: [solid(), tailwind()],
server: {
host: true,
allowedHosts: ['local.kmux.cn'],
proxy: {
'/api': {
target: 'http://local.kmux.cn:8080',
changeOrigin: true,
},
},
},
resolve: {
alias: {
'~': path.resolve(__dirname, 'src'),
},
},
});