Skip to content

Commit fb9a6a8

Browse files
committed
feat(cli)!: change --edit preceded to --from and --to
1 parent e3485b1 commit fb9a6a8

5 files changed

Lines changed: 10 additions & 17 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ jobs:
4141
# Your project will need to have tests in test/ and a dependency on
4242
# package:test for this step to succeed. Note that Flutter projects will
4343
# want to change this to 'flutter test'.
44-
# - name: Run tests
45-
# run: melos test --no-select
44+
- name: Run tests
45+
run: melos test --no-select

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
melos analyze
55
melos format-check
6-
# melos test --no-select
6+
melos test --no-select

melos.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ scripts:
4444
exec: dart format . --output=none --set-exit-if-changed
4545
description: Run `dart format` checks for all packages.
4646

47-
version: dart scripts/generate_version.dart && git add packages/commitlit_cli/lib/src/version.g.dart
47+
version: dart scripts/generate_version.dart && git add packages/commitlint_cli/lib/src/version.g.dart
4848
bootstrap: dart pub get && dart run husky install

packages/commitlint_cli/lib/src/runner.dart

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ class CommitLintRunner extends CommandRunner {
1919
help: 'read last commit message from the specified file.')
2020
..addOption('from',
2121
help:
22-
'lower end of the commit range to lint. This is preceded to --edit')
22+
'lower end of the commit range to lint. This is succeeded to --edit')
2323
..addOption('to',
2424
help:
25-
'upper end of the commit range to lint. This is preceded to --edit')
25+
'upper end of the commit range to lint. This is succeeded to --edit')
2626
..addFlag('version',
2727
negatable: false, help: 'display version information');
2828
}
@@ -46,11 +46,9 @@ class CommitLintRunner extends CommandRunner {
4646
final to = topLevelResults['to'] as String?;
4747
final edit = topLevelResults['edit'] as String?;
4848
bool fromStdin = from == null && to == null && edit == null;
49-
final messages = fromStdin
50-
? await _stdin()
51-
: await read(from: from, to: to, edit: edit ?? '.git/COMMIT_EDITMSG');
52-
final rules = await load(LoadOptions(
53-
cwd: Directory.current.path, file: topLevelResults['config']));
49+
final messages =
50+
fromStdin ? await _stdin() : await read(from: from, to: to, edit: edit);
51+
final rules = await load(file: topLevelResults['config']);
5452
final results = (await Future.wait(
5553
messages.map((message) async => await lint(message, rules))));
5654
if (rules.isEmpty) {

pubspec.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ name: commitlint_monorepo
22
publish_to: none
33

44
environment:
5-
sdk: '>=2.12.0 <3.0.0'
5+
sdk: '>=2.18.0 <3.0.0'
66

77
dev_dependencies:
8-
args: ^2.3.1
98
commitlint_cli: ^0.1.0
109
commitlint_config: ^0.1.0
1110
commitlint_format: ^0.1.0
@@ -35,7 +34,3 @@ dependency_overrides:
3534
path: ./packages/commitlint_rules
3635
commitlint_types:
3736
path: ./packages/commitlint_types
38-
39-
# This allows us to use commitlint on itself during development.
40-
executables:
41-
commitlint:

0 commit comments

Comments
 (0)