eslint-plugin-traceability 1.0.4 → 1.0.5
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/workflows/ci-cd.yml +26 -18
- package/.husky/pre-commit +1 -1
- package/.releaserc.json +15 -0
- package/CHANGELOG.md +8 -1
- package/CONTRIBUTING.md +15 -13
- package/docs/conventional-commits-guide.md +185 -0
- package/docs/decisions/004-automated-version-bumping-for-ci-cd.md +3 -1
- package/docs/decisions/006-semantic-release-for-automated-publishing.accepted.md +227 -0
- package/package.json +7 -2
- package/lib/src/index.d.ts +0 -80
- package/lib/src/index.js +0 -58
- package/lib/src/maintenance/batch.d.ts +0 -16
- package/lib/src/maintenance/batch.js +0 -28
- package/lib/src/maintenance/detect.d.ts +0 -6
- package/lib/src/maintenance/detect.js +0 -69
- package/lib/src/maintenance/index.d.ts +0 -14
- package/lib/src/maintenance/index.js +0 -22
- package/lib/src/maintenance/report.d.ts +0 -7
- package/lib/src/maintenance/report.js +0 -17
- package/lib/src/maintenance/update.d.ts +0 -6
- package/lib/src/maintenance/update.js +0 -67
- package/lib/src/maintenance/utils.d.ts +0 -6
- package/lib/src/maintenance/utils.js +0 -64
- package/lib/src/rules/require-branch-annotation.d.ts +0 -7
- package/lib/src/rules/require-branch-annotation.js +0 -111
- package/lib/src/rules/require-req-annotation.d.ts +0 -7
- package/lib/src/rules/require-req-annotation.js +0 -38
- package/lib/src/rules/require-story-annotation.d.ts +0 -7
- package/lib/src/rules/require-story-annotation.js +0 -50
- package/lib/src/rules/valid-annotation-format.d.ts +0 -10
- package/lib/src/rules/valid-annotation-format.js +0 -60
- package/lib/src/rules/valid-req-reference.d.ts +0 -3
- package/lib/src/rules/valid-req-reference.js +0 -104
- package/lib/src/rules/valid-story-reference.d.ts +0 -3
- package/lib/src/rules/valid-story-reference.js +0 -168
- package/lib/tests/fixtures/stale/example.d.ts +0 -0
- package/lib/tests/fixtures/stale/example.js +0 -3
- package/lib/tests/fixtures/update/example.d.ts +0 -0
- package/lib/tests/fixtures/update/example.js +0 -3
- package/lib/tests/fixtures/valid-annotations/example.d.ts +0 -0
- package/lib/tests/fixtures/valid-annotations/example.js +0 -3
- package/lib/tests/maintenance/batch.test.d.ts +0 -1
- package/lib/tests/maintenance/batch.test.js +0 -79
- package/lib/tests/maintenance/detect-isolated.test.d.ts +0 -1
- package/lib/tests/maintenance/detect-isolated.test.js +0 -95
- package/lib/tests/maintenance/detect.test.d.ts +0 -1
- package/lib/tests/maintenance/detect.test.js +0 -23
- package/lib/tests/maintenance/report.test.d.ts +0 -1
- package/lib/tests/maintenance/report.test.js +0 -67
- package/lib/tests/maintenance/update-isolated.test.d.ts +0 -1
- package/lib/tests/maintenance/update-isolated.test.js +0 -66
- package/lib/tests/maintenance/update.test.d.ts +0 -1
- package/lib/tests/maintenance/update.test.js +0 -26
- package/lib/tests/plugin-default-export-and-configs.test.d.ts +0 -1
- package/lib/tests/plugin-default-export-and-configs.test.js +0 -72
- package/lib/tests/plugin-setup.test.d.ts +0 -1
- package/lib/tests/plugin-setup.test.js +0 -51
- package/lib/tests/rules/require-branch-annotation.test.d.ts +0 -1
- package/lib/tests/rules/require-branch-annotation.test.js +0 -253
- package/lib/tests/rules/require-req-annotation.test.d.ts +0 -1
- package/lib/tests/rules/require-req-annotation.test.js +0 -41
- package/lib/tests/rules/require-story-annotation.test.d.ts +0 -1
- package/lib/tests/rules/require-story-annotation.test.js +0 -36
- package/lib/tests/rules/valid-annotation-format.test.d.ts +0 -1
- package/lib/tests/rules/valid-annotation-format.test.js +0 -58
- package/lib/tests/rules/valid-req-reference.test.d.ts +0 -1
- package/lib/tests/rules/valid-req-reference.test.js +0 -87
- package/lib/tests/rules/valid-story-reference.test.d.ts +0 -1
- package/lib/tests/rules/valid-story-reference.test.js +0 -69
|
@@ -3,6 +3,8 @@ name: CI/CD Pipeline
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
5
|
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
6
8
|
|
|
7
9
|
jobs:
|
|
8
10
|
quality-checks:
|
|
@@ -14,6 +16,8 @@ jobs:
|
|
|
14
16
|
steps:
|
|
15
17
|
- name: Checkout code
|
|
16
18
|
uses: actions/checkout@v4
|
|
19
|
+
with:
|
|
20
|
+
fetch-depth: 0
|
|
17
21
|
|
|
18
22
|
- name: Setup Node.js
|
|
19
23
|
uses: actions/setup-node@v4
|
|
@@ -53,39 +57,43 @@ jobs:
|
|
|
53
57
|
run: npm audit --audit-level=high
|
|
54
58
|
|
|
55
59
|
deploy:
|
|
56
|
-
|
|
60
|
+
if: ${{ github.event_name == 'push' }}
|
|
61
|
+
name: Release
|
|
57
62
|
runs-on: ubuntu-latest
|
|
58
63
|
needs: quality-checks
|
|
64
|
+
permissions:
|
|
65
|
+
contents: write
|
|
66
|
+
issues: write
|
|
67
|
+
pull-requests: write
|
|
68
|
+
id-token: write
|
|
69
|
+
env:
|
|
70
|
+
HUSKY: 0
|
|
59
71
|
steps:
|
|
60
72
|
- name: Checkout code
|
|
61
73
|
uses: actions/checkout@v4
|
|
74
|
+
with:
|
|
75
|
+
fetch-depth: 0
|
|
62
76
|
|
|
63
77
|
- name: Setup Node.js
|
|
64
78
|
uses: actions/setup-node@v4
|
|
65
79
|
with:
|
|
66
|
-
node-version: '
|
|
67
|
-
cache: npm
|
|
68
|
-
registry-url: 'https://registry.npmjs.org'
|
|
80
|
+
node-version: '22.x'
|
|
69
81
|
|
|
70
82
|
- name: Install dependencies
|
|
71
83
|
run: npm ci
|
|
72
84
|
|
|
73
|
-
- name:
|
|
74
|
-
run:
|
|
75
|
-
|
|
76
|
-
- name: Publish to npm
|
|
85
|
+
- name: Release with semantic-release
|
|
86
|
+
run: npx semantic-release
|
|
77
87
|
env:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
- name: Pack plugin
|
|
82
|
-
run: npm pack
|
|
88
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
89
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
83
90
|
|
|
84
|
-
- name: Smoke
|
|
91
|
+
- name: Smoke test published package
|
|
85
92
|
run: |
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
npm
|
|
93
|
+
echo "Smoke testing eslint-plugin-traceability"
|
|
94
|
+
workdir=$(mktemp -d)
|
|
95
|
+
cd "$workdir"
|
|
96
|
+
npm init -y > /dev/null
|
|
97
|
+
npm install eslint-plugin-traceability > /dev/null
|
|
90
98
|
echo '{"plugins":["traceability"],"rules":{}}' > .eslintrc.json
|
|
91
99
|
npx eslint --print-config .
|
package/.husky/pre-commit
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
npm run format && npm run lint -- --max-warnings=0 && npm run type-check
|
|
1
|
+
npm run format && npm run lint -- --max-warnings=0 && npm run type-check && node node_modules/actionlint/actionlint.cjs .github/workflows/*.yml
|
package/.releaserc.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"branches": ["main"],
|
|
3
|
+
"plugins": [
|
|
4
|
+
"@semantic-release/commit-analyzer",
|
|
5
|
+
"@semantic-release/release-notes-generator",
|
|
6
|
+
[
|
|
7
|
+
"@semantic-release/changelog",
|
|
8
|
+
{
|
|
9
|
+
"changelogFile": "CHANGELOG.md"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"@semantic-release/npm",
|
|
13
|
+
"@semantic-release/github"
|
|
14
|
+
]
|
|
15
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.0.5](https://github.com/voder-ai/eslint-plugin-traceability/compare/v1.0.4...v1.0.5) (2025-11-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* remove @semantic-release/git plugin to prevent version commits ([277a0cc](https://github.com/voder-ai/eslint-plugin-traceability/commit/277a0cc5389ea43d41c1a277ec6929cac3104633))
|
|
7
|
+
|
|
1
8
|
# Changelog
|
|
2
9
|
|
|
3
10
|
All notable changes to this project will be documented in this file.
|
|
@@ -47,4 +54,4 @@ All notable changes to this project will be documented in this file.
|
|
|
47
54
|
- Comprehensive tests covering core validation rules.
|
|
48
55
|
|
|
49
56
|
### Fixed
|
|
50
|
-
- N/A
|
|
57
|
+
- N/A
|
package/CONTRIBUTING.md
CHANGED
|
@@ -27,26 +27,28 @@ When submitting a pull request (PR):
|
|
|
27
27
|
|
|
28
28
|
## Commit Message Conventions
|
|
29
29
|
|
|
30
|
-
We follow [Conventional Commits](https://www.conventionalcommits.org/) format
|
|
30
|
+
We follow [Conventional Commits](https://www.conventionalcommits.org/) format to enable automated semantic versioning and changelog generation.
|
|
31
|
+
|
|
32
|
+
For detailed guidelines and examples, see [docs/conventional-commits-guide.md](docs/conventional-commits-guide.md).
|
|
33
|
+
|
|
34
|
+
Commit messages should be structured as:
|
|
31
35
|
|
|
32
36
|
```
|
|
33
|
-
|
|
37
|
+
type[optional scope]: description
|
|
34
38
|
|
|
35
|
-
optional body
|
|
39
|
+
[optional body]
|
|
36
40
|
|
|
37
|
-
optional footer
|
|
41
|
+
[optional footer(s)]
|
|
38
42
|
```
|
|
39
43
|
|
|
40
|
-
|
|
44
|
+
Examples:
|
|
45
|
+
|
|
46
|
+
- `feat: add new validation rule` → minor version increment
|
|
47
|
+
- `fix: resolve parsing issue` → patch version increment
|
|
48
|
+
- `feat!: change API interface` → major version increment
|
|
49
|
+
- `docs: update README` → no version change
|
|
41
50
|
|
|
42
|
-
|
|
43
|
-
- `fix:` A bug fix
|
|
44
|
-
- `docs:` Documentation only changes
|
|
45
|
-
- `style:` Code style changes (formatting, linting)
|
|
46
|
-
- `refactor:` Code changes that neither fix a bug nor add a feature
|
|
47
|
-
- `perf:` Performance improvements
|
|
48
|
-
- `test:` Adding or updating tests
|
|
49
|
-
- `chore:` Other changes that do not modify src or test files
|
|
51
|
+
Common types: `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `chore`, `ci`
|
|
50
52
|
|
|
51
53
|
## Coding Style and Quality Checks
|
|
52
54
|
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# Conventional Commits Guide
|
|
2
|
+
|
|
3
|
+
This project uses [Conventional Commits](https://www.conventionalcommits.org/) to enable automated semantic versioning and changelog generation through semantic-release.
|
|
4
|
+
|
|
5
|
+
## Commit Message Format
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
<type>[optional scope]: <description>
|
|
9
|
+
|
|
10
|
+
[optional body]
|
|
11
|
+
|
|
12
|
+
[optional footer(s)]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Types and Version Impact
|
|
16
|
+
|
|
17
|
+
### `feat`: New Features (Minor Version)
|
|
18
|
+
|
|
19
|
+
- Adds new functionality
|
|
20
|
+
- Results in a **minor** version increment (e.g., 1.0.0 → 1.1.0)
|
|
21
|
+
|
|
22
|
+
Examples:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
feat: add new validation rule for story references
|
|
26
|
+
feat(rules): implement require-branch-annotation rule
|
|
27
|
+
feat: add CLI integration for batch processing
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### `fix`: Bug Fixes (Patch Version)
|
|
31
|
+
|
|
32
|
+
- Fixes existing functionality
|
|
33
|
+
- Results in a **patch** version increment (e.g., 1.0.0 → 1.0.1)
|
|
34
|
+
|
|
35
|
+
Examples:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
fix: resolve annotation parsing for multiline comments
|
|
39
|
+
fix(validation): handle edge case in reference checking
|
|
40
|
+
fix: prevent false positives in story reference detection
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Breaking Changes (Major Version)
|
|
44
|
+
|
|
45
|
+
- Any commit with `!` after the type or `BREAKING CHANGE:` in footer
|
|
46
|
+
- Results in a **major** version increment (e.g., 1.0.0 → 2.0.0)
|
|
47
|
+
|
|
48
|
+
Examples:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
feat!: change API interface for rule configuration
|
|
52
|
+
fix!: remove deprecated annotation format support
|
|
53
|
+
|
|
54
|
+
feat: add new validation options
|
|
55
|
+
|
|
56
|
+
BREAKING CHANGE: The `allowUnresolved` option has been removed.
|
|
57
|
+
Use `strict: false` instead.
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Other Types (No Version Change)
|
|
61
|
+
|
|
62
|
+
These don't trigger releases but appear in changelog:
|
|
63
|
+
|
|
64
|
+
- `docs`: Documentation changes
|
|
65
|
+
- `style`: Code style changes (formatting, etc.)
|
|
66
|
+
- `refactor`: Code refactoring without functional changes
|
|
67
|
+
- `test`: Adding or updating tests
|
|
68
|
+
- `chore`: Build process, auxiliary tools, or maintenance
|
|
69
|
+
- `perf`: Performance improvements
|
|
70
|
+
- `ci`: CI/CD configuration changes
|
|
71
|
+
|
|
72
|
+
Examples:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
docs: update README with installation instructions
|
|
76
|
+
test: add unit tests for validation rules
|
|
77
|
+
chore: update dependencies to latest versions
|
|
78
|
+
ci: configure semantic-release for automated publishing
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Scopes (Optional)
|
|
82
|
+
|
|
83
|
+
Use scopes to specify what part of the codebase is affected:
|
|
84
|
+
|
|
85
|
+
- `rules`: ESLint rule implementations
|
|
86
|
+
- `maintenance`: Maintenance scripts and utilities
|
|
87
|
+
- `cli`: Command-line integration tools
|
|
88
|
+
- `config`: Configuration and setup files
|
|
89
|
+
- `deps`: Dependency updates
|
|
90
|
+
|
|
91
|
+
Examples:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
feat(rules): add valid-annotation-format rule
|
|
95
|
+
fix(maintenance): resolve batch processing memory leak
|
|
96
|
+
docs(config): add ESLint 9 setup guide
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Best Practices
|
|
100
|
+
|
|
101
|
+
### Commit Message Guidelines
|
|
102
|
+
|
|
103
|
+
1. **Use imperative mood**: "add feature" not "added feature"
|
|
104
|
+
2. **Keep subject under 50 characters**: For better git log readability
|
|
105
|
+
3. **Capitalize the subject line**: Start with capital letter
|
|
106
|
+
4. **No period at the end**: Of the subject line
|
|
107
|
+
5. **Explain what and why**: In the body, not how
|
|
108
|
+
|
|
109
|
+
### When to Use Each Type
|
|
110
|
+
|
|
111
|
+
**Use `feat` when:**
|
|
112
|
+
|
|
113
|
+
- Adding new ESLint rules
|
|
114
|
+
- Adding new maintenance utilities
|
|
115
|
+
- Adding new configuration options
|
|
116
|
+
- Adding new CLI commands or features
|
|
117
|
+
|
|
118
|
+
**Use `fix` when:**
|
|
119
|
+
|
|
120
|
+
- Fixing rule logic or false positives/negatives
|
|
121
|
+
- Fixing crashes or runtime errors
|
|
122
|
+
- Fixing configuration issues
|
|
123
|
+
- Fixing documentation errors
|
|
124
|
+
|
|
125
|
+
**Use `refactor` when:**
|
|
126
|
+
|
|
127
|
+
- Improving code structure without changing behavior
|
|
128
|
+
- Renaming variables or functions
|
|
129
|
+
- Extracting common functionality
|
|
130
|
+
- Simplifying complex logic
|
|
131
|
+
|
|
132
|
+
**Use `docs` when:**
|
|
133
|
+
|
|
134
|
+
- Updating README, guides, or API documentation
|
|
135
|
+
- Adding code comments or JSDoc
|
|
136
|
+
- Updating examples or migration guides
|
|
137
|
+
|
|
138
|
+
### Example Workflow
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# New feature
|
|
142
|
+
git commit -m "feat(rules): add require-story-annotation rule
|
|
143
|
+
|
|
144
|
+
Implements validation to ensure all functions have @story annotations
|
|
145
|
+
linking them to user stories for traceability.
|
|
146
|
+
|
|
147
|
+
Resolves: #123"
|
|
148
|
+
|
|
149
|
+
# Bug fix
|
|
150
|
+
git commit -m "fix: resolve false positive in annotation parsing
|
|
151
|
+
|
|
152
|
+
The regex pattern was incorrectly matching inline comments.
|
|
153
|
+
Updated to only match block comments that start at beginning of line."
|
|
154
|
+
|
|
155
|
+
# Breaking change
|
|
156
|
+
git commit -m "feat!: change rule configuration schema
|
|
157
|
+
|
|
158
|
+
BREAKING CHANGE: Rule options now use 'patterns' instead of 'pattern'.
|
|
159
|
+
Update your ESLint config:
|
|
160
|
+
- Before: { "pattern": "REQ-*" }
|
|
161
|
+
+ After: { "patterns": ["REQ-*"] }"
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Integration with semantic-release
|
|
165
|
+
|
|
166
|
+
semantic-release analyzes commit messages to:
|
|
167
|
+
|
|
168
|
+
1. **Determine version bump**: Based on feat/fix/breaking change types
|
|
169
|
+
2. **Generate changelog**: From commit messages and pull request information
|
|
170
|
+
3. **Create git tags**: For each release
|
|
171
|
+
4. **Publish to npm**: Only when changes warrant a release
|
|
172
|
+
|
|
173
|
+
## Validation
|
|
174
|
+
|
|
175
|
+
Pre-commit hooks will validate your commit messages follow the conventional format. If you need to bypass validation temporarily (not recommended), use:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
git commit --no-verify -m "your message"
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Resources
|
|
182
|
+
|
|
183
|
+
- [Conventional Commits Specification](https://www.conventionalcommits.org/)
|
|
184
|
+
- [semantic-release Documentation](https://semantic-release.gitbook.io/)
|
|
185
|
+
- [Angular Commit Message Guidelines](https://github.com/angular/angular/blob/main/CONTRIBUTING.md#-commit-message-format)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
status: "
|
|
2
|
+
status: "superseded"
|
|
3
3
|
date: 2025-11-17
|
|
4
4
|
decision-makers: [Development Team]
|
|
5
5
|
consulted:
|
|
@@ -9,6 +9,8 @@ consulted:
|
|
|
9
9
|
Semantic Versioning Specification,
|
|
10
10
|
]
|
|
11
11
|
informed: [Project Stakeholders, CI/CD Pipeline Maintainers]
|
|
12
|
+
superseded-by: "006-semantic-release-for-automated-publishing"
|
|
13
|
+
superseded-date: "2025-11-17"
|
|
12
14
|
---
|
|
13
15
|
|
|
14
16
|
# Automated Version Bumping for CI/CD Publishing
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
---
|
|
2
|
+
status: "accepted"
|
|
3
|
+
date: 2025-11-17
|
|
4
|
+
decision-makers: [Development Team]
|
|
5
|
+
consulted:
|
|
6
|
+
[
|
|
7
|
+
semantic-release Documentation,
|
|
8
|
+
Conventional Commits Specification,
|
|
9
|
+
GitHub Actions Best Practices,
|
|
10
|
+
npm Publishing Guidelines,
|
|
11
|
+
]
|
|
12
|
+
informed: [Project Stakeholders, CI/CD Pipeline Maintainers]
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Semantic Release for Automated Publishing
|
|
16
|
+
|
|
17
|
+
## Context and Problem Statement
|
|
18
|
+
|
|
19
|
+
The current automated version bumping strategy (ADR 004) has several limitations that impact maintainability and developer experience:
|
|
20
|
+
|
|
21
|
+
1. **Single Increment Logic**: The CI/CD pipeline only increments the version once, requiring complex loop logic to handle cases where multiple increments are needed (e.g., when both 1.0.3 and 1.0.4 already exist on npm)
|
|
22
|
+
|
|
23
|
+
2. **No Semantic Version Determination**: The system only performs patch increments and cannot automatically determine when minor or major version bumps are appropriate based on the nature of changes
|
|
24
|
+
|
|
25
|
+
3. **Missing Release Management**: No automatic git tagging, release notes, or CHANGELOG.md generation, reducing traceability and release visibility
|
|
26
|
+
|
|
27
|
+
4. **Workflow Complexity**: The custom version increment logic in GitHub Actions is becoming complex and error-prone, potentially violating workflow validation best practices established in ADR 005
|
|
28
|
+
|
|
29
|
+
5. **Package.json/npm Version Drift**: The package.json version in the repository can lag behind the published npm version, creating confusion about the actual release state
|
|
30
|
+
|
|
31
|
+
The current approach was designed as a temporary solution to prevent npm publish failures, but its limitations suggest that a more comprehensive release automation strategy is needed.
|
|
32
|
+
|
|
33
|
+
## Decision Drivers
|
|
34
|
+
|
|
35
|
+
- Need for proper semantic version determination based on change significance
|
|
36
|
+
- Automatic generation of release notes and changelog maintenance
|
|
37
|
+
- Git tag creation for release tracking and traceability
|
|
38
|
+
- Elimination of complex custom version increment logic in CI/CD workflows
|
|
39
|
+
- Integration with conventional commit standards for automated version type detection
|
|
40
|
+
- Prevention of unnecessary publishing when no changes warrant a release
|
|
41
|
+
- Alignment with npm ecosystem best practices for release management
|
|
42
|
+
- Simplification of GitHub Actions workflow to improve maintainability and validation compliance
|
|
43
|
+
|
|
44
|
+
## Considered Options
|
|
45
|
+
|
|
46
|
+
- Enhance current in-memory version increment approach with loop logic
|
|
47
|
+
- Implement semantic-release with conventional commits
|
|
48
|
+
- Switch to git write-back approach with automated tagging
|
|
49
|
+
- Implement manual release workflow with GitHub releases
|
|
50
|
+
|
|
51
|
+
## Decision Outcome
|
|
52
|
+
|
|
53
|
+
Chosen option: "semantic-release with conventional commits", because it provides comprehensive release automation, proper semantic versioning, automated changelog generation, and eliminates the need for complex custom version logic while following industry standards.
|
|
54
|
+
|
|
55
|
+
### Implementation Strategy
|
|
56
|
+
|
|
57
|
+
1. **Install and Configure semantic-release**:
|
|
58
|
+
- Add `semantic-release` and related plugins as development dependencies
|
|
59
|
+
- Configure semantic-release with conventional commits preset
|
|
60
|
+
- Set up plugins for npm publishing, git tagging, and changelog generation
|
|
61
|
+
|
|
62
|
+
2. **Establish Conventional Commit Standards**:
|
|
63
|
+
- Adopt conventional commit message format for semantic version determination
|
|
64
|
+
- Configure semantic-release to analyze commit messages for version impact
|
|
65
|
+
- Document commit message guidelines for contributors
|
|
66
|
+
|
|
67
|
+
3. **Update CI/CD Pipeline**:
|
|
68
|
+
- Replace custom version increment logic with semantic-release execution
|
|
69
|
+
- Configure semantic-release to run on main branch pushes
|
|
70
|
+
- Set up proper npm registry authentication and git permissions
|
|
71
|
+
|
|
72
|
+
4. **Configure Release Automation**:
|
|
73
|
+
- Automatic CHANGELOG.md generation and maintenance
|
|
74
|
+
- Git tag creation for each release
|
|
75
|
+
- GitHub release creation with release notes
|
|
76
|
+
- Conditional publishing (only when changes warrant a release)
|
|
77
|
+
|
|
78
|
+
### Consequences
|
|
79
|
+
|
|
80
|
+
- Good, because eliminates complex custom version increment logic from CI/CD workflows
|
|
81
|
+
- Good, because provides proper semantic version determination based on commit analysis
|
|
82
|
+
- Good, because automatically generates and maintains CHANGELOG.md with release notes
|
|
83
|
+
- Good, because creates proper git tags and GitHub releases for traceability
|
|
84
|
+
- Good, because follows conventional commits standard adopted widely in open source
|
|
85
|
+
- Good, because only publishes when changes actually warrant a new release
|
|
86
|
+
- Good, because avoids package.json version drift by using git tags as source of truth
|
|
87
|
+
- Good, because simplifies GitHub Actions workflow, improving validation compliance
|
|
88
|
+
- Good, because provides comprehensive release management with minimal configuration
|
|
89
|
+
- Good, because prevents infinite CI loops from version commits
|
|
90
|
+
- Neutral, because requires team adoption of conventional commit message format
|
|
91
|
+
- Neutral, because package.json version in repository may lag behind published version (git tags are source of truth)
|
|
92
|
+
- Bad, because introduces dependency on semantic-release tool and its ecosystem
|
|
93
|
+
- Bad, because may require learning curve for conventional commit message format
|
|
94
|
+
|
|
95
|
+
### Confirmation
|
|
96
|
+
|
|
97
|
+
Implementation compliance will be confirmed through:
|
|
98
|
+
|
|
99
|
+
- semantic-release successfully analyzes commits and determines appropriate version increments
|
|
100
|
+
- Automatic CHANGELOG.md generation and git tag creation on releases
|
|
101
|
+
- CI/CD pipeline publishes to npm only when semantic-release determines a release is warranted
|
|
102
|
+
- No npm publish failures due to version conflicts or unnecessary publishing attempts
|
|
103
|
+
- Package.json version remains synchronized with published npm version
|
|
104
|
+
- GitHub Actions workflow simplified and validates successfully with actionlint (ADR 005)
|
|
105
|
+
- Conventional commit message format adopted and documented for contributors
|
|
106
|
+
|
|
107
|
+
## Pros and Cons of the Options
|
|
108
|
+
|
|
109
|
+
### semantic-release with conventional commits
|
|
110
|
+
|
|
111
|
+
Comprehensive automated release management based on commit message analysis.
|
|
112
|
+
|
|
113
|
+
- Good, because industry standard tool with extensive ecosystem
|
|
114
|
+
- Good, because proper semantic version determination based on commit analysis
|
|
115
|
+
- Good, because automatic CHANGELOG.md and release notes generation
|
|
116
|
+
- Good, because creates git tags and GitHub releases automatically
|
|
117
|
+
- Good, because only publishes when changes warrant a release
|
|
118
|
+
- Good, because eliminates custom version increment logic complexity
|
|
119
|
+
- Good, because maintains git history and package.json synchronization
|
|
120
|
+
- Good, because follows conventional commits standard
|
|
121
|
+
- Good, because comprehensive documentation and community support
|
|
122
|
+
- Neutral, because requires conventional commit message discipline
|
|
123
|
+
- Neutral, because adds dependency on semantic-release ecosystem
|
|
124
|
+
- Bad, because requires git write permissions in CI/CD
|
|
125
|
+
- Bad, because learning curve for commit message conventions
|
|
126
|
+
|
|
127
|
+
### Enhanced in-memory version increment with loop logic
|
|
128
|
+
|
|
129
|
+
Improve the current approach with better version conflict resolution.
|
|
130
|
+
|
|
131
|
+
- Good, because builds on existing working foundation
|
|
132
|
+
- Good, because no external dependencies or new tooling
|
|
133
|
+
- Good, because maintains current simplicity of git read-only CI/CD
|
|
134
|
+
- Neutral, because addresses immediate technical limitation
|
|
135
|
+
- Bad, because still provides only patch-level version increments
|
|
136
|
+
- Bad, because no semantic version determination capability
|
|
137
|
+
- Bad, because no automatic changelog or git tag generation
|
|
138
|
+
- Bad, because increases complexity of custom GitHub Actions logic
|
|
139
|
+
- Bad, because doesn't address package.json/npm version synchronization
|
|
140
|
+
- Bad, because potential for workflow validation issues with complex logic
|
|
141
|
+
|
|
142
|
+
### Git write-back approach with automated tagging
|
|
143
|
+
|
|
144
|
+
Custom solution with git operations for version commits and tagging.
|
|
145
|
+
|
|
146
|
+
- Good, because provides git tag creation and version history
|
|
147
|
+
- Good, because maintains package.json synchronization
|
|
148
|
+
- Good, because can be customized for specific project needs
|
|
149
|
+
- Neutral, because requires git write permissions
|
|
150
|
+
- Bad, because requires complex infinite loop prevention logic
|
|
151
|
+
- Bad, because no semantic version determination
|
|
152
|
+
- Bad, because no automated changelog generation
|
|
153
|
+
- Bad, because potential race conditions in CI/CD
|
|
154
|
+
- Bad, because increased failure modes with git operations
|
|
155
|
+
- Bad, because custom implementation maintenance burden
|
|
156
|
+
|
|
157
|
+
### Manual release workflow with GitHub releases
|
|
158
|
+
|
|
159
|
+
Manual release creation through GitHub interface with automated publishing.
|
|
160
|
+
|
|
161
|
+
- Good, because provides full control over release timing and messaging
|
|
162
|
+
- Good, because natural integration with GitHub releases interface
|
|
163
|
+
- Good, because allows for manual changelog and release notes
|
|
164
|
+
- Good, because no automated commit message requirements
|
|
165
|
+
- Neutral, because requires manual intervention for releases
|
|
166
|
+
- Bad, because breaks continuous delivery principle
|
|
167
|
+
- Bad, because prone to human error and forgotten releases
|
|
168
|
+
- Bad, because no automation of version determination
|
|
169
|
+
- Bad, because workflow friction for regular development
|
|
170
|
+
- Bad, because doesn't solve original npm publish failure problem
|
|
171
|
+
|
|
172
|
+
## More Information
|
|
173
|
+
|
|
174
|
+
This decision supersedes ADR 004 "Automated Version Bumping for CI/CD Publishing", which served as a temporary solution to prevent npm publish failures but has reached its limitations in terms of semantic versioning and release management.
|
|
175
|
+
|
|
176
|
+
semantic-release configuration will include:
|
|
177
|
+
|
|
178
|
+
```json
|
|
179
|
+
{
|
|
180
|
+
"branches": ["main"],
|
|
181
|
+
"plugins": [
|
|
182
|
+
"@semantic-release/commit-analyzer",
|
|
183
|
+
"@semantic-release/release-notes-generator",
|
|
184
|
+
"@semantic-release/changelog",
|
|
185
|
+
"@semantic-release/npm",
|
|
186
|
+
"@semantic-release/github"
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**Note**: The `@semantic-release/git` plugin is intentionally excluded. semantic-release will manage versions through git tags only, without committing version changes back to package.json. This approach:
|
|
192
|
+
|
|
193
|
+
- Prevents infinite CI loops from version commits
|
|
194
|
+
- Follows npm ecosystem best practices where tags are the source of truth
|
|
195
|
+
- Keeps the repository history clean of automated version bump commits
|
|
196
|
+
- Aligns with how other projects in the ecosystem use semantic-release
|
|
197
|
+
|
|
198
|
+
The published npm package will have the correct version, but package.json in the repository may not reflect the latest published version. Git tags serve as the authoritative version record.
|
|
199
|
+
|
|
200
|
+
Conventional commit format examples:
|
|
201
|
+
|
|
202
|
+
- `feat: add new validation rule` → minor version increment
|
|
203
|
+
- `fix: resolve annotation parsing issue` → patch version increment
|
|
204
|
+
- `feat!: change API interface` → major version increment
|
|
205
|
+
- `docs: update README` → no version increment
|
|
206
|
+
|
|
207
|
+
GitHub Actions workflow simplification:
|
|
208
|
+
|
|
209
|
+
- Remove custom version increment logic
|
|
210
|
+
- Replace with single `npx semantic-release` command
|
|
211
|
+
- Configure necessary permissions (contents:write, issues:write, pull-requests:write, id-token:write)
|
|
212
|
+
- Set HUSKY=0 environment variable to disable git hooks during release
|
|
213
|
+
- Maintain existing quality checks and security audits
|
|
214
|
+
- Add smoke test for published package verification
|
|
215
|
+
|
|
216
|
+
This decision should be re-evaluated if:
|
|
217
|
+
|
|
218
|
+
- Conventional commit discipline becomes difficult to maintain
|
|
219
|
+
- semantic-release ecosystem introduces breaking changes or maintenance issues
|
|
220
|
+
- Project requirements change to need custom release logic not supported by semantic-release
|
|
221
|
+
- Team prefers different commit message standards incompatible with conventional commits
|
|
222
|
+
|
|
223
|
+
Related resources:
|
|
224
|
+
|
|
225
|
+
- [semantic-release Documentation](https://semantic-release.gitbook.io/)
|
|
226
|
+
- [Conventional Commits Specification](https://www.conventionalcommits.org/)
|
|
227
|
+
- [GitHub Actions with semantic-release](https://github.com/semantic-release/semantic-release/blob/master/docs/recipes/github-actions.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-traceability",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -41,17 +41,22 @@
|
|
|
41
41
|
"homepage": "https://github.com/voder-ai/eslint-plugin-traceability#readme",
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@eslint/js": "^9.39.1",
|
|
44
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
45
|
+
"@semantic-release/git": "^10.0.1",
|
|
46
|
+
"@semantic-release/github": "^12.0.2",
|
|
44
47
|
"@types/eslint": "^9.6.1",
|
|
45
48
|
"@types/jest": "^30.0.0",
|
|
46
49
|
"@types/node": "^24.10.1",
|
|
47
50
|
"@typescript-eslint/parser": "^8.46.4",
|
|
48
51
|
"@typescript-eslint/utils": "^8.46.4",
|
|
52
|
+
"actionlint": "^2.0.6",
|
|
49
53
|
"eslint": "^9.39.1",
|
|
50
54
|
"husky": "^9.1.7",
|
|
51
55
|
"jest": "^30.2.0",
|
|
52
56
|
"jscpd": "^4.0.5",
|
|
53
57
|
"lint-staged": "^16.2.6",
|
|
54
58
|
"prettier": "^3.6.2",
|
|
59
|
+
"semantic-release": "^25.0.2",
|
|
55
60
|
"ts-jest": "^29.4.5",
|
|
56
61
|
"typescript": "^5.9.3"
|
|
57
62
|
},
|
|
@@ -64,4 +69,4 @@
|
|
|
64
69
|
"overrides": {
|
|
65
70
|
"js-yaml": ">=4.1.1"
|
|
66
71
|
}
|
|
67
|
-
}
|
|
72
|
+
}
|