commit ec99b0cf6a0b97ba30ca23adacc414881baea60d Author: zhilv Date: Sat Nov 15 22:58:33 2025 +0800 feat(init): initialize new project diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7f2e335 --- /dev/null +++ b/.gitignore @@ -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? diff --git a/.husky/.gitignore b/.husky/.gitignore new file mode 100644 index 0000000..c9cdc63 --- /dev/null +++ b/.husky/.gitignore @@ -0,0 +1 @@ +_ \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..e69de29 diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..260f803 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,9 @@ +dist/ +solid-router/ +pnpm-lock.yaml +.husky +.prettierignore +.gitignore +*.ttf +*.otf +*.woff2 \ No newline at end of file diff --git a/.prettierrc.cjs b/.prettierrc.cjs new file mode 100644 index 0000000..2500361 --- /dev/null +++ b/.prettierrc.cjs @@ -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 文件的 + + + \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..7d7ec66 --- /dev/null +++ b/package.json @@ -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" + } + } +} diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..252c802 Binary files /dev/null and b/public/favicon.ico differ diff --git a/src/App.tsx b/src/App.tsx new file mode 100644 index 0000000..d09971e --- /dev/null +++ b/src/App.tsx @@ -0,0 +1,5 @@ +function App() { + return
首页
; +} + +export default App; diff --git a/src/index.css b/src/index.css new file mode 100644 index 0000000..1606332 --- /dev/null +++ b/src/index.css @@ -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 *)); diff --git a/src/index.tsx b/src/index.tsx new file mode 100644 index 0000000..043ed96 --- /dev/null +++ b/src/index.tsx @@ -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( + () => ( + + + + ), + root! +); diff --git a/tsconfig.app.json b/tsconfig.app.json new file mode 100644 index 0000000..bb6b59c --- /dev/null +++ b/tsconfig.app.json @@ -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"] +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..1ffef60 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,7 @@ +{ + "files": [], + "references": [ + { "path": "./tsconfig.app.json" }, + { "path": "./tsconfig.node.json" } + ] +} diff --git a/tsconfig.node.json b/tsconfig.node.json new file mode 100644 index 0000000..8a67f62 --- /dev/null +++ b/tsconfig.node.json @@ -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"] +} diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000..5f254c9 --- /dev/null +++ b/vite.config.ts @@ -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'), + }, + }, +});