@programinglive/commiter 1.1.0 → 1.1.3
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/.github/ISSUE_TEMPLATE/bug_report.md +28 -28
- package/.github/ISSUE_TEMPLATE/config.yml +5 -5
- package/.github/ISSUE_TEMPLATE/feature_request.md +20 -20
- package/.github/PULL_REQUEST_TEMPLATE.md +24 -24
- package/CHANGELOG.md +59 -43
- package/CODE_OF_CONDUCT.md +36 -36
- package/LICENSE +21 -21
- package/PRD.md +86 -0
- package/PUBLISH.md +142 -142
- package/README.md +187 -187
- package/SECURITY.md +30 -30
- package/commitlint.config.cjs +4 -4
- package/docs/prd-fs-f-ok-warning.md +47 -0
- package/docs/release-notes/RELEASE_NOTES.md +52 -0
- package/docs/release-notes/fs-f-ok-warning.md +14 -0
- package/index.js +148 -148
- package/package.json +94 -94
- package/scripts/preload/fs-f-ok.cjs +23 -0
- package/scripts/release.js +127 -4
- package/scripts/update-release-notes.js +182 -0
package/PUBLISH.md
CHANGED
|
@@ -1,142 +1,142 @@
|
|
|
1
|
-
# Publishing to NPM
|
|
2
|
-
|
|
3
|
-
This guide explains how to publish the `@programinglive/commiter` package to npm.
|
|
4
|
-
|
|
5
|
-
## Prerequisites
|
|
6
|
-
|
|
7
|
-
1. **NPM Account**: Create an account at [npmjs.com](https://www.npmjs.com/)
|
|
8
|
-
2. **Login to NPM**: Run `npm login` in your terminal
|
|
9
|
-
3. **Organization Access**: Ensure you have access to the `@programinglive` organization on npm
|
|
10
|
-
|
|
11
|
-
## Publishing Steps
|
|
12
|
-
|
|
13
|
-
### 1. Login to NPM
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm login
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Enter your npm credentials when prompted.
|
|
20
|
-
|
|
21
|
-
### 2. Verify Package Configuration
|
|
22
|
-
|
|
23
|
-
Check that `package.json` is correctly configured:
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npm pack --dry-run
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
This shows what files will be included in the package.
|
|
30
|
-
|
|
31
|
-
### 3. Publish the Package
|
|
32
|
-
|
|
33
|
-
For the first publish:
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
npm publish --access public
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
**Note**: The `--access public` flag is required for scoped packages (@programinglive/commiter) to be publicly accessible.
|
|
40
|
-
|
|
41
|
-
### 4. Verify Publication
|
|
42
|
-
|
|
43
|
-
Check your package on npm:
|
|
44
|
-
```
|
|
45
|
-
https://www.npmjs.com/package/@programinglive/commiter
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## Releasing New Versions
|
|
49
|
-
|
|
50
|
-
After the initial publish, use the built-in release commands:
|
|
51
|
-
|
|
52
|
-
### Patch Release (1.0.0 → 1.0.1)
|
|
53
|
-
```bash
|
|
54
|
-
npm run release:patch
|
|
55
|
-
git push --follow-tags origin main
|
|
56
|
-
npm publish
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Minor Release (1.0.0 → 1.1.0)
|
|
60
|
-
```bash
|
|
61
|
-
npm run release:minor
|
|
62
|
-
git push --follow-tags origin main
|
|
63
|
-
npm publish
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### Major Release (1.0.0 → 2.0.0)
|
|
67
|
-
```bash
|
|
68
|
-
npm run release:major
|
|
69
|
-
git push --follow-tags origin main
|
|
70
|
-
npm publish
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## Automated Release Workflow
|
|
74
|
-
|
|
75
|
-
### Option 1: Manual Publishing (Traditional)
|
|
76
|
-
1. Make changes and commit using conventional commits
|
|
77
|
-
2. Run the appropriate release command
|
|
78
|
-
3. Push to GitHub with tags
|
|
79
|
-
4. Publish to npm
|
|
80
|
-
|
|
81
|
-
Example:
|
|
82
|
-
```bash
|
|
83
|
-
# Make changes
|
|
84
|
-
git add .
|
|
85
|
-
git commit -m "feat(cli): add interactive setup wizard"
|
|
86
|
-
|
|
87
|
-
# Create release
|
|
88
|
-
npm run release:minor
|
|
89
|
-
|
|
90
|
-
# Push to GitHub
|
|
91
|
-
git push --follow-tags origin main
|
|
92
|
-
|
|
93
|
-
# Publish to npm
|
|
94
|
-
npm publish
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
### Option 2: Automated Publishing (Recommended)
|
|
98
|
-
1. Make changes and commit using conventional commits
|
|
99
|
-
2. Run the appropriate release command
|
|
100
|
-
3. Push to GitHub with tags - **npm publishing happens automatically**
|
|
101
|
-
|
|
102
|
-
Example:
|
|
103
|
-
```bash
|
|
104
|
-
# Make changes
|
|
105
|
-
git add .
|
|
106
|
-
git commit -m "feat(cli): add interactive setup wizard"
|
|
107
|
-
|
|
108
|
-
# Create release
|
|
109
|
-
npm run release:minor
|
|
110
|
-
|
|
111
|
-
# Push to GitHub (triggers automatic npm publish)
|
|
112
|
-
git push --follow-tags origin main
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
**Setup Required for Automated Publishing:**
|
|
116
|
-
1. Add `NPM_TOKEN` secret to your GitHub repository
|
|
117
|
-
2. The GitHub Actions workflow (`.github/workflows/publish.yml`) will automatically:
|
|
118
|
-
- Run tests
|
|
119
|
-
- Publish to npm when a tag starting with `v` is pushed
|
|
120
|
-
- Use the `--access public` flag for scoped packages
|
|
121
|
-
|
|
122
|
-
## Unpublishing (Emergency Only)
|
|
123
|
-
|
|
124
|
-
If you need to unpublish a version within 72 hours:
|
|
125
|
-
|
|
126
|
-
```bash
|
|
127
|
-
npm unpublish @programinglive/commiter@1.0.0
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
**Warning**: Unpublishing is permanent and should only be used in emergencies.
|
|
131
|
-
|
|
132
|
-
## Package Visibility
|
|
133
|
-
|
|
134
|
-
- **Public**: Anyone can install and use the package
|
|
135
|
-
- **Open Source**: MIT licensed - users can modify and distribute
|
|
136
|
-
- **Free**: No cost to install or use
|
|
137
|
-
|
|
138
|
-
## Support
|
|
139
|
-
|
|
140
|
-
For issues or questions:
|
|
141
|
-
- GitHub Issues: https://github.com/programinglive/commiter/issues
|
|
142
|
-
- NPM Package: https://www.npmjs.com/package/@programinglive/commiter
|
|
1
|
+
# Publishing to NPM
|
|
2
|
+
|
|
3
|
+
This guide explains how to publish the `@programinglive/commiter` package to npm.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
1. **NPM Account**: Create an account at [npmjs.com](https://www.npmjs.com/)
|
|
8
|
+
2. **Login to NPM**: Run `npm login` in your terminal
|
|
9
|
+
3. **Organization Access**: Ensure you have access to the `@programinglive` organization on npm
|
|
10
|
+
|
|
11
|
+
## Publishing Steps
|
|
12
|
+
|
|
13
|
+
### 1. Login to NPM
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm login
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Enter your npm credentials when prompted.
|
|
20
|
+
|
|
21
|
+
### 2. Verify Package Configuration
|
|
22
|
+
|
|
23
|
+
Check that `package.json` is correctly configured:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm pack --dry-run
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
This shows what files will be included in the package.
|
|
30
|
+
|
|
31
|
+
### 3. Publish the Package
|
|
32
|
+
|
|
33
|
+
For the first publish:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm publish --access public
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Note**: The `--access public` flag is required for scoped packages (@programinglive/commiter) to be publicly accessible.
|
|
40
|
+
|
|
41
|
+
### 4. Verify Publication
|
|
42
|
+
|
|
43
|
+
Check your package on npm:
|
|
44
|
+
```
|
|
45
|
+
https://www.npmjs.com/package/@programinglive/commiter
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Releasing New Versions
|
|
49
|
+
|
|
50
|
+
After the initial publish, use the built-in release commands:
|
|
51
|
+
|
|
52
|
+
### Patch Release (1.0.0 → 1.0.1)
|
|
53
|
+
```bash
|
|
54
|
+
npm run release:patch
|
|
55
|
+
git push --follow-tags origin main
|
|
56
|
+
npm publish
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Minor Release (1.0.0 → 1.1.0)
|
|
60
|
+
```bash
|
|
61
|
+
npm run release:minor
|
|
62
|
+
git push --follow-tags origin main
|
|
63
|
+
npm publish
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Major Release (1.0.0 → 2.0.0)
|
|
67
|
+
```bash
|
|
68
|
+
npm run release:major
|
|
69
|
+
git push --follow-tags origin main
|
|
70
|
+
npm publish
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Automated Release Workflow
|
|
74
|
+
|
|
75
|
+
### Option 1: Manual Publishing (Traditional)
|
|
76
|
+
1. Make changes and commit using conventional commits
|
|
77
|
+
2. Run the appropriate release command
|
|
78
|
+
3. Push to GitHub with tags
|
|
79
|
+
4. Publish to npm
|
|
80
|
+
|
|
81
|
+
Example:
|
|
82
|
+
```bash
|
|
83
|
+
# Make changes
|
|
84
|
+
git add .
|
|
85
|
+
git commit -m "feat(cli): add interactive setup wizard"
|
|
86
|
+
|
|
87
|
+
# Create release
|
|
88
|
+
npm run release:minor
|
|
89
|
+
|
|
90
|
+
# Push to GitHub
|
|
91
|
+
git push --follow-tags origin main
|
|
92
|
+
|
|
93
|
+
# Publish to npm
|
|
94
|
+
npm publish
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Option 2: Automated Publishing (Recommended)
|
|
98
|
+
1. Make changes and commit using conventional commits
|
|
99
|
+
2. Run the appropriate release command
|
|
100
|
+
3. Push to GitHub with tags - **npm publishing happens automatically**
|
|
101
|
+
|
|
102
|
+
Example:
|
|
103
|
+
```bash
|
|
104
|
+
# Make changes
|
|
105
|
+
git add .
|
|
106
|
+
git commit -m "feat(cli): add interactive setup wizard"
|
|
107
|
+
|
|
108
|
+
# Create release
|
|
109
|
+
npm run release:minor
|
|
110
|
+
|
|
111
|
+
# Push to GitHub (triggers automatic npm publish)
|
|
112
|
+
git push --follow-tags origin main
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Setup Required for Automated Publishing:**
|
|
116
|
+
1. Add `NPM_TOKEN` secret to your GitHub repository
|
|
117
|
+
2. The GitHub Actions workflow (`.github/workflows/publish.yml`) will automatically:
|
|
118
|
+
- Run tests
|
|
119
|
+
- Publish to npm when a tag starting with `v` is pushed
|
|
120
|
+
- Use the `--access public` flag for scoped packages
|
|
121
|
+
|
|
122
|
+
## Unpublishing (Emergency Only)
|
|
123
|
+
|
|
124
|
+
If you need to unpublish a version within 72 hours:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
npm unpublish @programinglive/commiter@1.0.0
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Warning**: Unpublishing is permanent and should only be used in emergencies.
|
|
131
|
+
|
|
132
|
+
## Package Visibility
|
|
133
|
+
|
|
134
|
+
- **Public**: Anyone can install and use the package
|
|
135
|
+
- **Open Source**: MIT licensed - users can modify and distribute
|
|
136
|
+
- **Free**: No cost to install or use
|
|
137
|
+
|
|
138
|
+
## Support
|
|
139
|
+
|
|
140
|
+
For issues or questions:
|
|
141
|
+
- GitHub Issues: https://github.com/programinglive/commiter/issues
|
|
142
|
+
- NPM Package: https://www.npmjs.com/package/@programinglive/commiter
|
package/README.md
CHANGED
|
@@ -1,187 +1,187 @@
|
|
|
1
|
-
# Commiter 🚀
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/@programinglive/commiter)
|
|
4
|
-
[](https://www.npmjs.com/package/@programinglive/commiter)
|
|
5
|
-
[](https://github.com/programinglive/commiter/actions/workflows/publish.yml)
|
|
6
|
-
[](LICENSE)
|
|
7
|
-
|
|
8
|
-
A standardized commit convention and release management tool for your repository using `standard-version`.
|
|
9
|
-
|
|
10
|
-
## Features
|
|
11
|
-
|
|
12
|
-
- ✅ **Enforced Commit Conventions** - Uses Conventional Commits format
|
|
13
|
-
- 🎯 **Automated Versioning** - Semantic versioning (major, minor, patch)
|
|
14
|
-
- 📝 **Changelog Generation** - Automatic CHANGELOG.md with icons
|
|
15
|
-
- 🔒 **Git Hooks** - Pre-commit and commit-msg validation via Husky
|
|
16
|
-
- 🎨 **Icon Support** - Each commit type has a dedicated icon in releases
|
|
17
|
-
|
|
18
|
-
## Installation
|
|
19
|
-
|
|
20
|
-
Install the package globally or as a dev dependency in your project:
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
# Install globally
|
|
24
|
-
npm install -g @programinglive/commiter
|
|
25
|
-
|
|
26
|
-
# Or install as dev dependency
|
|
27
|
-
npm install --save-dev @programinglive/commiter
|
|
28
|
-
|
|
29
|
-
# Or use npx (no installation required)
|
|
30
|
-
npx @programinglive/commiter
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
After installation in your project, the Husky hooks will be automatically set up for commit message validation.
|
|
34
|
-
|
|
35
|
-
## Commit Message Format
|
|
36
|
-
|
|
37
|
-
All commits must follow the [Conventional Commits](https://www.conventionalcommits.org/) specification:
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
<type>(<scope>): <subject>
|
|
41
|
-
|
|
42
|
-
<body>
|
|
43
|
-
|
|
44
|
-
<footer>
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Commit Types with Icons
|
|
48
|
-
|
|
49
|
-
| Type | Icon | Description | Changelog Section |
|
|
50
|
-
|------|------|-------------|-------------------|
|
|
51
|
-
| `feat` | ✨ | New feature | ✨ Features |
|
|
52
|
-
| `fix` | 🐛 | Bug fix | 🐛 Bug Fixes |
|
|
53
|
-
| `perf` | ⚡ | Performance improvement | ⚡ Performance |
|
|
54
|
-
| `refactor` | ♻️ | Code refactoring | ♻️ Refactors |
|
|
55
|
-
| `docs` | 📝 | Documentation changes | 📝 Documentation |
|
|
56
|
-
| `style` | 💄 | Code style changes | 💄 Styles |
|
|
57
|
-
| `test` | ✅ | Test additions/changes | ✅ Tests |
|
|
58
|
-
| `build` | 🏗️ | Build system changes | 🏗️ Build System |
|
|
59
|
-
| `ci` | 👷 | CI/CD changes | 👷 Continuous Integration |
|
|
60
|
-
| `chore` | 🧹 | Maintenance tasks | 🧹 Chores |
|
|
61
|
-
| `revert` | ⏪ | Revert previous commit | ⏪ Reverts |
|
|
62
|
-
|
|
63
|
-
### Examples
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
# Feature
|
|
67
|
-
git commit -m "feat(auth): add JWT authentication"
|
|
68
|
-
|
|
69
|
-
# Bug fix
|
|
70
|
-
git commit -m "fix(api): resolve null pointer exception"
|
|
71
|
-
|
|
72
|
-
# Breaking change
|
|
73
|
-
git commit -m "feat(api)!: redesign user endpoint
|
|
74
|
-
|
|
75
|
-
BREAKING CHANGE: The user endpoint now returns different data structure"
|
|
76
|
-
|
|
77
|
-
# With scope and body
|
|
78
|
-
git commit -m "perf(database): optimize query performance
|
|
79
|
-
|
|
80
|
-
Reduced query time by 50% using indexed columns"
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## Release Commands
|
|
84
|
-
|
|
85
|
-
### Patch Release (1.0.0 → 1.0.1)
|
|
86
|
-
|
|
87
|
-
For bug fixes and minor changes:
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
npm run release:patch
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### Minor Release (1.0.0 → 1.1.0)
|
|
94
|
-
|
|
95
|
-
For new features (backwards compatible):
|
|
96
|
-
|
|
97
|
-
```bash
|
|
98
|
-
npm run release:minor
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### Major Release (1.0.0 → 2.0.0)
|
|
102
|
-
|
|
103
|
-
For breaking changes:
|
|
104
|
-
|
|
105
|
-
```bash
|
|
106
|
-
npm run release:major
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### Automatic Release
|
|
110
|
-
|
|
111
|
-
Let `standard-version` determine the version bump based on commits:
|
|
112
|
-
|
|
113
|
-
```bash
|
|
114
|
-
npm run release
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
## What Happens During Release?
|
|
118
|
-
|
|
119
|
-
1. 🧪 Detects your package manager and runs the `test` script automatically
|
|
120
|
-
2. 📊 Analyzes commits since last release
|
|
121
|
-
3. 🔢 Bumps version in `package.json`
|
|
122
|
-
4. 📝 Updates `CHANGELOG.md` with icons
|
|
123
|
-
5. 🏷️ Creates a git tag
|
|
124
|
-
6. 💾 Commits changes with format: `chore(release): v1.2.3 🚀`
|
|
125
|
-
|
|
126
|
-
## Push Your Release
|
|
127
|
-
|
|
128
|
-
After running a release command, push to remote:
|
|
129
|
-
|
|
130
|
-
```bash
|
|
131
|
-
git push --follow-tags origin main
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
## Pre-commit Hooks
|
|
135
|
-
|
|
136
|
-
The following hooks are automatically enforced:
|
|
137
|
-
|
|
138
|
-
- **commit-msg**: Validates commit message format using commitlint
|
|
139
|
-
- **pre-commit**: Runs tests before allowing commits
|
|
140
|
-
|
|
141
|
-
## Configuration Files
|
|
142
|
-
|
|
143
|
-
- `package.json` - Contains `standard-version` configuration
|
|
144
|
-
- `commitlint.config.js` - Commitlint rules
|
|
145
|
-
- `.husky/commit-msg` - Commit message validation hook
|
|
146
|
-
- `.husky/pre-commit` - Pre-commit test hook
|
|
147
|
-
|
|
148
|
-
## Troubleshooting
|
|
149
|
-
|
|
150
|
-
### Commit message validation fails
|
|
151
|
-
|
|
152
|
-
Ensure your commit message follows the format:
|
|
153
|
-
```
|
|
154
|
-
type(scope): subject
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
Valid types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`
|
|
158
|
-
|
|
159
|
-
Release commits generated by `standard-version` such as `chore(release): 1.0.0 🚀` are automatically ignored by `commitlint`.
|
|
160
|
-
|
|
161
|
-
### First release
|
|
162
|
-
|
|
163
|
-
If this is your first release and you don't have a version tag yet:
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
npm run release -- --first-release
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
Running the setup command ensures the default `npm test` script is `echo "No tests specified"`, preventing the Husky `pre-commit` hook from failing during this initial release. Replace it with your real test command once available.
|
|
170
|
-
|
|
171
|
-
### Dry run
|
|
172
|
-
|
|
173
|
-
To see what would happen without making changes:
|
|
174
|
-
|
|
175
|
-
```bash
|
|
176
|
-
npm run release -- --dry-run
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
## Contributing
|
|
180
|
-
|
|
181
|
-
Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.
|
|
182
|
-
|
|
183
|
-
## License
|
|
184
|
-
|
|
185
|
-
MIT License - see the [LICENSE](LICENSE) file for details.
|
|
186
|
-
|
|
187
|
-
This project is open source and free to use, modify, and distribute at your own risk.
|
|
1
|
+
# Commiter 🚀
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@programinglive/commiter)
|
|
4
|
+
[](https://www.npmjs.com/package/@programinglive/commiter)
|
|
5
|
+
[](https://github.com/programinglive/commiter/actions/workflows/publish.yml)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
A standardized commit convention and release management tool for your repository using `standard-version`.
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- ✅ **Enforced Commit Conventions** - Uses Conventional Commits format
|
|
13
|
+
- 🎯 **Automated Versioning** - Semantic versioning (major, minor, patch)
|
|
14
|
+
- 📝 **Changelog Generation** - Automatic CHANGELOG.md with icons
|
|
15
|
+
- 🔒 **Git Hooks** - Pre-commit and commit-msg validation via Husky
|
|
16
|
+
- 🎨 **Icon Support** - Each commit type has a dedicated icon in releases
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
Install the package globally or as a dev dependency in your project:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Install globally
|
|
24
|
+
npm install -g @programinglive/commiter
|
|
25
|
+
|
|
26
|
+
# Or install as dev dependency
|
|
27
|
+
npm install --save-dev @programinglive/commiter
|
|
28
|
+
|
|
29
|
+
# Or use npx (no installation required)
|
|
30
|
+
npx @programinglive/commiter
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
After installation in your project, the Husky hooks will be automatically set up for commit message validation.
|
|
34
|
+
|
|
35
|
+
## Commit Message Format
|
|
36
|
+
|
|
37
|
+
All commits must follow the [Conventional Commits](https://www.conventionalcommits.org/) specification:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
<type>(<scope>): <subject>
|
|
41
|
+
|
|
42
|
+
<body>
|
|
43
|
+
|
|
44
|
+
<footer>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Commit Types with Icons
|
|
48
|
+
|
|
49
|
+
| Type | Icon | Description | Changelog Section |
|
|
50
|
+
|------|------|-------------|-------------------|
|
|
51
|
+
| `feat` | ✨ | New feature | ✨ Features |
|
|
52
|
+
| `fix` | 🐛 | Bug fix | 🐛 Bug Fixes |
|
|
53
|
+
| `perf` | ⚡ | Performance improvement | ⚡ Performance |
|
|
54
|
+
| `refactor` | ♻️ | Code refactoring | ♻️ Refactors |
|
|
55
|
+
| `docs` | 📝 | Documentation changes | 📝 Documentation |
|
|
56
|
+
| `style` | 💄 | Code style changes | 💄 Styles |
|
|
57
|
+
| `test` | ✅ | Test additions/changes | ✅ Tests |
|
|
58
|
+
| `build` | 🏗️ | Build system changes | 🏗️ Build System |
|
|
59
|
+
| `ci` | 👷 | CI/CD changes | 👷 Continuous Integration |
|
|
60
|
+
| `chore` | 🧹 | Maintenance tasks | 🧹 Chores |
|
|
61
|
+
| `revert` | ⏪ | Revert previous commit | ⏪ Reverts |
|
|
62
|
+
|
|
63
|
+
### Examples
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Feature
|
|
67
|
+
git commit -m "feat(auth): add JWT authentication"
|
|
68
|
+
|
|
69
|
+
# Bug fix
|
|
70
|
+
git commit -m "fix(api): resolve null pointer exception"
|
|
71
|
+
|
|
72
|
+
# Breaking change
|
|
73
|
+
git commit -m "feat(api)!: redesign user endpoint
|
|
74
|
+
|
|
75
|
+
BREAKING CHANGE: The user endpoint now returns different data structure"
|
|
76
|
+
|
|
77
|
+
# With scope and body
|
|
78
|
+
git commit -m "perf(database): optimize query performance
|
|
79
|
+
|
|
80
|
+
Reduced query time by 50% using indexed columns"
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Release Commands
|
|
84
|
+
|
|
85
|
+
### Patch Release (1.0.0 → 1.0.1)
|
|
86
|
+
|
|
87
|
+
For bug fixes and minor changes:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
npm run release:patch
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Minor Release (1.0.0 → 1.1.0)
|
|
94
|
+
|
|
95
|
+
For new features (backwards compatible):
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
npm run release:minor
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Major Release (1.0.0 → 2.0.0)
|
|
102
|
+
|
|
103
|
+
For breaking changes:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
npm run release:major
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Automatic Release
|
|
110
|
+
|
|
111
|
+
Let `standard-version` determine the version bump based on commits:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
npm run release
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## What Happens During Release?
|
|
118
|
+
|
|
119
|
+
1. 🧪 Detects your package manager and runs the `test` script automatically
|
|
120
|
+
2. 📊 Analyzes commits since last release
|
|
121
|
+
3. 🔢 Bumps version in `package.json`
|
|
122
|
+
4. 📝 Updates `CHANGELOG.md` with icons
|
|
123
|
+
5. 🏷️ Creates a git tag
|
|
124
|
+
6. 💾 Commits changes with format: `chore(release): v1.2.3 🚀`
|
|
125
|
+
|
|
126
|
+
## Push Your Release
|
|
127
|
+
|
|
128
|
+
After running a release command, push to remote:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
git push --follow-tags origin main
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Pre-commit Hooks
|
|
135
|
+
|
|
136
|
+
The following hooks are automatically enforced:
|
|
137
|
+
|
|
138
|
+
- **commit-msg**: Validates commit message format using commitlint
|
|
139
|
+
- **pre-commit**: Runs tests before allowing commits
|
|
140
|
+
|
|
141
|
+
## Configuration Files
|
|
142
|
+
|
|
143
|
+
- `package.json` - Contains `standard-version` configuration
|
|
144
|
+
- `commitlint.config.js` - Commitlint rules
|
|
145
|
+
- `.husky/commit-msg` - Commit message validation hook
|
|
146
|
+
- `.husky/pre-commit` - Pre-commit test hook
|
|
147
|
+
|
|
148
|
+
## Troubleshooting
|
|
149
|
+
|
|
150
|
+
### Commit message validation fails
|
|
151
|
+
|
|
152
|
+
Ensure your commit message follows the format:
|
|
153
|
+
```
|
|
154
|
+
type(scope): subject
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Valid types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`
|
|
158
|
+
|
|
159
|
+
Release commits generated by `standard-version` such as `chore(release): 1.0.0 🚀` are automatically ignored by `commitlint`.
|
|
160
|
+
|
|
161
|
+
### First release
|
|
162
|
+
|
|
163
|
+
If this is your first release and you don't have a version tag yet:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
npm run release -- --first-release
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Running the setup command ensures the default `npm test` script is `echo "No tests specified"`, preventing the Husky `pre-commit` hook from failing during this initial release. Replace it with your real test command once available.
|
|
170
|
+
|
|
171
|
+
### Dry run
|
|
172
|
+
|
|
173
|
+
To see what would happen without making changes:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
npm run release -- --dry-run
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Contributing
|
|
180
|
+
|
|
181
|
+
Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.
|
|
182
|
+
|
|
183
|
+
## License
|
|
184
|
+
|
|
185
|
+
MIT License - see the [LICENSE](LICENSE) file for details.
|
|
186
|
+
|
|
187
|
+
This project is open source and free to use, modify, and distribute at your own risk.
|