eslint-plugin-traceability 1.0.2 → 1.0.4
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 -28
- package/.husky/pre-commit +1 -1
- package/.husky/pre-push +1 -1
- package/.prettierignore +5 -1
- package/.voder/history.md +117 -149
- package/.voder/implementation-progress.md +110 -112
- package/.voder/last-action.md +61 -117
- package/.voder/plan.md +10 -10
- package/.voder/progress-chart.png +0 -0
- package/.voder/progress-log-areas.csv +4 -0
- package/.voder/progress-log.csv +4 -0
- package/CHANGELOG.md +12 -0
- package/README.md +2 -2
- package/cli-integration.js +61 -115
- package/docs/cli-integration.md +3 -1
- package/docs/decisions/004-automated-version-bumping-for-ci-cd.md +87 -58
- package/docs/decisions/005-github-actions-validation-tooling.accepted.md +144 -0
- package/eslint.config.js +4 -4
- package/lib/tests/{basic.test.js → plugin-setup.test.js} +1 -1
- package/package.json +1 -1
- package/tests/{basic.test.ts → plugin-setup.test.ts} +1 -1
- package/user-docs/migration-guide.md +71 -0
- package/lib/index.d.ts +0 -26
- package/lib/index.js +0 -11
- package/lib/tests/integration/file-validation.test.d.ts +0 -1
- package/lib/tests/integration/file-validation.test.js +0 -71
- package/lib/tests/integration/plugin-validation.test.d.ts +0 -1
- package/lib/tests/integration/plugin-validation.test.js +0 -83
- package/tests/integration/file-validation.test.ts +0 -78
- package/tests/integration/plugin-validation.test.ts +0 -84
- /package/lib/tests/{basic.test.d.ts → plugin-default-export-and-configs.test.d.ts} +0 -0
- /package/lib/tests/{index.test.js → plugin-default-export-and-configs.test.js} +0 -0
- /package/lib/tests/{index.test.d.ts → plugin-setup.test.d.ts} +0 -0
- /package/tests/{index.test.ts → plugin-default-export-and-configs.test.ts} +0 -0
package/.voder/plan.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
## NOW
|
|
2
|
-
|
|
1
|
+
## NOW
|
|
2
|
+
Update the CI/CD workflow (`.github/workflows/ci-cd.yml`) to replace the `npm publish --dry-run` step with a real `npm publish --access public` invocation that runs automatically on every push to `main` when `secrets.NPM_TOKEN` is set.
|
|
3
3
|
|
|
4
|
-
## NEXT
|
|
5
|
-
-
|
|
6
|
-
-
|
|
7
|
-
-
|
|
4
|
+
## NEXT
|
|
5
|
+
- Remove the committed `lib/` build artifacts from version control (`git rm -r --cached lib/`) and add `lib/` to `.gitignore`.
|
|
6
|
+
- Refactor the CI job to build once, upload the compiled artifacts as a workflow artifact, and then download them in the publish step to ensure correct artifact tracking.
|
|
7
|
+
- Consolidate quality‐check and deploy steps into a single `quality-and-deploy` job that gates on `secrets.NPM_TOKEN` and publishes without manual approval.
|
|
8
8
|
|
|
9
|
-
## LATER
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
9
|
+
## LATER
|
|
10
|
+
- Introduce semantic-release (or a similar tool) to automate version bumps, changelog generation, Git tagging, and npm publication.
|
|
11
|
+
- Add a post-deployment health-check job that installs the just-published package and runs an end-to-end ESLint plugin smoke test.
|
|
12
|
+
- Periodically review and ratchet CI security and dependency audit thresholds to maintain a robust release pipeline.
|
|
Binary file
|
|
@@ -33,3 +33,7 @@ overall,functionality,code_quality,testing,execution,documentation,dependencies,
|
|
|
33
33
|
76.875,,93,92,95,85,100,95,55
|
|
34
34
|
89.6,,90,90,95,82,100,95,75
|
|
35
35
|
91,,93,87,95,85,100,95,85
|
|
36
|
+
78.25,,70,85,95,85,100,98,93
|
|
37
|
+
89.6,,95,92,95,90,100,95,60
|
|
38
|
+
72.5,,80,95,95,55,100,95,60
|
|
39
|
+
75.25,,85,95,85,92,95,95,55
|
package/.voder/progress-log.csv
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.0.3] - 2025-11-17
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- CLI integration script (`cli-integration.js`) for end-to-end ESLint CLI tests.
|
|
9
|
+
- Migration guide in `user-docs/migration-guide.md`.
|
|
10
|
+
|
|
11
|
+
## [1.0.2] - 2025-11-17
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
- Updated README and docs to reference `cli-integration.js` script.
|
|
15
|
+
- Removed stale references to migration guide in CHANGELOG gradients.
|
|
16
|
+
|
|
5
17
|
## [1.0.1] - 2025-11-17
|
|
6
18
|
|
|
7
19
|
### Added
|
package/README.md
CHANGED
|
@@ -127,13 +127,13 @@ Coverage reports will be generated in the `coverage/` directory.
|
|
|
127
127
|
|
|
128
128
|
## CLI Integration
|
|
129
129
|
|
|
130
|
-
The `cli-integration.js` script runs end-to-end CLI integration tests for the plugin, verifying behavior when used via the ESLint CLI.
|
|
130
|
+
The `cli-integration.js` script runs end-to-end CLI integration tests for the plugin, verifying behavior when used via the ESLint CLI. Note: this script lives at the project root.
|
|
131
131
|
|
|
132
132
|
Usage:
|
|
133
133
|
|
|
134
134
|
```bash
|
|
135
135
|
# Run the CLI integration tests
|
|
136
|
-
node cli-integration.js
|
|
136
|
+
node ./cli-integration.js
|
|
137
137
|
```
|
|
138
138
|
|
|
139
139
|
This script executes tests that:
|
package/cli-integration.js
CHANGED
|
@@ -1,56 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
/* eslint-env node */
|
|
3
2
|
/**
|
|
4
|
-
* CLI integration tests for ESLint Traceability Plugin
|
|
3
|
+
* CLI integration tests script for ESLint Traceability Plugin
|
|
5
4
|
* @story docs/stories/001.0-DEV-PLUGIN-SETUP.story.md
|
|
6
5
|
* @req REQ-PLUGIN-STRUCTURE - Validate plugin registers via CLI
|
|
7
6
|
*/
|
|
8
7
|
const { spawnSync } = require("child_process");
|
|
9
8
|
const path = require("path");
|
|
10
|
-
const configPath = path.resolve(__dirname, "eslint.config.js");
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*/
|
|
17
|
-
function runEslint(code, rule) {
|
|
18
|
-
const eslintPkgDir = path.dirname(require.resolve("eslint/package.json"));
|
|
19
|
-
const eslintCliPath = path.join(eslintPkgDir, "bin", "eslint.js");
|
|
20
|
-
const args = [
|
|
21
|
-
"--no-config-lookup",
|
|
22
|
-
"--config",
|
|
23
|
-
configPath,
|
|
24
|
-
"--stdin",
|
|
25
|
-
"--stdin-filename",
|
|
26
|
-
"foo.js",
|
|
27
|
-
"--rule",
|
|
28
|
-
"no-unused-vars:off",
|
|
29
|
-
"--rule",
|
|
30
|
-
"no-constant-condition:off",
|
|
31
|
-
"--rule",
|
|
32
|
-
"no-empty:off",
|
|
33
|
-
"--rule",
|
|
34
|
-
"traceability/require-story-annotation:off",
|
|
35
|
-
"--rule",
|
|
36
|
-
"traceability/require-req-annotation:off",
|
|
37
|
-
"--rule",
|
|
38
|
-
"traceability/require-branch-annotation:off",
|
|
39
|
-
"--rule",
|
|
40
|
-
"traceability/valid-annotation-format:off",
|
|
41
|
-
"--rule",
|
|
42
|
-
"traceability/valid-story-reference:off",
|
|
43
|
-
"--rule",
|
|
44
|
-
"traceability/valid-req-reference:off",
|
|
45
|
-
"--rule",
|
|
46
|
-
rule,
|
|
47
|
-
];
|
|
48
|
-
return spawnSync(process.execPath, [eslintCliPath, ...args], {
|
|
49
|
-
encoding: "utf-8",
|
|
50
|
-
input: code,
|
|
51
|
-
});
|
|
52
|
-
}
|
|
10
|
+
// Resolve the ESLint CLI binary and configuration path
|
|
11
|
+
const eslintPkgDir = path.dirname(require.resolve("eslint/package.json"));
|
|
12
|
+
const eslintCliPath = path.join(eslintPkgDir, "bin", "eslint.js");
|
|
13
|
+
const configPath = path.resolve(__dirname, "eslint.config.js");
|
|
53
14
|
|
|
15
|
+
// Define CLI integration test scenarios
|
|
54
16
|
const tests = [
|
|
55
17
|
{
|
|
56
18
|
name: "reports error when @story annotation is missing",
|
|
@@ -60,98 +22,82 @@ const tests = [
|
|
|
60
22
|
},
|
|
61
23
|
{
|
|
62
24
|
name: "does not report error when @story annotation is present",
|
|
63
|
-
code:
|
|
64
|
-
/**
|
|
25
|
+
code: `/**
|
|
65
26
|
* @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
66
27
|
*/
|
|
67
|
-
function foo() {}
|
|
68
|
-
`,
|
|
28
|
+
function foo() {}`,
|
|
69
29
|
rule: "traceability/require-story-annotation:error",
|
|
70
30
|
expectedStatus: 0,
|
|
71
31
|
},
|
|
72
|
-
{
|
|
73
|
-
name: "reports error when requirement reference is missing",
|
|
74
|
-
code: `/**\n * @story docs/stories/001.0-DEV-PLUGIN-SETUP.story.md\n * @req REQ-NON-EXISTENT\n */\nfunction foo() {}`,
|
|
75
|
-
rule: "traceability/valid-req-reference:error",
|
|
76
|
-
expectedStatus: 1,
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
name: "reports error when requirement reference uses path traversal",
|
|
80
|
-
code: `/**\n * @story ../docs/stories/001.0-DEV-PLUGIN-SETUP.story.md\n * @req REQ-PLUGIN-STRUCTURE\n */\nfunction foo() {}`,
|
|
81
|
-
rule: "traceability/valid-req-reference:error",
|
|
82
|
-
expectedStatus: 1,
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: "reports error when requirement reference uses absolute path",
|
|
86
|
-
code: `/**\n * @story /absolute/docs/stories/001.0-DEV-PLUGIN-SETUP.story.md\n * @req REQ-PLUGIN-STRUCTURE\n */\nfunction foo() {}`,
|
|
87
|
-
rule: "traceability/valid-req-reference:error",
|
|
88
|
-
expectedStatus: 1,
|
|
89
|
-
},
|
|
90
32
|
{
|
|
91
33
|
name: "reports error when @req annotation is missing",
|
|
92
|
-
code:
|
|
93
|
-
* @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
94
|
-
*/\nfunction foo() {}`,
|
|
34
|
+
code: "function bar() {}",
|
|
95
35
|
rule: "traceability/require-req-annotation:error",
|
|
96
36
|
expectedStatus: 1,
|
|
97
37
|
},
|
|
98
38
|
{
|
|
99
|
-
name: "
|
|
39
|
+
name: "reports error when @story annotation uses path traversal and @req annotation uses path traversal",
|
|
100
40
|
code: `/**
|
|
101
|
-
* @story docs/stories/
|
|
102
|
-
* @req REQ-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
name: "reports error for missing branch annotations",
|
|
109
|
-
code: `if (true) {}`,
|
|
110
|
-
rule: "traceability/require-branch-annotation:error",
|
|
111
|
-
expectedStatus: 1,
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
name: "does not report error for branch with annotations",
|
|
115
|
-
code: `// @story docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md\n// @req REQ-BRANCH-DETECTION\nif (true) {}`,
|
|
116
|
-
rule: "traceability/require-branch-annotation:error",
|
|
117
|
-
expectedStatus: 0,
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
name: "reports invalid annotation format",
|
|
121
|
-
code: `/**\n * @story invalid/path.txt\n * @req INVALID\n */\nfunction foo() {}`,
|
|
122
|
-
rule: "traceability/valid-annotation-format:error",
|
|
41
|
+
* @story ../docs/stories/invalid.story.md
|
|
42
|
+
* @req ../docs/requirements/REQ-INVALID.md
|
|
43
|
+
*/
|
|
44
|
+
function bar() {}`,
|
|
45
|
+
rule: "traceability/valid-req-reference:error",
|
|
123
46
|
expectedStatus: 1,
|
|
124
47
|
},
|
|
125
48
|
{
|
|
126
|
-
name: "
|
|
127
|
-
code:
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
code: `/**\n * @story docs/stories/nonexistent.story.md\n */\nfunction foo() {}`,
|
|
134
|
-
rule: "traceability/valid-story-reference:error",
|
|
49
|
+
name: "reports error when @story annotation uses absolute path and @req annotation uses absolute path",
|
|
50
|
+
code: `/**
|
|
51
|
+
* @story /absolute/path/to/story.story.md
|
|
52
|
+
* @req /etc/passwd
|
|
53
|
+
*/
|
|
54
|
+
function baz() {}`,
|
|
55
|
+
rule: "traceability/valid-req-reference:error",
|
|
135
56
|
expectedStatus: 1,
|
|
136
57
|
},
|
|
137
|
-
{
|
|
138
|
-
name: "existing story file reference passes",
|
|
139
|
-
code: `/**\n * @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md\n */\nfunction foo() {}`,
|
|
140
|
-
rule: "traceability/valid-story-reference:error",
|
|
141
|
-
expectedStatus: 0,
|
|
142
|
-
},
|
|
143
58
|
];
|
|
144
59
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Run ESLint CLI with given code and rule override
|
|
62
|
+
* @param {string} code Source code to lint via stdin
|
|
63
|
+
* @param {string} rule ESLint rule override e.g. "traceability/require-story-annotation:error"
|
|
64
|
+
* @returns {object} Result of spawnSync call
|
|
65
|
+
*/
|
|
66
|
+
function runEslint(code, rule) {
|
|
67
|
+
const args = [
|
|
68
|
+
"--no-config-lookup",
|
|
69
|
+
"--config",
|
|
70
|
+
configPath,
|
|
71
|
+
"--stdin",
|
|
72
|
+
"--stdin-filename",
|
|
73
|
+
"foo.js",
|
|
74
|
+
"--rule",
|
|
75
|
+
"no-unused-vars:off",
|
|
76
|
+
"--rule",
|
|
77
|
+
rule,
|
|
78
|
+
];
|
|
79
|
+
return spawnSync(process.execPath, [eslintCliPath, ...args], {
|
|
80
|
+
encoding: "utf-8",
|
|
81
|
+
input: code,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Execute tests and report results
|
|
86
|
+
let failures = 0;
|
|
87
|
+
tests.forEach((test) => {
|
|
88
|
+
const result = runEslint(test.code, test.rule);
|
|
89
|
+
const passed = result.status === test.expectedStatus;
|
|
90
|
+
if (passed) {
|
|
91
|
+
console.log(`✓ ${test.name}`);
|
|
92
|
+
} else {
|
|
93
|
+
console.error(`✗ ${test.name}`);
|
|
149
94
|
console.error(
|
|
150
|
-
`
|
|
95
|
+
` Expected exit code ${test.expectedStatus}, got ${result.status}`,
|
|
151
96
|
);
|
|
152
|
-
console.error(
|
|
153
|
-
|
|
97
|
+
if (result.stdout) console.error(` stdout: ${result.stdout}`);
|
|
98
|
+
if (result.stderr) console.error(` stderr: ${result.stderr}`);
|
|
99
|
+
failures++;
|
|
154
100
|
}
|
|
155
101
|
});
|
|
156
102
|
|
|
157
|
-
process.exit(
|
|
103
|
+
process.exit(failures > 0 ? 1 : 0);
|
package/docs/cli-integration.md
CHANGED
|
@@ -39,59 +39,84 @@ Currently, version bumping requires manual intervention through direct package.j
|
|
|
39
39
|
|
|
40
40
|
## Decision Outcome
|
|
41
41
|
|
|
42
|
-
Chosen option: "
|
|
42
|
+
Chosen option: "Version Increment Without Git Commits", because it eliminates CI/CD loop complexity, requires no git write permissions, solves the immediate npm publish failures, and provides the simplest implementation while maintaining full automation.
|
|
43
43
|
|
|
44
44
|
### Implementation Strategy
|
|
45
45
|
|
|
46
|
-
The CI/CD pipeline will
|
|
46
|
+
The CI/CD pipeline will use in-memory version increments without git write-back:
|
|
47
47
|
|
|
48
|
-
1. **Pre-publish Version Check**: Before attempting to publish, check if the current package.json version already exists on npm
|
|
49
|
-
2. **
|
|
50
|
-
3. **
|
|
51
|
-
4. **
|
|
52
|
-
5. **
|
|
48
|
+
1. **Pre-publish Version Check**: Before attempting to publish, check if the current package.json version already exists on npm using `npm view eslint-plugin-traceability@<version>`
|
|
49
|
+
2. **In-Memory Version Increment**: If the version exists on npm, increment the patch version in the pipeline workspace using `npm version patch --no-git-tag-version`
|
|
50
|
+
3. **Immediate Publish**: Proceed with npm publish using the incremented version without any git operations
|
|
51
|
+
4. **Pipeline Logging**: Log the version increment action for visibility and debugging
|
|
52
|
+
5. **No Git Write-Back**: The incremented version exists only in the pipeline workspace and is never committed back to the repository
|
|
53
|
+
|
|
54
|
+
### Primary Approach Considered
|
|
55
|
+
|
|
56
|
+
**Git Write-Back with Version Commits**: Increment version in pipeline, publish to npm, then commit version changes and create git tags with `[skip ci]` to prevent recursion. This approach was rejected due to complexity concerns including git write permissions, infinite loop prevention, post-publish failure handling, and potential race conditions in concurrent pipeline runs.
|
|
53
57
|
|
|
54
58
|
### Consequences
|
|
55
59
|
|
|
56
60
|
- Good, because prevents all npm publish failures due to version conflicts
|
|
57
|
-
- Good, because maintains automated delivery without manual intervention
|
|
58
|
-
- Good, because
|
|
61
|
+
- Good, because maintains fully automated delivery without any manual intervention
|
|
62
|
+
- Good, because eliminates infinite CI/CD loop risks entirely
|
|
63
|
+
- Good, because requires no git write permissions or credentials in CI/CD
|
|
59
64
|
- Good, because uses standard npm tooling that developers understand
|
|
60
|
-
- Good, because
|
|
61
|
-
- Good, because
|
|
62
|
-
-
|
|
63
|
-
- Neutral, because
|
|
65
|
+
- Good, because simplest possible implementation with minimal failure modes
|
|
66
|
+
- Good, because each pipeline run is completely independent
|
|
67
|
+
- Good, because immediate resolution to publish failures with no complexity overhead
|
|
68
|
+
- Neutral, because package.json version may lag behind published npm version
|
|
69
|
+
- Neutral, because developers can check published version via `npm view eslint-plugin-traceability version`
|
|
64
70
|
- Bad, because does not automatically determine semantic version type (major/minor/patch)
|
|
65
|
-
- Bad, because
|
|
71
|
+
- Bad, because no automatic git tags or version history created
|
|
66
72
|
|
|
67
73
|
### Confirmation
|
|
68
74
|
|
|
69
75
|
Implementation compliance will be confirmed through:
|
|
70
76
|
|
|
71
77
|
- CI/CD pipeline successfully publishes without version conflicts
|
|
72
|
-
-
|
|
73
|
-
-
|
|
78
|
+
- No npm publish failures due to existing version numbers
|
|
79
|
+
- No git write operations or credentials required in CI/CD
|
|
80
|
+
- No infinite pipeline loops or `[skip ci]` complexity needed
|
|
81
|
+
- Pipeline logs clearly show when version increments occur
|
|
82
|
+
- Published npm versions can be verified via `npm view eslint-plugin-traceability versions`
|
|
74
83
|
- No manual intervention required for routine publishing
|
|
75
|
-
- Version bumps traceable through git commit history
|
|
76
|
-
- package.json version always synchronized with published npm version
|
|
77
84
|
|
|
78
85
|
## Pros and Cons of the Options
|
|
79
86
|
|
|
80
|
-
###
|
|
87
|
+
### Version Increment Without Git Commits
|
|
88
|
+
|
|
89
|
+
In-memory version increments during pipeline execution without any git write-back operations.
|
|
90
|
+
|
|
91
|
+
- Good, because eliminates all CI/CD loop complexity and infinite recursion risks
|
|
92
|
+
- Good, because requires no git write permissions or credentials in CI/CD environment
|
|
93
|
+
- Good, because simplest possible implementation with minimal failure modes
|
|
94
|
+
- Good, because each pipeline run is completely independent with no race conditions
|
|
95
|
+
- Good, because immediate resolution to npm publish failures
|
|
96
|
+
- Good, because uses standard npm version tooling familiar to developers
|
|
97
|
+
- Good, because no complex error handling for git operations required
|
|
98
|
+
- Neutral, because package.json version may not reflect latest published version
|
|
99
|
+
- Neutral, because published version always discoverable via npm registry
|
|
100
|
+
- Bad, because no automatic git tags created for release tracking
|
|
101
|
+
- Bad, because requires manual version management for major/minor releases
|
|
102
|
+
- Bad, because no automated version commit history
|
|
103
|
+
|
|
104
|
+
### Git Write-Back with Version Commits
|
|
81
105
|
|
|
82
|
-
|
|
106
|
+
Increment version in pipeline, publish to npm, then commit version changes and create git tags.
|
|
83
107
|
|
|
84
|
-
- Good, because uses native npm version management tools
|
|
85
108
|
- Good, because creates proper git tags and version commits automatically
|
|
86
|
-
- Good, because
|
|
87
|
-
- Good, because
|
|
88
|
-
- Good, because
|
|
89
|
-
- Good, because
|
|
90
|
-
- Good, because maintains compatibility with npm ecosystem tools
|
|
109
|
+
- Good, because maintains package.json synchronization with published versions
|
|
110
|
+
- Good, because provides complete version history in git repository
|
|
111
|
+
- Good, because allows for automated CHANGELOG.md updates
|
|
112
|
+
- Good, because follows traditional npm ecosystem patterns
|
|
91
113
|
- Neutral, because requires configuration of git credentials in CI/CD
|
|
92
|
-
- Neutral, because creates automated commits
|
|
93
|
-
- Bad, because
|
|
94
|
-
- Bad, because
|
|
114
|
+
- Neutral, because creates automated commits with CI skip directives
|
|
115
|
+
- Bad, because requires complex infinite loop prevention with `[skip ci]`
|
|
116
|
+
- Bad, because potential for git write failures after successful npm publish
|
|
117
|
+
- Bad, because introduces race conditions in concurrent pipeline runs
|
|
118
|
+
- Bad, because requires git write permissions and credential management
|
|
119
|
+
- Bad, because adds multiple failure modes beyond the core publish operation
|
|
95
120
|
|
|
96
121
|
### Semantic Release with automated version detection
|
|
97
122
|
|
|
@@ -124,42 +149,46 @@ Requiring manual version increments before publishing with workflow validation.
|
|
|
124
149
|
- Bad, because does not solve the original npm publish failure problem
|
|
125
150
|
- Bad, because creates friction in development workflow
|
|
126
151
|
|
|
127
|
-
|
|
152
|
+
## More Information
|
|
128
153
|
|
|
129
|
-
|
|
154
|
+
This decision addresses the immediate CI/CD publish failures with the simplest possible solution that eliminates complexity while maintaining full automation. The in-memory version increment approach provides immediate relief from npm publish conflicts without introducing git write-back complexity.
|
|
130
155
|
|
|
131
|
-
|
|
132
|
-
- Good, because can leverage GitHub-specific features like releases
|
|
133
|
-
- Good, because may provide better integration with pull request workflows
|
|
134
|
-
- Good, because uses familiar GitHub Actions patterns
|
|
135
|
-
- Neutral, because similar capabilities to npm version approach
|
|
136
|
-
- Bad, because locks solution to GitHub Actions platform specifically
|
|
137
|
-
- Bad, because may require additional GitHub Actions marketplace dependencies
|
|
138
|
-
- Bad, because potentially less portable to other CI/CD systems
|
|
139
|
-
- Bad, because npm version command is more universally understood
|
|
156
|
+
Key implementation details:
|
|
140
157
|
|
|
141
|
-
|
|
158
|
+
```yaml
|
|
159
|
+
- name: Prepare version for publish
|
|
160
|
+
run: |
|
|
161
|
+
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
|
162
|
+
echo "Current package.json version: $CURRENT_VERSION"
|
|
142
163
|
|
|
143
|
-
|
|
164
|
+
# Check if this version exists on npm
|
|
165
|
+
if npm view eslint-plugin-traceability@$CURRENT_VERSION version >/dev/null 2>&1; then
|
|
166
|
+
echo "Version $CURRENT_VERSION already exists on npm, incrementing..."
|
|
167
|
+
npm version patch --no-git-tag-version
|
|
168
|
+
NEW_VERSION=$(node -p "require('./package.json').version")
|
|
169
|
+
echo "Bumped version to: $NEW_VERSION"
|
|
170
|
+
else
|
|
171
|
+
echo "Version $CURRENT_VERSION is available, proceeding with publish"
|
|
172
|
+
fi
|
|
144
173
|
|
|
145
|
-
|
|
174
|
+
- name: Publish package
|
|
175
|
+
run: npm publish --access public
|
|
176
|
+
```
|
|
146
177
|
|
|
147
|
-
|
|
148
|
-
- Set up git user configuration for automated commits
|
|
149
|
-
- Ensure version tags follow consistent naming convention (v1.0.0 format)
|
|
150
|
-
- Update CHANGELOG.md generation to work with automated version increments
|
|
151
|
-
- Consider branch protection rules that allow CI/CD version commits
|
|
152
|
-
- Document manual override process for major/minor version bumps
|
|
178
|
+
Implementation considerations:
|
|
153
179
|
|
|
154
|
-
|
|
180
|
+
- No git credentials or write permissions required in CI/CD
|
|
181
|
+
- Version increments are logged for visibility and debugging
|
|
182
|
+
- Each pipeline run operates independently with no side effects
|
|
183
|
+
- Published versions remain discoverable via `npm view eslint-plugin-traceability versions`
|
|
184
|
+
- Manual version bumps for major/minor releases can still be done via git commits
|
|
185
|
+
- Future migration to git write-back approach remains possible if needed
|
|
155
186
|
|
|
156
|
-
|
|
157
|
-
- Commit message standardization becomes feasible
|
|
158
|
-
- Publishing frequency increases significantly requiring more sophisticated automation
|
|
159
|
-
- The simple patch increment approach becomes insufficient for change communication
|
|
187
|
+
This decision should be re-evaluated if:
|
|
160
188
|
|
|
161
|
-
|
|
189
|
+
- Package.json/npm version drift becomes problematic for development workflow
|
|
190
|
+
- Automatic git tagging becomes a requirement for release management
|
|
191
|
+
- The team adopts semantic versioning discipline requiring commit message analysis
|
|
192
|
+
- Integration with automated changelog generation becomes necessary
|
|
162
193
|
|
|
163
|
-
|
|
164
|
-
- [GitHub Actions CI/CD Best Practices](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments)
|
|
165
|
-
- [Semantic Versioning Specification](https://semver.org/)
|
|
194
|
+
The simplicity of this approach allows for easy migration to more complex solutions later while solving the immediate problem with minimal risk and complexity.
|