Skip to content

Commit a8e8d39

Browse files
Merge pull request #55 from conventional-changelog/master
[pull] master from conventional-changelog:master
2 parents 20556a5 + 76e148e commit a8e8d39

File tree

18 files changed

+569
-418
lines changed

18 files changed

+569
-418
lines changed

.github/workflows/CI.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ jobs:
6363
- name: Install dependencies
6464
run: |
6565
apt update --yes
66-
apt upgrade --yes
6766
6867
# NOTE: do not change the below with an `actions/setup-node` step! or it
6968
# would make this CI job entirely pointless
@@ -72,6 +71,9 @@ jobs:
7271
npm install --global yarn
7372
yarn install
7473
74+
- name: Print versions
75+
run: node --version && npm --version && yarn --version
76+
7577
- name: Build
7678
run: yarn build
7779

@alias/commitlint-config-nx-scopes/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [19.3.1](https://github.com/conventional-changelog/commitlint/compare/v19.3.0...v19.3.1) (2024-05-13)
7+
8+
**Note:** Version bump only for package commitlint-config-nx-scopes
9+
10+
11+
12+
13+
614
# [19.3.0](https://github.com/conventional-changelog/commitlint/compare/v19.2.2...v19.3.0) (2024-04-23)
715

816
**Note:** Version bump only for package commitlint-config-nx-scopes

@alias/commitlint-config-nx-scopes/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "commitlint-config-nx-scopes",
33
"type": "module",
4-
"version": "19.3.0",
4+
"version": "19.3.1",
55
"description": "Shareable commitlint config enforcing nx project names as scopes",
66
"files": [
77
"index.js"
@@ -31,7 +31,7 @@
3131
"node": ">=v18"
3232
},
3333
"dependencies": {
34-
"@commitlint/config-nx-scopes": "^19.3.0"
34+
"@commitlint/config-nx-scopes": "^19.3.1"
3535
},
3636
"devDependencies": {
3737
"@commitlint/utils": "^19.0.0"

@commitlint/config-nx-scopes/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [19.3.1](https://github.com/conventional-changelog/commitlint/compare/v19.3.0...v19.3.1) (2024-05-13)
7+
8+
**Note:** Version bump only for package @commitlint/config-nx-scopes
9+
10+
11+
12+
13+
614
# [19.3.0](https://github.com/conventional-changelog/commitlint/compare/v19.2.2...v19.3.0) (2024-04-23)
715

816
**Note:** Version bump only for package @commitlint/config-nx-scopes

@commitlint/config-nx-scopes/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@commitlint/config-nx-scopes",
33
"type": "module",
4-
"version": "19.3.0",
4+
"version": "19.3.1",
55
"description": "Shareable commitlint config enforcing nx project names as scopes",
66
"main": "index.js",
77
"files": [
@@ -29,7 +29,7 @@
2929
},
3030
"homepage": "https://commitlint.js.org/",
3131
"peerDependencies": {
32-
"nx": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0"
32+
"nx": ">=14.0.0"
3333
},
3434
"peerDependenciesMeta": {
3535
"nx": {

@commitlint/prompt-cli/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [19.3.1](https://github.com/conventional-changelog/commitlint/compare/v19.3.0...v19.3.1) (2024-05-13)
7+
8+
**Note:** Version bump only for package @commitlint/prompt-cli
9+
10+
11+
12+
13+
614
# [19.3.0](https://github.com/conventional-changelog/commitlint/compare/v19.2.2...v19.3.0) (2024-04-23)
715

816
**Note:** Version bump only for package @commitlint/prompt-cli

@commitlint/prompt-cli/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@commitlint/prompt-cli",
33
"type": "module",
4-
"version": "19.3.0",
4+
"version": "19.3.1",
55
"description": "commit prompt using commitlint.config.js",
66
"main": "cli.js",
77
"files": [
@@ -38,7 +38,7 @@
3838
"@commitlint/utils": "^19.0.0"
3939
},
4040
"dependencies": {
41-
"@commitlint/prompt": "^19.3.0",
41+
"@commitlint/prompt": "^19.3.1",
4242
"execa": "^8.0.1",
4343
"inquirer": "^9.2.15"
4444
},

@commitlint/prompt/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [19.3.1](https://github.com/conventional-changelog/commitlint/compare/v19.3.0...v19.3.1) (2024-05-13)
7+
8+
9+
### Bug Fixes
10+
11+
* **prompt:** prompt does not respect [body-leading-blank] setting ([#4066](https://github.com/conventional-changelog/commitlint/issues/4066)) ([3f1f44d](https://github.com/conventional-changelog/commitlint/commit/3f1f44d9cbb93438d01cfd79f9b71659411e126d))
12+
13+
14+
15+
16+
617
# [19.3.0](https://github.com/conventional-changelog/commitlint/compare/v19.2.2...v19.3.0) (2024-04-23)
718

819
**Note:** Version bump only for package @commitlint/prompt

@commitlint/prompt/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@commitlint/prompt",
33
"type": "module",
4-
"version": "19.3.0",
4+
"version": "19.3.1",
55
"description": "commitizen prompt using commitlint.config.js",
66
"main": "./lib/index.js",
77
"files": [

@commitlint/prompt/src/input.test.ts

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,46 @@
11
/// <reference path="./inquirer/inquirer.d.ts" />
22

3-
import {test, expect, vi} from 'vitest';
3+
import {expect, test, vi} from 'vitest';
44
// @ts-expect-error -- no typings
55
import config from '@commitlint/config-angular';
66
import chalk from 'chalk';
7-
import {Answers, DistinctQuestion, PromptModule} from 'inquirer';
7+
import {
8+
Answers,
9+
DistinctQuestion,
10+
InputCustomOptions,
11+
PromptModule,
12+
} from 'inquirer';
813

914
import {input} from './input.js';
1015

16+
const testConfig = {
17+
parserPreset: config.parserPreset,
18+
rules: {
19+
...config.rules,
20+
},
21+
};
22+
1123
vi.mock('@commitlint/load', () => ({
12-
default: () => config,
24+
default: () => testConfig,
1325
}));
1426

1527
test('should work with all fields filled', async () => {
28+
const prompt = stub({
29+
'input-custom': {
30+
type: 'fix',
31+
scope: 'test',
32+
subject: 'subject',
33+
body: 'body',
34+
footer: 'footer',
35+
},
36+
});
37+
const message = await input(prompt);
38+
expect(message).toEqual('fix(test): subject\n' + '\nbody\n' + '\nfooter');
39+
});
40+
41+
test('should not add leading blank line to body and footer if rules are disabled', async () => {
42+
testConfig.rules['body-leading-blank'] = ['1', 'never'];
43+
testConfig.rules['footer-leading-blank'] = ['1', 'never'];
1644
const prompt = stub({
1745
'input-custom': {
1846
type: 'fix',
@@ -24,6 +52,10 @@ test('should work with all fields filled', async () => {
2452
});
2553
const message = await input(prompt);
2654
expect(message).toEqual('fix(test): subject\n' + 'body\n' + 'footer');
55+
// reset config mock
56+
testConfig.rules['body-leading-blank'] = config.rules['body-leading-blank'];
57+
testConfig.rules['footer-leading-blank'] =
58+
config.rules['footer-leading-blank'];
2759
});
2860

2961
test('should work without scope', async () => {
@@ -37,7 +69,7 @@ test('should work without scope', async () => {
3769
},
3870
});
3971
const message = await input(prompt);
40-
expect(message).toEqual('fix: subject\n' + 'body\n' + 'footer');
72+
expect(message).toEqual('fix: subject\n' + '\nbody\n' + '\nfooter');
4173
});
4274

4375
test('should fail without type', async () => {
@@ -72,7 +104,7 @@ function stub(config: Record<string, Record<string, unknown>>): PromptModule {
72104
if (!questions) {
73105
throw new Error(`Unexpected config type: ${configType}`);
74106
}
75-
const answer = questions[promptConfig.name!];
107+
let answer = questions[promptConfig.name!];
76108
if (answer == null) {
77109
throw new Error(`Unexpected config name: ${promptConfig.name}`);
78110
}
@@ -83,7 +115,11 @@ function stub(config: Record<string, Record<string, unknown>>): PromptModule {
83115
throw new Error(validationResult || undefined);
84116
}
85117
}
86-
118+
const forceLeadingBlankFn = (promptConfig as InputCustomOptions)
119+
.forceLeadingBlankFn;
120+
if (forceLeadingBlankFn) {
121+
answer = forceLeadingBlankFn(answer as string);
122+
}
87123
result[promptConfig.name!] = answer;
88124
}
89125
return result;

@commitlint/prompt/src/inquirer/InputCustomPrompt.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ export default class InputCustomPrompt<
4646

4747
onEnd(state: SuccessfulPromptStateData): void {
4848
this.lineSubscription.unsubscribe();
49+
// Add or remove leading blank if rule is active.
50+
state.value = this.opt.forceLeadingBlankFn(state.value);
4951
super.onEnd(state);
5052
}
5153

@commitlint/prompt/src/inquirer/inquirer.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ declare module 'inquirer' {
1515
log?(answers?: T): string;
1616
tabCompletion?: InputCustomCompletionOption[];
1717
maxLength(answers?: T): number;
18+
forceLeadingBlankFn(input: string): string;
1819
}
1920

2021
interface QuestionMap<T extends Answers = Answers> {

@commitlint/prompt/src/library/get-prompt.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,5 +119,6 @@ export default function getPrompt(
119119
transformer(value: string) {
120120
return forceCaseFn(value);
121121
},
122+
forceLeadingBlankFn,
122123
};
123124
}

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,27 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [19.3.1](https://github.com/conventional-changelog/commitlint/compare/v19.3.0...v19.3.1) (2024-05-13)
7+
8+
9+
### Bug Fixes
10+
11+
* **prompt:** prompt does not respect [body-leading-blank] setting ([#4066](https://github.com/conventional-changelog/commitlint/issues/4066)) ([3f1f44d](https://github.com/conventional-changelog/commitlint/commit/3f1f44d9cbb93438d01cfd79f9b71659411e126d))
12+
* update dependency ajv to v8.13.0 ([#4057](https://github.com/conventional-changelog/commitlint/issues/4057)) ([4e5957f](https://github.com/conventional-changelog/commitlint/commit/4e5957fcb120fbf31c2bdc5c5affe35eb556d3dc))
13+
* update dependency import-meta-resolve to v4.1.0 ([#4055](https://github.com/conventional-changelog/commitlint/issues/4055)) ([6cd9d76](https://github.com/conventional-changelog/commitlint/commit/6cd9d76b4f7d867c6085a5f99eab9b6ad15ab789))
14+
* update dependency inquirer to v9.2.20 ([#4047](https://github.com/conventional-changelog/commitlint/issues/4047)) ([b2a75c8](https://github.com/conventional-changelog/commitlint/commit/b2a75c881b8fa69501d93c4d29118aeaf0c989cd))
15+
* update dependency semver to v7.6.2 ([#4080](https://github.com/conventional-changelog/commitlint/issues/4080)) ([de28f20](https://github.com/conventional-changelog/commitlint/commit/de28f209db4d8aba4eb6e57e9f1fc0517143398d))
16+
* update dependency tar-fs to v3.0.6 ([#4048](https://github.com/conventional-changelog/commitlint/issues/4048)) ([4003205](https://github.com/conventional-changelog/commitlint/commit/40032050570e4f5a8c8ab4f390cee7611a92935e))
17+
18+
19+
### Features
20+
21+
* **container:** add arm64 build ([#4049](https://github.com/conventional-changelog/commitlint/issues/4049)) ([28bed3f](https://github.com/conventional-changelog/commitlint/commit/28bed3f8453bf12062b938aa0247e24d56f183d6)), closes [#3926](https://github.com/conventional-changelog/commitlint/issues/3926)
22+
23+
24+
25+
26+
627
# [19.3.0](https://github.com/conventional-changelog/commitlint/compare/v19.2.2...v19.3.0) (2024-04-23)
728

829

docs/api/lint.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ lint(message: string, rules: {[ruleName: string]: Rule}, opts?: Options) => Prom
4545
### Import
4646

4747
```js
48-
import lint '@commitlint/lint';
48+
import lint from '@commitlint/lint';
4949
```
5050

5151
### Usage without config

docs/guides/local-setup.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ You can find complete setup instructions on the [official documentation](https:/
2020
> The following instructions are meant to `husky@v9` if you are using a different version
2121
> consult the official documentation of your version.
2222
23+
> [!WARNING]
24+
> For Windows users: ensure all `husky` files are `UTF-8` enconded. If any other format is used an error may be thrown at runtime such as [cannot execute binary file](https://github.com/typicode/husky/issues/1426).
25+
2326
---
2427

2528
:::tabs

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"lerna": "4",
33
"npmClient": "yarn",
44
"useWorkspaces": true,
5-
"version": "19.3.0"
5+
"version": "19.3.1"
66
}

0 commit comments

Comments
 (0)