@programinglive/commiter 1.0.3 → 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/CHANGELOG.md +14 -0
- package/README.md +4 -0
- package/commitlint.config.cjs +4 -1
- package/index.js +18 -4
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.0.5](https://github.com/programinglive/commiter/compare/v1.0.4...v1.0.5) (2025-10-19)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### 🐛 Bug Fixes
|
|
9
|
+
|
|
10
|
+
* allow release commits with emoji ([26c4afa](https://github.com/programinglive/commiter/commit/26c4afa26fc7c11c91ac576dcba197cba5d3d98a))
|
|
11
|
+
|
|
12
|
+
### [1.0.4](https://github.com/programinglive/commiter/compare/v1.0.3...v1.0.4) (2025-10-19)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug Fixes
|
|
16
|
+
|
|
17
|
+
* ensure safe test default for initial release ([27d2ee3](https://github.com/programinglive/commiter/commit/27d2ee35d1e558ef459a61e41627305997621392))
|
|
18
|
+
|
|
5
19
|
### [1.0.3](https://github.com/programinglive/commiter/compare/v1.0.2...v1.0.3) (2025-10-19)
|
|
6
20
|
|
|
7
21
|
### [1.0.2](https://github.com/programinglive/commiter/compare/v1.0.1...v1.0.2) (2025-10-19)
|
package/README.md
CHANGED
|
@@ -150,6 +150,8 @@ type(scope): subject
|
|
|
150
150
|
|
|
151
151
|
Valid types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`
|
|
152
152
|
|
|
153
|
+
Release commits generated by `standard-version` such as `chore(release): 1.0.0 🚀` are automatically ignored by `commitlint`.
|
|
154
|
+
|
|
153
155
|
### First release
|
|
154
156
|
|
|
155
157
|
If this is your first release and you don't have a version tag yet:
|
|
@@ -158,6 +160,8 @@ If this is your first release and you don't have a version tag yet:
|
|
|
158
160
|
npm run release -- --first-release
|
|
159
161
|
```
|
|
160
162
|
|
|
163
|
+
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.
|
|
164
|
+
|
|
161
165
|
### Dry run
|
|
162
166
|
|
|
163
167
|
To see what would happen without making changes:
|
package/commitlint.config.cjs
CHANGED
package/index.js
CHANGED
|
@@ -11,6 +11,14 @@ const { execSync } = require('child_process');
|
|
|
11
11
|
const fs = require('fs');
|
|
12
12
|
const path = require('path');
|
|
13
13
|
|
|
14
|
+
function ensureSafeTestScript(scripts = {}) {
|
|
15
|
+
const defaultFailingTestScript = 'echo "Error: no test specified" && exit 1';
|
|
16
|
+
if (!scripts.test || scripts.test === defaultFailingTestScript) {
|
|
17
|
+
scripts.test = 'echo "No tests specified"';
|
|
18
|
+
}
|
|
19
|
+
return scripts;
|
|
20
|
+
}
|
|
21
|
+
|
|
14
22
|
function setupCommiter() {
|
|
15
23
|
console.log('🚀 Setting up Commiter...\n');
|
|
16
24
|
|
|
@@ -31,8 +39,8 @@ function setupCommiter() {
|
|
|
31
39
|
const packageJsonPath = path.join(process.cwd(), 'package.json');
|
|
32
40
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
33
41
|
|
|
42
|
+
packageJson.scripts = ensureSafeTestScript(packageJson.scripts || {});
|
|
34
43
|
// Add scripts
|
|
35
|
-
packageJson.scripts = packageJson.scripts || {};
|
|
36
44
|
packageJson.scripts.prepare = 'husky';
|
|
37
45
|
packageJson.scripts.release = 'standard-version';
|
|
38
46
|
packageJson.scripts['release:major'] = 'npm run release -- --release-as major';
|
|
@@ -64,8 +72,14 @@ function setupCommiter() {
|
|
|
64
72
|
const isEsmProject = packageJson.type === 'module';
|
|
65
73
|
const commitlintConfigFile = isEsmProject ? 'commitlint.config.js' : 'commitlint.config.cjs';
|
|
66
74
|
const commitlintConfigContent = isEsmProject
|
|
67
|
-
? `export default {
|
|
68
|
-
|
|
75
|
+
? `export default {
|
|
76
|
+
extends: ['@commitlint/config-conventional'],
|
|
77
|
+
ignores: [(message) => message.startsWith('chore(release):')]
|
|
78
|
+
}\n`
|
|
79
|
+
: `module.exports = {
|
|
80
|
+
extends: ['@commitlint/config-conventional'],
|
|
81
|
+
ignores: [(message) => message.startsWith('chore(release):')]
|
|
82
|
+
}\n`;
|
|
69
83
|
|
|
70
84
|
const legacyCommitlintConfigFile = isEsmProject ? 'commitlint.config.cjs' : 'commitlint.config.js';
|
|
71
85
|
if (fs.existsSync(legacyCommitlintConfigFile)) {
|
|
@@ -112,4 +126,4 @@ if (require.main === module) {
|
|
|
112
126
|
setupCommiter();
|
|
113
127
|
}
|
|
114
128
|
|
|
115
|
-
module.exports = { setupCommiter };
|
|
129
|
+
module.exports = { setupCommiter, ensureSafeTestScript };
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@programinglive/commiter",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Commit convention tooling for standard-version releases with beautiful changelogs",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"commiter": "./index.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"test": "
|
|
10
|
+
"test": "node test/ensureSafeTestScript.test.js",
|
|
11
11
|
"prepare": "husky",
|
|
12
12
|
"release": "standard-version",
|
|
13
13
|
"release:major": "npm run release -- --release-as major",
|