commit-pack 1.1.7 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +29 -245
- package/package.json +1 -1
- package/setup-script/lintstagedrc.sh +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jett191
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# commit-pack
|
|
2
2
|
|
|
3
|
-
自动化的项目代码质量和提交标准化设置。集成 ESLint、Prettier、Husky、lint-staged、commitlint 和 commitizen
|
|
3
|
+
自动化的项目代码质量和提交标准化设置。集成 ESLint、Prettier、Husky、lint-staged、commitlint 和 commitizen,执行代码风格检查和标准化提交消息。
|
|
4
4
|
|
|
5
5
|
## ✨ 特性
|
|
6
6
|
|
|
@@ -14,6 +14,16 @@
|
|
|
14
14
|
- **支持 Monorepo**: 使用 `-w` 标志处理基于工作区的项目
|
|
15
15
|
- **安全回滚**: 初始化失败时自动回滚
|
|
16
16
|
|
|
17
|
+
## 🎬 Demo
|
|
18
|
+
|
|
19
|
+
<p align="center">
|
|
20
|
+
<video src="https://img.jett191.site/video/commitpack.mp4"
|
|
21
|
+
controls
|
|
22
|
+
muted
|
|
23
|
+
width="800">
|
|
24
|
+
</video>
|
|
25
|
+
</p>
|
|
26
|
+
|
|
17
27
|
## 🚀 快速开始
|
|
18
28
|
|
|
19
29
|
### 安装
|
|
@@ -229,253 +239,27 @@ module.exports = {
|
|
|
229
239
|
6. 推送到分支 (`git push origin feature/amazing-feature`)
|
|
230
240
|
7. 创建 Pull Request
|
|
231
241
|
|
|
232
|
-
## ©️ 许可证
|
|
233
|
-
|
|
234
|
-
此项目根据 MIT 许可证授权 - 详见 [LICENSE](LICENSE) 文件。
|
|
235
|
-
|
|
236
|
-
---
|
|
237
|
-
|
|
238
|
-
# commit-pack
|
|
239
|
-
|
|
240
|
-
Automated project setup for code quality and commit standardization. Integrates ESLint, Prettier, Husky, lint-staged, commitlint, and commitizen to enforce consistent code style and standardized commit messages.
|
|
241
|
-
|
|
242
|
-
## ✨ Features
|
|
243
|
-
|
|
244
|
-
- **Code Quality**: Integrates ESLint with TypeScript parser and recommended configs
|
|
245
|
-
- **Code Formatting**: Prettier with opinionated formatting rules
|
|
246
|
-
- **Git Hooks**: Husky-powered pre-commit and commit-message validation
|
|
247
|
-
- **Staged Files**: lint-staged runs checks only on staged files
|
|
248
|
-
- **Commit Validation**: commitlint ensures conventional commit format
|
|
249
|
-
- **Interactive Commits**: commitizen provides guided commit creation
|
|
250
|
-
- **Multi-Package Manager**: Supports pnpm, npm, yarn, and bun
|
|
251
|
-
- **Monorepo Ready**: Handles workspace-based projects with `-w` flag
|
|
252
|
-
- **Rollback Safe**: Automatic rollback if initialization fails
|
|
253
|
-
|
|
254
|
-
## 🚀 Quick Start
|
|
255
|
-
|
|
256
|
-
### Installation
|
|
257
|
-
```bash
|
|
258
|
-
# Using pnpm
|
|
259
|
-
pnpm add -D commit-pack@latest
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
```bash
|
|
263
|
-
# Using bun
|
|
264
|
-
bun add -d commit-pack@latest
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
```bash
|
|
268
|
-
# Using npm
|
|
269
|
-
npm install -D commit-pack@latest
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
```bash
|
|
273
|
-
# Using yarn
|
|
274
|
-
yarn add -D commit-pack@latest
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
### Initialization
|
|
278
|
-
```bash
|
|
279
|
-
# Initialize in the root of your project
|
|
280
|
-
pnpm exec commit-pack-init
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
```bash
|
|
284
|
-
# Using bun
|
|
285
|
-
bunx commit-pack-init
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
```bash
|
|
289
|
-
# Using npx
|
|
290
|
-
npx commit-pack-init
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
```bash
|
|
294
|
-
# Using yarn
|
|
295
|
-
yarn dlx commit-pack-init
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
### Monorepo Support
|
|
299
|
-
```bash
|
|
300
|
-
# Initialize for a specific workspace in monorepo
|
|
301
|
-
pnpm exec commit-pack-init -w workspace-name
|
|
302
|
-
# or
|
|
303
|
-
pnpm exec commit-pack-init --workspace=workspace-name
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
## 🛠️ What's Included
|
|
307
|
-
|
|
308
|
-
### ESLint Configuration
|
|
309
|
-
- TypeScript support with `@typescript-eslint/parser`
|
|
310
|
-
- Recommended TypeScript rules
|
|
311
|
-
- Integration with Prettier to avoid conflicts
|
|
312
|
-
- Root configuration to work in monorepos
|
|
313
|
-
|
|
314
|
-
**.eslintrc**
|
|
315
|
-
```json
|
|
316
|
-
{
|
|
317
|
-
"root": true,
|
|
318
|
-
"parser": "@typescript-eslint/parser",
|
|
319
|
-
"extends": [
|
|
320
|
-
"eslint:recommended",
|
|
321
|
-
"plugin:@typescript-eslint/recommended",
|
|
322
|
-
"plugin:@typescript-eslint/eslint-recommended",
|
|
323
|
-
"prettier"
|
|
324
|
-
],
|
|
325
|
-
|
|
326
|
-
"plugins": [
|
|
327
|
-
"@typescript-eslint",
|
|
328
|
-
"prettier"
|
|
329
|
-
],
|
|
330
242
|
|
|
331
|
-
"rules": {
|
|
332
|
-
"prettier/prettier": "error",
|
|
333
|
-
"arrow-body-style": "off",
|
|
334
|
-
"prefer-arrow-callback": "off"
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
```
|
|
338
243
|
|
|
339
|
-
### Prettier Configuration
|
|
340
|
-
- Single quotes for strings
|
|
341
|
-
- Print width of 100 characters
|
|
342
|
-
- No semicolons
|
|
343
|
-
- Tailwind CSS plugin support
|
|
344
|
-
- Consistent spacing and formatting
|
|
345
244
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
245
|
+
## 致谢
|
|
246
|
+
> 本项目以工程整合与工作流设计为核心,
|
|
247
|
+
> 基于一组成熟且优秀的开源工具,
|
|
248
|
+
> 构建了一个更易用、更一致的开发者工具链。
|
|
249
|
+
>
|
|
250
|
+
> 本项目并未引入新的底层技术,
|
|
251
|
+
> 其价值主要体现在整合方案、默认配置与开发体验优化上。
|
|
252
|
+
>
|
|
253
|
+
> 相关核心能力均来自对应开源项目,特此致谢其作者与维护者。
|
|
254
|
+
- [ESLint](https://eslint.org/) —— 可配置、可扩展的 JavaScript 代码检查工具
|
|
255
|
+
- [Prettier](https://prettier.io/) —— 具有统一风格约定的代码格式化工具
|
|
256
|
+
- [Husky](https://typicode.github.io/husky/) —— 简化 Git Hooks 配置与使用的工具
|
|
257
|
+
- [lint-staged](https://github.com/okonet/lint-staged) —— 仅对暂存区文件运行代码检查
|
|
258
|
+
- [commitlint](https://commitlint.js.org/) —— 用于校验提交信息规范的工具
|
|
259
|
+
- [commitizen](https://github.com/commitizen/cz-cli) —— 交互式生成提交信息的工具
|
|
260
|
+
- [TypeScript](https://www.typescriptlang.org/) —— 面向大型应用的强类型 JavaScript
|
|
360
261
|
|
|
361
|
-
### Commitlint Configuration
|
|
362
|
-
- Enforces conventional commit format
|
|
363
|
-
- Custom emoji-prefixed commit types
|
|
364
|
-
- Scope validation
|
|
365
|
-
- Detailed commit message structure
|
|
366
262
|
|
|
367
|
-
|
|
368
|
-
```json
|
|
369
|
-
{
|
|
370
|
-
"extends": ["@commitlint/config-conventional"],
|
|
371
|
-
"parserPreset": {
|
|
372
|
-
"parserOpts": {
|
|
373
|
-
"headerPattern": "^(.+?)\\((.+?)\\): (.+)$",
|
|
374
|
-
"headerCorrespondence": ["type", "scope", "subject"]
|
|
375
|
-
}
|
|
376
|
-
},
|
|
377
|
-
"rules": {
|
|
378
|
-
"scope-empty": [2, "never"],
|
|
379
|
-
"type-enum": [
|
|
380
|
-
2,
|
|
381
|
-
"always",
|
|
382
|
-
[
|
|
383
|
-
"✨ feat",
|
|
384
|
-
"🐛 fix",
|
|
385
|
-
"🎉 init",
|
|
386
|
-
"✏️ docs",
|
|
387
|
-
"💄 style",
|
|
388
|
-
"♻️ refactor",
|
|
389
|
-
"⚡️ perf",
|
|
390
|
-
"✅ test",
|
|
391
|
-
"⏪️ revert",
|
|
392
|
-
"📦 build",
|
|
393
|
-
"🚀 chore",
|
|
394
|
-
"👷 ci"
|
|
395
|
-
]
|
|
396
|
-
]
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
```
|
|
400
|
-
|
|
401
|
-
### Commitizen Configuration
|
|
402
|
-
- Interactive commit interface
|
|
403
|
-
- Predefined commit types with emojis
|
|
404
|
-
- Customizable scopes
|
|
405
|
-
- Guided commit message creation
|
|
406
|
-
|
|
407
|
-
**.cz-config.js**
|
|
408
|
-
```js
|
|
409
|
-
module.exports = {
|
|
410
|
-
types: [
|
|
411
|
-
{ value: "✨ feat", name: " ✨ feat: 新功能" },
|
|
412
|
-
{ value: "🐛 fix", name: " 🐛 fix: 修复bug" },
|
|
413
|
-
{ value: "🎉 init", name: " 🎉 init: 初始化" },
|
|
414
|
-
{ value: "✏️ docs", name: " ✏️ docs: 文档变更" },
|
|
415
|
-
{ value: "💄 style", name: " 💄 style: 更改样式" },
|
|
416
|
-
{ value: "♻️ refactor", name: " ♻️ refactor: 重构" },
|
|
417
|
-
{ value: "⚡️ perf", name: " ⚡️ perf: 性能优化" },
|
|
418
|
-
{ value: "✅ test", name: " ✅ test: 测试" },
|
|
419
|
-
{ value: "⏪️ revert", name: " ⏪️ revert: 回退" },
|
|
420
|
-
{ value: "📦 build", name: " 📦 build: 打包" },
|
|
421
|
-
{ value: "🚀 chore", name: " 🚀 chore: 构建/工程依赖/工具" },
|
|
422
|
-
{ value: "👷 ci", name: " 👷 ci: CI related changes" },
|
|
423
|
-
],
|
|
424
|
-
|
|
425
|
-
scopes: [
|
|
426
|
-
{ name: "components" },
|
|
427
|
-
{ name: "page" },
|
|
428
|
-
{ name: "css" },
|
|
429
|
-
{ name: "api" },
|
|
430
|
-
{ name: "README.md" },
|
|
431
|
-
{ name: "custom" },
|
|
432
|
-
],
|
|
433
|
-
|
|
434
|
-
messages: {
|
|
435
|
-
type: "请选择提交类型(必填)",
|
|
436
|
-
scope: "请选择文件修改范围(必填):",
|
|
437
|
-
customScope: "请输自定义文件修改范围(必填)",
|
|
438
|
-
subject: "请简要描述提交(必填)",
|
|
439
|
-
body: "请输入详细描述(可选)",
|
|
440
|
-
breaking: "列出任何breaking changes(可选)",
|
|
441
|
-
footer: "请输入要关闭的issue(可选)",
|
|
442
|
-
confirmCommit: "确定提交吗",
|
|
443
|
-
},
|
|
444
|
-
|
|
445
|
-
allowCustomScopes: true,
|
|
446
|
-
allowBreakingChanges: ["✨ feat", "🐛 fix"],
|
|
447
|
-
subjectLimit: 49,
|
|
448
|
-
};
|
|
449
|
-
```
|
|
450
|
-
|
|
451
|
-
## 📋 Available Scripts
|
|
452
|
-
|
|
453
|
-
After initialization, the following scripts will be added to your `package.json`:
|
|
454
|
-
|
|
455
|
-
- `lint`: Run ESLint on all TypeScript/JavaScript/JSON files
|
|
456
|
-
- `format`: Format all files using Prettier
|
|
457
|
-
- `commit`: Interactive commit using commitizen
|
|
458
|
-
|
|
459
|
-
## 🤝 Contributing
|
|
460
|
-
|
|
461
|
-
1. Fork the repository
|
|
462
|
-
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
463
|
-
3. Make your changes
|
|
464
|
-
4. Run the linter (`pnpm run lint`) and formatter (`pnpm run format`)
|
|
465
|
-
5. Commit your changes using the commitizen interface (`pnpm run commit`)
|
|
466
|
-
6. Push to the branch (`git push origin feature/amazing-feature`)
|
|
467
|
-
7. Open a Pull Request
|
|
468
|
-
|
|
469
|
-
## ©️ License
|
|
470
|
-
|
|
471
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
472
|
-
|
|
473
|
-
## 🙏 Acknowledgments
|
|
263
|
+
## ©️ 许可证
|
|
474
264
|
|
|
475
|
-
- [
|
|
476
|
-
- [Prettier](https://prettier.io/) - Opinionated code formatter
|
|
477
|
-
- [Husky](https://typicode.github.io/husky/) - Git hooks made easy
|
|
478
|
-
- [lint-staged](https://github.com/okonet/lint-staged) - Run linters on staged files
|
|
479
|
-
- [commitlint](https://commitlint.js.org/) - Lint commit messages
|
|
480
|
-
- [commitizen](https://github.com/commitizen/cz-cli) - Interactive commit prompts
|
|
481
|
-
- [TypeScript](https://www.typescriptlang.org/) - Typed JavaScript at any scale
|
|
265
|
+
此项目根据 MIT 许可证授权 - 详见 [LICENSE](LICENSE) 文件。
|
package/package.json
CHANGED