Skip to content

Commit 4adca8d

Browse files
author
lzw
committed
chore(core): 初始化,实现功能
0 parents  commit 4adca8d

19 files changed

+1306
-0
lines changed

.cz-config.js

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
module.exports = {
2+
// 提交类型配置
3+
types: [
4+
{ value: 'feat', name: 'feat: 新功能' },
5+
{ value: 'fix', name: 'fix: 修复bug' },
6+
{ value: 'docs', name: 'docs: 文档更新' },
7+
{ value: 'style', name: 'style: 代码格式调整' },
8+
{ value: 'refactor', name: 'refactor: 代码重构' },
9+
{ value: 'perf', name: 'perf: 性能优化' },
10+
{ value: 'test', name: 'test: 测试相关' },
11+
{ value: 'chore', name: 'chore: 构建过程或辅助工具的变动' },
12+
{ value: 'revert', name: 'revert: 回滚' },
13+
{ value: 'ci', name: 'ci: CI配置相关' },
14+
{ value: 'build', name: 'build: 构建相关' },
15+
{ value: 'release', name: 'release: 发布版本' },
16+
{ value: 'tag', name: 'tag: 版本标签' },
17+
{ value: 'security', name: 'security: 安全相关' },
18+
{ value: 'i18n', name: 'i18n: 国际化' },
19+
{ value: 'design', name: 'design: 设计相关' },
20+
{ value: 'debug', name: 'debug: 调试相关' },
21+
{ value: 'responsive', name: 'responsive: 响应式设计' },
22+
{ value: 'plugin', name: 'plugin: 插件相关' },
23+
{ value: 'analytics', name: 'analytics: 分析相关' },
24+
],
25+
26+
// 作用域配置
27+
scopes: [
28+
{ name: 'core' }, // 核心功能
29+
{ name: 'ui' }, // 用户界面
30+
{ name: 'docs' }, // 文档相关
31+
{ name: 'test' }, // 测试相关
32+
{ name: 'ci' }, // CI配置相关
33+
{ name: 'api' },
34+
{ name: 'config' },
35+
{ name: 'deps' },
36+
{ name: 'auth' },
37+
{ name: 'db' },
38+
{ name: 'security' },
39+
{ name: 'i18n' },
40+
{ name: 'performance' },
41+
],
42+
43+
// 是否使用预定义的提交信息
44+
usePreparedCommit: false, // to re-use commit from ./.git/COMMIT_EDITMSG
45+
46+
// 是否允许自定义作用域
47+
allowCustomScopes: true,
48+
49+
// 是否允许票号
50+
allowTicketNumber: false,
51+
isTicketNumberRequired: false,
52+
ticketNumberPrefix: 'TICKET-',
53+
ticketNumberRegExp: '\\d{1,5}',
54+
55+
// 作用域重写
56+
scopeOverrides: {
57+
fix: [{ name: 'merge' }, { name: 'style' }, { name: 'e2eTest' }, { name: 'unitTest' }],
58+
},
59+
60+
messages: {
61+
type: '选择你要提交的类型:',
62+
scope: '选择一个作用域 (可选):',
63+
customScope: '请输入自定义的作用域:',
64+
subject: '写一个简短的描述 (最多200个字符):\n',
65+
body: '提供更详细的描述 (可选). 使用 "|" 换行:\n',
66+
breaking: '列出任何破坏性变更 (可选):\n',
67+
footer: '列出任何关闭的issue (可选). 例如: #31, #34:\n',
68+
confirmCommit: '确认提交以上内容?',
69+
},
70+
71+
// 允许破坏性变更的类型
72+
allowBreakingChanges: ['✨ feat', '🐛 fix'],
73+
74+
// 跳过的问题
75+
// skipQuestions: ['body', 'footer'],
76+
77+
// 主题长度限制
78+
subjectLimit: 200,
79+
80+
// 换行符
81+
breaklineChar: '|', // 换行符
82+
askForBreakingChangeFirst: false, // 是否先询问破坏性变更
83+
appendBranchNameToCommitMessage: false, // 是否在提交消息中添加分支名称
84+
upperCaseSubject: false, // 是否将主题转换为大写
85+
};

.czrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"path": "cz-customizable",
3+
"config": {
4+
"cz-customizable": {
5+
"format": "{type}: {subject}"
6+
}
7+
}
8+
}

.editorconfig

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# 表示是最顶层的配置文件
4+
root = true
5+
6+
# 匹配全部文件
7+
[*]
8+
# 设置字符集
9+
charset = utf-8
10+
# 缩进风格,可选 space、tab
11+
indent_style = space
12+
# 缩进的空格数
13+
indent_size = 2
14+
# 结尾换行符,可选 lf、cr、crlf
15+
end_of_line = lf
16+
# 在文件结尾插入新行
17+
insert_final_newline = true
18+
# 删除一行中的前后空格
19+
trim_trailing_whitespace = true
20+
21+
# 匹配 md 结尾的文件
22+
[*.md]
23+
trim_trailing_whitespace = false
24+
25+
# 匹配 package.json 和 .travis.yml
26+
[{package.json,.travis.yml}]
27+
indent_style = space
28+
indent_size = 2

.github/workflows/npm-publish.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: npm publish # 定义工作流名称
2+
3+
on:
4+
workflow_dispatch: # 允许手动触发工作流,默认是不开启的
5+
push: # 当有代码推送到仓库时触发
6+
branches:
7+
- main
8+
9+
jobs:
10+
build: # 工作流程中的一个作业
11+
runs-on: ubuntu-latest # 指定运行作业的虚拟环境
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
- name: Set up Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: 20
19+
- name: enable pnpm
20+
run: corepack enable
21+
- name: install Dependencies
22+
run: |
23+
ls -al
24+
pnpm i
25+
pnpm build
26+
- name: Upload Build Artifacts
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: build-artifacts # 构建产物名称
30+
path: ./dist # 构建产物路径
31+
32+
publish-npm:
33+
needs: build
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Checkout repository
37+
uses: actions/checkout@v4
38+
- name: Set up Node.js
39+
uses: actions/setup-node@v4
40+
with:
41+
node-version: 20
42+
registry-url: https://registry.npmjs.org/
43+
- name: Download Build Artifacts
44+
uses: actions/download-artifact@v4
45+
with:
46+
name: build-artifacts # 构建产物名称,需与上传时的名称一致
47+
path: ./ # 下载后存放路径
48+
- name: List Build Directory
49+
run: ls -al ./
50+
- name: Publish to NPM
51+
run: npm publish
52+
env:
53+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# 依赖目录
2+
node_modules/
3+
.pnp/
4+
.pnp.js
5+
6+
# 构建输出
7+
dist/
8+
build/
9+
coverage/
10+
11+
# 测试覆盖率
12+
coverage/
13+
14+
# 日志
15+
logs/
16+
*.log
17+
npm-debug.log*
18+
yarn-debug.log*
19+
yarn-error.log*
20+
pnpm-debug.log*
21+
lerna-debug.log*
22+
23+
# 编辑器目录和文件
24+
.idea/
25+
.vscode/
26+
*.suo
27+
*.ntvs*
28+
*.njsproj
29+
*.sln
30+
*.sw?
31+
32+
# 操作系统文件
33+
.DS_Store
34+
Thumbs.db
35+
36+
# 环境变量文件
37+
.env
38+
.env.local
39+
.env.development.local
40+
.env.test.local
41+
.env.production.local
42+
43+
# 类型声明文件
44+
*.d.ts
45+
46+
# 缓存文件
47+
.cache/
48+
.temp/
49+
.tmp/
50+
51+
# 其他
52+
.history/
53+
.nyc_output/

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx --no -- commitlint --edit $1

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npm run lint-staged

.lintstagedrc.mjs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export default {
2+
'*.{js,ts}': [
3+
"npm run lint",
4+
"npm run format",
5+
"npm run lint:check",
6+
"npm run format:check",
7+
],
8+
'*.{json,md}': [
9+
"npm run format",
10+
"npm run format:check",
11+
],
12+
};

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
registry=https://registry.npmjs.org

.prettierrc.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default {
2+
printWidth: 120,
3+
tabWidth: 2,
4+
useTabs: false,
5+
singleQuote: true,
6+
trailingComma: 'all',
7+
};

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# 1.0.0 (2025-04-28)
2+
3+
### Features
4+
5+
- **core:** 实现 websocket class ([10f7fe4](https://github.com/coderlzw-cn/websocket/commit/10f7fe45fccdb603a5c8b7ac8448076b0bfea3a4))
6+
7+
# 1.0.0 (2025-04-28)
8+
9+
### Features
10+
11+
- **core:** 浏览器端 websocket ([1957f5b](https://github.com/coderlzw-cn/websocket/commit/1957f5b85f4e13cb7380fa5624932c7a3133b113))
12+
13+
# 1.0.0 (2025-04-28)
14+
15+
### Features
16+
17+
- **core:** 浏览器888 ([3ba630d](https://github.com/coderlzw-cn/websocket/commit/3ba630de3c405410ecfd2150d0ca9890b7c0854e))
18+
- **core:** 浏览器端 websocket ([29cb079](https://github.com/coderlzw-cn/websocket/commit/29cb079a5c8c8ff4841a38a9821024d580b770e6))
19+
20+
# 1.0.0 (2025-04-28)
21+
22+
### Features
23+
24+
- **ui:** fdsfs ([613b4da](https://github.com/coderlzw-cn/websocket/commit/613b4da70664b26b157879dfb5336bfb650c47c5))

0 commit comments

Comments
 (0)