From ec99b0cf6a0b97ba30ca23adacc414881baea60d Mon Sep 17 00:00:00 2001 From: zhilv Date: Sat, 15 Nov 2025 22:58:33 +0800 Subject: [PATCH] feat(init): initialize new project --- .gitignore | 25 ++++++++++++++++++ .husky/.gitignore | 1 + .husky/pre-commit | 0 .prettierignore | 9 +++++++ .prettierrc.cjs | 64 +++++++++++++++++++++++++++++++++++++++++++++ README.md | 12 +++++++++ index.html | 16 ++++++++++++ package.json | 36 +++++++++++++++++++++++++ public/favicon.ico | Bin 0 -> 4286 bytes src/App.tsx | 5 ++++ src/index.css | 11 ++++++++ src/index.tsx | 16 ++++++++++++ tsconfig.app.json | 34 ++++++++++++++++++++++++ tsconfig.json | 7 +++++ tsconfig.node.json | 26 ++++++++++++++++++ vite.config.ts | 23 ++++++++++++++++ 16 files changed, 285 insertions(+) create mode 100644 .gitignore create mode 100644 .husky/.gitignore create mode 100644 .husky/pre-commit create mode 100644 .prettierignore create mode 100644 .prettierrc.cjs create mode 100644 README.md create mode 100644 index.html create mode 100644 package.json create mode 100644 public/favicon.ico create mode 100644 src/App.tsx create mode 100644 src/index.css create mode 100644 src/index.tsx create mode 100644 tsconfig.app.json create mode 100644 tsconfig.json create mode 100644 tsconfig.node.json create mode 100644 vite.config.ts 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 0000000000000000000000000000000000000000..252c802a7108a656f1203a57ad1b8b81bb7e44b2 GIT binary patch literal 4286 zcmeHLYg3a)6i)v^KlQU8`=!%A(3vvR(HUoKrCM(#h(*BbSj1{8UI3v2MYN?@MJ`?n z7-A$42$zJ5oClS#4?>}$HSa`-+gz_dCqxu_bech zyhlIl)=5|^k-aaGd?1lXJ|v}2k}y*CoePaE7rc}I1OtJ9A6)%@`29Xo>c3JSXpn0F z^klNwrkT4iu%~~?{8wST!G7i80BqJF%#4pW`ScOI?m5mE<1SPYHWs4+*N<$*-NaqE9Q7$=$HP%{ zU_A=rK7;(^HWbEfz_ooF(Uf-@4OdUm_;%b*_=@Iigfb%@voljc=q0?YCYFGY)|I5@ zw=|TW-hs;0Jt#@of`(rXL6sVXisap>%ia&o#e*nL2#5V?HzrMbsLn~DxpV-f$F|_Y z7aybUN;>z$_RDHTtht{SwB&R&)aRp6p0pdq$G${eRveT`Qpgi`LY=V}H9y6oj5xV3 z%f*y+n8tRZ?!rF&ek2@MBEwL6DjHtj>aj(PFUKu#I_B~CehY4$*be#e%_#eR8)~y+ ziHmQbI1@qmF{nj6x zf~F*o+m7gaaN|2E?)b&#oQoo?2&ht|ls~NvVXHG^X+K1ut>hvY z)3%q-VSJ!PWo{~FY{C5})^w#9#GL8L3H08pgK1C?yKNH9@*Aix{23bB-yNk{7}Q=z zPk9cMDUqm5-bH*wp(b-5l*wOXs7uQs=4PhRQCY^{h2NF1UpJ=jG0C;W1oW2pvRoU!KdW!uQ4fC?K6od@M%b#aWT2NgVB&Cl2vgv*r{J8%i0{T*Ik+6X0p@`|K419Y zoe&#gTb+}Hn首页; +} + +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'), + }, + }, +});