Skip to content

Commit

Permalink
feat: 特性: 🚀 初始化项目
Browse files Browse the repository at this point in the history
  • Loading branch information
Case committed Sep 9, 2024
0 parents commit 744ab17
Show file tree
Hide file tree
Showing 80 changed files with 17,945 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true
[*] # 表示所有文件适用
charset = utf-8 # 设置文件字符集为 utf-8
end_of_line = lf # 控制换行类型(lf | cr | crlf)
insert_final_newline = true # 始终在文件末尾插入一个新行
indent_style = tab # 缩进风格(tab | space)
indent_size = 2 # 缩进大小
max_line_length = 130 # 最大行长度
[*.md] # 表示仅 md 文件适用以下规则
max_line_length = off # 关闭最大行长度限制
trim_trailing_whitespace = false # 关闭末尾空格修剪
[*.yml] # 表示仅 md 文件适用以下规则
indent_style = space # 缩进风格(tab | space)
indent_size = 2 # 缩进大小
max_line_length = off # 关闭最大行长度限制
trim_trailing_whitespace = false # 关闭末尾空格修剪
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
.next
/out/
auto-imports.d.ts
# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry=https://registry.npmmirror.com
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20
39 changes: 39 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"formatter": {
"enabled": true,
"formatWithErrors": false,
"ignore": [],
"attributePosition": "auto",
"indentStyle": "tab",
"indentWidth": 2,
"lineWidth": 80,
"lineEnding": "lf"
},
"javascript": {
"formatter": {
"arrowParentheses": "always",
"bracketSameLine": false,
"bracketSpacing": true,
"jsxQuoteStyle": "double",
"quoteProperties": "asNeeded",
"semicolons": "always",
"trailingCommas": "all"
}
},
"json": {
"formatter": {
"trailingCommas": "none"
}
},
"linter": {
"rules": {
"suspicious": {
"noExportsInTest": "off",
"noConsoleLog": "warn"
}
}
},
"files": {
"ignore": ["packages/**/typesImport.d.ts"]
}
}
Binary file added bun.lockb
Binary file not shown.
141 changes: 141 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
// @see: https://cz-git.qbenben.com/zh/guide
/** @type {import('cz-git').UserConfig} */

module.exports = {
ignores: [(commit) => commit === "init"],
extends: ["@commitlint/config-conventional"],
rules: {
// @see: https://commitlint.js.org/#/reference-rules
"body-leading-blank": [2, "always"],
"footer-leading-blank": [1, "always"],
"header-max-length": [2, "always", 108],
"subject-empty": [2, "never"],
"type-empty": [2, "never"],
"subject-case": [0],
"type-enum": [
2,
"always",
[
"feat",
"fix",
"docs",
"style",
"refactor",
"perf",
"test",
"build",
"ci",
"chore",
"revert",
"wip",
"workflow",
"types",
"release",
],
],
},
prompt: {
messages: {
type: "选择你要提交的类型 :",
scope: "选择一个提交范围(可选):",
customScope: "请输入自定义的提交范围 :",
subject: "填写简短精炼的变更描述 :\n",
body: '填写更加详细的变更描述(可选)。使用 "|" 换行 :\n',
breaking: '列举非兼容性重大的变更(可选)。使用 "|" 换行 :\n',
footerPrefixsSelect: "选择关联issue前缀(可选):",
customFooterPrefixs: "输入自定义issue前缀 :",
footer: "列举关联issue (可选) 例如: #31, #I3244 :\n",
confirmCommit: "是否提交或修改commit ?",
},
types: [
{
value: "feat: 特性",
name: "特性: 🚀 新增功能",
emoji: "🚀",
},
{
value: "fix: 修复",
name: "修复: 🧩 修复缺陷",
emoji: "🧩",
},
{
value: "docs: 文档",
name: "文档: 📚 文档变更",
emoji: "📚",
},
{
value: "style: 格式",
name: "格式: 🎨 代码格式(不影响功能,例如空格、分号等格式修正)",
emoji: "🎨",
},
{
value: "refactor: 重构",
name: "重构: ♻️ 代码重构(不包括 bug 修复、功能新增)",
emoji: "♻️",
},
{
value: "perf: 性能",
name: "性能: ⚡️ 性能优化",
emoji: "⚡️",
},
{
value: "test: 测试",
name: "测试: ✅ 添加疏漏测试或已有测试改动",
emoji: "✅",
},
{
value: "chore: 构建",
name: "构建: 📦️ 构建流程、外部依赖变更(如升级 npm 包、修改 webpack 配置等)",
emoji: "📦️",
},
{
value: "ci: 集成",
name: "集成: 🎡 修改 CI 配置、脚本",
emoji: "🎡",
},
{
value: "revert: 回退",
name: "回退: ⏪️ 回滚 commit",
emoji: "⏪️",
},
{
value: "build: 打包",
name: "打包: 🔨 项目打包发布",
emoji: "🔨",
},
],
useEmoji: true,
themeColorCode: "",
scopes: [],
allowCustomScopes: true,
allowEmptyScopes: true,
customScopesAlign: "bottom",
customScopesAlias: "custom",
emptyScopesAlias: "empty",
upperCaseSubject: false,
allowBreakingChanges: ["feat", "fix"],
breaklineNumber: 100,
breaklineChar: "|",
skipQuestions: [],
issuePrefixs: [
{
value: "closed",
name: "closed: ISSUES has been processed",
},
],
customIssuePrefixsAlign: "top",
emptyIssuePrefixsAlias: "skip",
customIssuePrefixsAlias: "custom",
allowCustomIssuePrefixs: true,
allowEmptyIssuePrefixs: true,
confirmColorize: true,
maxHeaderLength: Number.POSITIVE_INFINITY,
maxSubjectLength: Number.POSITIVE_INFINITY,
minSubjectLength: 0,
scopeOverrides: undefined,
defaultBody: "",
defaultIssues: "",
defaultScope: "",
defaultSubject: "",
},
};
79 changes: 79 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
html,
body {
width: 100%;
height: 100%;
}

* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

.box {
width: 300px;
height: 100%;
background-color: darkgray;
overflow: hidden;
}
</style>
</head>

<body>
<div class="box" id="box"></div>
</body>
</html>
<script>
/**
* 调整左侧div宽度
* 接收需要调整的dom对象
* */
function boxResize(dom) {
var div = document.createElement("div");
let divSty = div.style;
divSty.width = "5px";
divSty.height = "100%";
divSty.position = "absolute";
divSty.top = "0";
divSty.right = "0";
divSty.cursor = "e-resize";
dom.appendChild(div);
dom.style.position = "relative";
//鼠标按下事件
div.onmousedown = (e) => {
let w = dom.offsetWidth; //获取 div 元素的宽度,包含内边距(padding)和边框(border)
let startX = e.clientX; //鼠标指针的水平坐标
// 鼠标拖动事件
document.onmousemove = function (e) {
let change = e.clientX - startX; //鼠标移动的偏移值
let moveLen = w + change; //鼠标移动后,分割线节点元素的左边界的偏移值
if(moveLen >= 100) {
dom.style.width = moveLen + "px";
}
};
// 鼠标松开事件
document.onmouseup = function (evt) {
evt.stopPropagation();
document.onmousemove = null;
document.onmouseup = null;
//当你不在需要继续获得鼠标消息就要应该调用ReleaseCapture()释放掉
div.releaseCapture && div.releaseCapture();
};
div.setCapture && div.setCapture();
};
}
window.onload = () => {
//获取要调整元素的dom
let box = document.getElementById("box");
//调用方法,传入dom对象
boxResize(box);
};
</script>
6 changes: 6 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pre-commit:
commands:
check:
glob: "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}"
run: npx @biomejs/biome check --write --no-errors-on-unmatched --files-ignore-unknown=true --colors=off {staged_files}
stage_fixed: true
31 changes: 31 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "low-code",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "cd packages/hooks && pnpm dev",
"lint": "biome lint",
"postinstall": "lefthook install",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"commit": "git status && git add -A && git-cz && git push"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@biomejs/biome": "^1.8.3",
"@commitlint/cli": "^18.6.0",
"@commitlint/config-conventional": "^18.6.0",
"commitizen": "^4.3.0",
"cz-git": "^1.9.4",
"lefthook": "^1.7.11"
},
"workspaces": ["packages/*"],
"config": {
"commitizen": {
"path": "node_modules/cz-git"
}
}
}
12 changes: 12 additions & 0 deletions packages/common/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "@packges/common",
"version": "1.0.0",
"description": "",
"main": "./src/index.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
12 changes: 12 additions & 0 deletions packages/common/src/api/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { RequestMethodEnum } from "@/enums";
import { AxiosService } from "@/utils";

export const AdminReuqest = new AxiosService({
default_method: RequestMethodEnum.GET,
withCredentials: true,
timeout: 5000,
/**
* 网关地址
*/
baseURL: "http://localhost",
});
Empty file.
Empty file.
1 change: 1 addition & 0 deletions packages/common/src/enums/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./request";
Loading

0 comments on commit 744ab17

Please sign in to comment.