-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a769a8c
Showing
108 changed files
with
23,412 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
VITE_COMPANY_NAME=monorepo-project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
VITE_APP_PROJECT_NAME = "monorepo-project" | ||
VITE_USER_NODE_ENV = development | ||
VITE_SERVICE_URL = /api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
VITE_USER_NODE_ENV = production |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
VITE_USER_NODE_ENV = test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
*.sh | ||
node_modules | ||
*.md | ||
*.woff | ||
*.ttf | ||
.vscode | ||
.idea | ||
dist | ||
/public | ||
/docs | ||
.husky | ||
.local | ||
/bin | ||
/src/mock/* | ||
stats.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** @type {import("eslint").Linter.Config} */ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
browser: true, | ||
node: true, | ||
es6: true | ||
}, | ||
parser: "@typescript-eslint/parser", | ||
// 继承某些已有的规则 | ||
extends: [ | ||
"prettier", | ||
"eslint:recommended", | ||
"plugin:react/jsx-runtime", | ||
"plugin:prettier/recommended", | ||
"plugin:react-hooks/recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
plugins: ["@typescript-eslint"], | ||
// 优先级低于 parse 的语法解析配置 | ||
parserOptions: { | ||
sourceType: "module", | ||
ecmaVersion: 2020 | ||
}, | ||
rules: { | ||
// eslint (http://eslint.cn/docs/rules) | ||
"no-var": "error", // 要求使用 let 或 const 而不是 var | ||
"no-multiple-empty-lines": ["error", { max: 1 }], // 不允许多个空行 | ||
"no-use-before-define": "off", // 禁止在 函数/类/变量 定义之前使用它们 | ||
"prefer-const": "off", // 使用 let 关键字声明但在初始分配后从未重新分配的变量,要求使用 const | ||
|
||
// typeScript (https://typescript-eslint.io/rules) | ||
"@typescript-eslint/no-unused-vars": "error", // 禁止定义未使用的变量 | ||
"@typescript-eslint/prefer-ts-expect-error": "error", // 禁止使用 @ts-ignore | ||
"@typescript-eslint/ban-ts-comment": "error", // 禁止 @ts-<directive> 使用注释或要求在指令后进行描述 | ||
"@typescript-eslint/no-inferrable-types": "off", // 可以轻松推断的显式类型可能会增加不必要的冗长 | ||
"@typescript-eslint/no-namespace": "off", // 禁止使用自定义 TypeScript 模块和命名空间 | ||
"@typescript-eslint/no-explicit-any": "off", // 禁止使用 any 类型 | ||
"@typescript-eslint/ban-types": "off", // 禁止使用特定类型 | ||
"@typescript-eslint/no-var-requires": "off", // 允许使用 require() 函数导入模块 | ||
"@typescript-eslint/no-empty-function": "off", // 不允许空函数 | ||
"@typescript-eslint/no-non-null-assertion": "off", // 不允许使用后缀运算符的非空断言(!) | ||
|
||
// react (https://github.com/jsx-eslint/eslint-plugin-react) | ||
"react-hooks/rules-of-hooks": "error", // 确保在组件或自定义挂钩的顶层调用挂钩 | ||
"react-hooks/exhaustive-deps": "off" // 允许对 Hook 的依赖数组有更大的控制权 | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Logs | ||
logs | ||
*.log | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
# dependencies | ||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
.vercel | ||
|
||
# turbo | ||
.turbo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx --no-install commitlint --edit "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npm run lint:lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
auto-install-peers = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// @see: https://www.prettier.cn | ||
|
||
module.exports = { | ||
// 指定最大换行长度 | ||
printWidth: 130, | ||
// 缩进制表符宽度 | 空格数 | ||
tabWidth: 2, | ||
// 使用制表符而不是空格缩进行 (true:制表符,false:空格) | ||
useTabs: false, | ||
// 结尾不用分号 (true:有,false:没有) | ||
semi: true, | ||
// 使用单引号 (true:单引号,false:双引号) | ||
singleQuote: false, | ||
// 在对象字面量中决定是否将属性名用引号括起来 可选值 "<as-needed|consistent|preserve>" | ||
quoteProps: "as-needed", | ||
// 在JSX中使用单引号而不是双引号 (true:单引号,false:双引号) | ||
jsxSingleQuote: false, | ||
// 多行时尽可能打印尾随逗号 可选值"<none|es5|all>" | ||
trailingComma: "none", | ||
// 在对象,数组括号与文字之间加空格 "{ foo: bar }" (true:有,false:没有) | ||
bracketSpacing: true, | ||
// 将 > 多行元素放在最后一行的末尾,而不是单独放在下一行 (true:放末尾,false:单独一行) | ||
bracketSameLine: false, | ||
// (x) => {} 箭头函数参数只有一个时是否要有小括号 (avoid:省略括号,always:不省略括号) | ||
arrowParens: "avoid", | ||
// 指定要使用的解析器,不需要写文件开头的 @prettier | ||
requirePragma: false, | ||
// 可以在文件顶部插入一个特殊标记,指定该文件已使用 Prettier 格式化 | ||
insertPragma: false, | ||
// 用于控制文本是否应该被换行以及如何进行换行 | ||
proseWrap: "preserve", | ||
// 在html中空格是否是敏感的 "css" - 遵守 CSS 显示属性的默认值, "strict" - 空格被认为是敏感的 ,"ignore" - 空格被认为是不敏感的 | ||
htmlWhitespaceSensitivity: "css", | ||
// 换行符使用 lf 结尾是 可选值 "<auto|lf|crlf|cr>" | ||
endOfLine: "auto", | ||
// 这两个选项可用于格式化以给定字符偏移量(分别包括和不包括)开始和结束的代码 (rangeStart:开始,rangeEnd:结束) | ||
rangeStart: 0, | ||
rangeEnd: Infinity | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// @see: https://stylelint.io | ||
module.exports = { | ||
root: true, | ||
extends: ["stylelint-config-standard", "stylelint-config-recess-order", "stylelint-prettier/recommended"], | ||
overrides: [ | ||
{ | ||
files: ["**/*.html"], | ||
customSyntax: "postcss-html" | ||
}, | ||
{ | ||
files: ["**/*.less"], | ||
customSyntax: "postcss-less" | ||
} | ||
], | ||
rules: { | ||
"function-url-quotes": "always", // URL 的引号 "always(必须加上引号)"|"never(没有引号)" | ||
"color-hex-length": "long", // 指定 16 进制颜色的简写或扩写 "short(16进制简写)"|"long(16进制扩写)" | ||
"rule-empty-line-before": [ | ||
"always-multi-line", | ||
{ | ||
except: ["inside-block-and-after-rule", "inside-block"] | ||
} | ||
], // 规则前需要或不允许空行 | ||
"font-family-no-missing-generic-family-keyword": null, // 禁止在字体族名称列表中缺少通用字体族关键字 | ||
"no-empty-source": null, // 禁止空源码 | ||
"selector-class-pattern": null, // 强制选择器类名的格式 | ||
"value-no-vendor-prefix": null, // 关闭 vendor-prefix (为了解决多行省略 -webkit-box) | ||
"no-descending-specificity": null, // 不允许较低特异性的选择器出现在覆盖较高特异性的选择器 | ||
"custom-property-pattern": null, // 允许自定义CSS变量名 | ||
"media-feature-range-notation": null, | ||
"selector-pseudo-class-no-unknown": [ | ||
true, | ||
{ | ||
ignorePseudoClasses: ["global"] | ||
} | ||
], | ||
"at-rule-no-unknown": [ | ||
true, | ||
{ | ||
ignoreAtRules: ["tailwind", "layer", "apply", "variants", "responsive", "screen"] | ||
} | ||
] | ||
}, | ||
ignoreFiles: ["**/.js", "/*.jsx", "/.tsx", "**/.ts", "dist/**/.css"] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"recommendations": [ | ||
"dsznajder.es7-react-js-snippets", | ||
"dbaeumer.vscode-eslint", | ||
"stylelint.vscode-stylelint", | ||
"esbenp.prettier-vscode", | ||
"editorconfig.editorconfig", | ||
"streetsidesoftware.code-spell-checker", | ||
"mikestead.dotenv", | ||
"ms-ceintl.vscode-language-pack-zh-hans" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# limuen-monorepo-project | ||
|
||
基于 turborepo 开发项目。 | ||
|
||
## 安装依赖和运行 | ||
|
||
```bash | ||
# 运行所有项目 | ||
$ pnpm run dev | ||
# 运行指定名称项目 | ||
$ pnpm run dev --filter [name] # name 为项目名称 | ||
|
||
# 打包所有项目 | ||
$ pnpm run build | ||
# 打包指定名称项目 | ||
$ pnpm run build --filter [name] # name 为项目名称 | ||
``` | ||
|
||
## 项目目录结构 | ||
|
||
```text | ||
limuen-monorepo-project | ||
├─ apps # 项目文件 | ||
│ └─ general # 总系统 | ||
├─ packages # 项目公共库 | ||
│ ├─ viteconfig # vite库的配置 | ||
│ ├─ utils # 常用公共的方法文件 | ||
│ ├─ tsconfig # tsconfig的公共配置 | ||
│ ├─ request # axios请求库的公共配置(仅限PC端) | ||
│ ├─ stores # 基于zustand状态公共管理库 | ||
├─ turbo # plop | ||
│ ├─ generators # 模板列表 | ||
│ │ └─ react-components # packages/components 下的模板 | ||
├─ .commitlintrc.js # git 提交配置 | ||
├─ .eslintrc.js # ESLint 校验配置 | ||
├─ .gitignore # git 提交忽略 | ||
├─ package.json # 依赖包管理 | ||
├─ pnpm-lock.yaml # pnpm 安装依赖锁文件 | ||
├─ pnpm-workspace.yaml # pnpm 工作空间配置 | ||
├─ README.md # 项目介绍 | ||
├─ tsconfig.json # typescript 全局配置 | ||
└─ turbo.json # turbo 配置文件 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# defaultProject | ||
|
||
此项目的存在目的是使用vite创建项目,在packages/viteconfig封装好以后,vite不支持引入ts,所以得重新打包就得借助于这个项目然后引入的是打包以后的js,具体在turbo.json里 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Vite + React + TS</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "defaultProject", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "tsc && vite build", | ||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", | ||
"preview": "vite preview" | ||
}, | ||
"dependencies": { | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"react-router-dom": "^6.21.3", | ||
"@limuen/utils": "workspace:*" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "^18.2.43", | ||
"@types/react-dom": "^18.2.17", | ||
"vite": "5.1.5", | ||
"@limuen/viteconfig": "workspace:*", | ||
"@limuen/tsconfig": "workspace:*" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#root { | ||
max-width: 1280px; | ||
padding: 2rem; | ||
margin: 0 auto; | ||
text-align: center; | ||
} | ||
|
||
.logo { | ||
height: 6em; | ||
padding: 1.5em; | ||
transition: filter 300ms; | ||
will-change: filter; | ||
} | ||
|
||
.logo:hover { | ||
filter: drop-shadow(0 0 2em #646cffaa); | ||
} | ||
|
||
.logo.react:hover { | ||
filter: drop-shadow(0 0 2em #61dafbaa); | ||
} | ||
|
||
@keyframes logo-spin { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
|
||
@media (prefers-reduced-motion: no-preference) { | ||
a:nth-of-type(2) .logo { | ||
animation: logo-spin infinite 20s linear; | ||
} | ||
} | ||
|
||
.card { | ||
padding: 2em; | ||
} | ||
|
||
.read-the-docs { | ||
color: #888888; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { useState } from "react"; | ||
import reactLogo from "./assets/react.svg"; | ||
import viteLogo from "/vite.svg"; | ||
import "./App.css"; | ||
|
||
import { logInfo } from "@limuen/utils/console"; | ||
|
||
function App() { | ||
const [count, setCount] = useState(0); | ||
|
||
logInfo("count", count); | ||
return ( | ||
<> | ||
<div> | ||
<a href="https://vitejs.dev" target="_blank"> | ||
<img src={viteLogo} className="logo" alt="Vite logo" /> | ||
</a> | ||
<a href="https://react.dev" target="_blank"> | ||
<img src={reactLogo} className="logo react" alt="React logo" /> | ||
</a> | ||
</div> | ||
<h1>Vite + React</h1> | ||
<div className="card"> | ||
<button onClick={() => setCount(count => count + 1)}>count is {count}</button> | ||
<p> | ||
Edit <code>src/App.tsx</code> and save to test HMR | ||
</p> | ||
</div> | ||
<p className="read-the-docs">Click on the Vite and React logos to learn more</p> | ||
</> | ||
); | ||
} | ||
|
||
export default App; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.