commit-pack 1.1.8 → 1.1.10

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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +40 -263
  3. package/package.json +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,55 +14,58 @@
14
14
  - **支持 Monorepo**: 使用 `-w` 标志处理基于工作区的项目
15
15
  - **安全回滚**: 初始化失败时自动回滚
16
16
 
17
+ ## 🎬 Demo
18
+
19
+ https://github.com/user-attachments/assets/8d99c810-81f2-4678-bf62-22bc5d2eee2a
20
+
21
+
22
+
17
23
  ## 🚀 快速开始
18
24
 
19
25
  ### 安装
26
+ 1. `pnpm`
20
27
  ```bash
21
- # 使用 pnpm
22
28
  pnpm add -D commit-pack@latest
23
29
  ```
24
-
30
+ 2. `bun`
25
31
  ```bash
26
- # 使用 bun
27
32
  bun add -d commit-pack@latest
28
33
  ```
29
-
34
+ 3. `npm`
30
35
  ```bash
31
- # 使用 npm
32
36
  npm install -D commit-pack@latest
33
37
  ```
34
-
38
+ 4. `yarn`
35
39
  ```bash
36
- # 使用 yarn
37
40
  yarn add -D commit-pack@latest
38
41
  ```
39
42
 
40
- ### 初始化
43
+ ### 在项目根目录初始化
44
+
45
+ 1. `pnpm`
41
46
  ```bash
42
- # 在项目根目录初始化
43
47
  pnpm exec commit-pack-init
44
48
  ```
45
-
49
+ 2. `bun`
46
50
  ```bash
47
- # 使用 bun
48
51
  bunx commit-pack-init
49
52
  ```
50
-
53
+ 3. `npm`
51
54
  ```bash
52
- # 使用 npx
53
55
  npx commit-pack-init
54
56
  ```
55
-
57
+ 4. `yarn`
56
58
  ```bash
57
- # 使用 yarn
58
59
  yarn dlx commit-pack-init
59
60
  ```
60
61
 
61
- ### Monorepo 支持
62
+ ### Monorepo
63
+ `为 monorepo 中的特定工作区初始化`
62
64
  ```bash
63
- # 为 monorepo 中的特定工作区初始化
64
65
  pnpm exec commit-pack-init -w workspace-name
65
- # 或
66
+
67
+
68
+
66
69
  pnpm exec commit-pack-init --workspace=workspace-name
67
70
  ```
68
71
 
@@ -229,253 +232,27 @@ module.exports = {
229
232
  6. 推送到分支 (`git push origin feature/amazing-feature`)
230
233
  7. 创建 Pull Request
231
234
 
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
-
331
- "rules": {
332
- "prettier/prettier": "error",
333
- "arrow-body-style": "off",
334
- "prefer-arrow-callback": "off"
335
- }
336
- }
337
- ```
338
-
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
-
346
- **.prettierrc**
347
- ```json
348
- {
349
- "singleQuote": true,
350
- "printWidth": 100,
351
- "jsxSingleQuote": true,
352
- "bracketSameLine": true,
353
- "semi": false,
354
- "plugins": ["prettier-plugin-tailwindcss"],
355
- "tabWidth": 2,
356
- "bracketSpacing": true,
357
- "trailingComma": "none"
358
- }
359
- ```
360
-
361
- ### Commitlint Configuration
362
- - Enforces conventional commit format
363
- - Custom emoji-prefixed commit types
364
- - Scope validation
365
- - Detailed commit message structure
366
-
367
- **.commitlintrc.json**
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
235
 
434
- messages: {
435
- type: "请选择提交类型(必填)",
436
- scope: "请选择文件修改范围(必填):",
437
- customScope: "请输自定义文件修改范围(必填)",
438
- subject: "请简要描述提交(必填)",
439
- body: "请输入详细描述(可选)",
440
- breaking: "列出任何breaking changes(可选)",
441
- footer: "请输入要关闭的issue(可选)",
442
- confirmCommit: "确定提交吗",
443
- },
444
236
 
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
237
 
455
- - `lint`: Run ESLint on all TypeScript/JavaScript/JSON files
456
- - `format`: Format all files using Prettier
457
- - `commit`: Interactive commit using commitizen
238
+ ## 致谢
239
+ > 本项目以工程整合与工作流设计为核心,
240
+ > 基于一组成熟且优秀的开源工具,
241
+ > 构建了一个更易用、更一致的开发者工具链。
242
+ >
243
+ > 本项目并未引入新的底层技术,
244
+ > 其价值主要体现在整合方案、默认配置与开发体验优化上。
245
+ >
246
+ > 相关核心能力均来自对应开源项目,特此致谢其作者与维护者。
247
+ - [ESLint](https://eslint.org/) —— 可配置、可扩展的 JavaScript 代码检查工具
248
+ - [Prettier](https://prettier.io/) —— 具有统一风格约定的代码格式化工具
249
+ - [Husky](https://typicode.github.io/husky/) —— 简化 Git Hooks 配置与使用的工具
250
+ - [lint-staged](https://github.com/okonet/lint-staged) —— 仅对暂存区文件运行代码检查
251
+ - [commitlint](https://commitlint.js.org/) —— 用于校验提交信息规范的工具
252
+ - [commitizen](https://github.com/commitizen/cz-cli) —— 交互式生成提交信息的工具
253
+ - [TypeScript](https://www.typescriptlang.org/) —— 面向大型应用的强类型 JavaScript
458
254
 
459
- ## 🤝 Contributing
460
255
 
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
256
+ ## ©️ 许可证
474
257
 
475
- - [ESLint](https://eslint.org/) - Pluggable JavaScript linter
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
258
+ 此项目根据 MIT 许可证授权 - 详见 [LICENSE](LICENSE) 文件。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commit-pack",
3
- "version": "1.1.8",
3
+ "version": "1.1.10",
4
4
  "description": "A setup package to automatly check project's style and commit configuration",
5
5
  "main": "lib/index.js",
6
6
  "bin": {