Skip to content

Commit 4e4a2b8

Browse files
authored
refactor: reduce commitlint_* packages into commitlint_cli (#2)
1 parent b321127 commit 4e4a2b8

File tree

102 files changed

+181
-2957
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+181
-2957
lines changed

.github/workflows/ci.yml

+6-17
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,14 @@ jobs:
2121

2222
- run: dart --version
2323

24-
- name: Install melos
25-
run: dart pub global activate melos 3.0.0-dev.0
24+
- name: Get Dependencies
25+
run: dart pub get
2626

27-
- name: Add pub cache bin to PATH
28-
run: echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
29-
30-
- name: Bootstrap
31-
run: melos bootstrap
27+
- name: Analyze
28+
run: dart analyze . --fatal-infos
3229

33-
# Uncomment this step to verify the use of 'dart format' on each commit.
3430
- name: Check Format
35-
run: melos format-check
36-
37-
# Consider passing '--fatal-infos' for slightly stricter analysis.
38-
- name: Analyze
39-
run: melos analyze
31+
run: dart format . --output=none --set-exit-if-changed
4032

41-
# Your project will need to have tests in test/ and a dependency on
42-
# package:test for this step to succeed. Note that Flutter projects will
43-
# want to change this to 'flutter test'.
4433
- name: Run tests
45-
run: melos test --no-select
34+
run: dart test --reporter expanded

.github/workflows/pr_title.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ jobs:
1212

1313
- name: Get Dependencies
1414
run: dart pub get
15+
1516
- name: Validate Title of PR
16-
run: echo ${{ github.event.pull_request.title }} | dart bin/commitlint.dart
17+
run: echo ${{ github.event.pull_request.title }} | dart bin/commitlint_cli.dart

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**/pubspec.lock
22
.idea/
33
*.iml
4-
pubspec_overrides.yaml
54
.dart_tool/
65
.DS_Store

.husky/commit-msg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env sh
22
. "$(dirname -- "$0")/_/husky.sh"
33

4-
dart bin/commitlint.dart --edit "$1"
4+
dart bin/commitlint_cli.dart --edit "$1" --config lib/commitlint.yaml

.husky/pre-commit

-6
This file was deleted.

.husky/pre-push

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
dart analyze . --fatal-infos
5+
dart format . --output=none --set-exit-if-changed
6+
dart test --reporter expanded

.pubignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
docs/
2+
scripts/
3+
test/
4+
commitlint.yaml

CHANGELOG.md

+11-156
Original file line numberDiff line numberDiff line change
@@ -1,173 +1,28 @@
1-
# Change Log
1+
## 0.3.0-dev.0
22

3-
All notable changes to this project will be documented in this file.
4-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
3+
> Note: This release has breaking changes.
54
6-
## 2023-02-24
5+
- **BREAKING** **REFACTOR**: Make all `commitlint_*` packages into one `commitlint_cli` package.
76

8-
### Changes
7+
## 0.2.1+1
98

10-
---
9+
- Update a dependency to the latest release.
1110

12-
Packages with breaking changes:
13-
14-
- There are no breaking changes in this release.
15-
16-
Packages with other changes:
17-
18-
- [`commitlint_config` - `v0.1.2`](#commitlint_config---v012)
19-
20-
---
21-
22-
#### `commitlint_config` - `v0.1.2`
23-
24-
- **FEAT**(config): add type-case and type-empty. ([8d035b02](https://github.com/hyiso/commitlint/commit/8d035b02f3190f501dc54b547cea31786b099abc))
25-
26-
27-
## 2023-01-22
28-
29-
### Changes
30-
31-
---
32-
33-
Packages with breaking changes:
34-
35-
- There are no breaking changes in this release.
36-
37-
Packages with other changes:
38-
39-
- [`commitlint_rules` - `v0.2.1`](#commitlint_rules---v021)
40-
- [`commitlint_lint` - `v0.2.0+1`](#commitlint_lint---v0201)
41-
- [`commitlint_cli` - `v0.2.1+1`](#commitlint_cli---v0211)
42-
43-
Packages with dependency updates only:
44-
45-
> Packages listed below depend on other packages in this workspace that have had changes. Their versions have been incremented to bump the minimum dependency versions of the packages they depend upon in this project.
46-
47-
- `commitlint_lint` - `v0.2.0+1`
48-
- `commitlint_cli` - `v0.2.1+1`
49-
50-
---
51-
52-
#### `commitlint_rules` - `v0.2.1`
53-
54-
- **FEAT**: add subject related rules. ([b0dc9bda](https://github.com/hyiso/commitlint/commit/b0dc9bdac45cf09e975588854e8394be0ffa988c))
55-
56-
57-
## 2023-01-20
58-
59-
### Changes
60-
61-
---
62-
63-
Packages with breaking changes:
64-
65-
- [`commitlint_lint` - `v0.2.0`](#commitlint_lint---v020)
66-
- [`commitlint_parse` - `v0.1.0`](#commitlint_parse---v010)
67-
- [`commitlint_rules` - `v0.2.0`](#commitlint_rules---v020)
68-
- [`commitlint_types` - `v0.2.0`](#commitlint_types---v020)
69-
70-
Packages with other changes:
71-
72-
- [`commitlint_cli` - `v0.2.1`](#commitlint_cli---v021)
73-
- [`commitlint_config` - `v0.1.1`](#commitlint_config---v011)
74-
- [`commitlint_format` - `v0.1.1`](#commitlint_format---v011)
75-
- [`commitlint_load` - `v0.1.1`](#commitlint_load---v011)
76-
- [`commitlint_read` - `v0.2.1`](#commitlint_read---v021)
77-
78-
---
79-
80-
#### `commitlint_lint` - `v0.2.0`
81-
82-
- **BREAKING** **FEAT**: change dependency from conventional_commit to commitlint_parse. ([eb39d61a](https://github.com/hyiso/commitlint/commit/eb39d61af540d67d6a249154ee6d5c1f8c1831b2))
83-
84-
#### `commitlint_parse` - `v0.1.0`
85-
86-
- **BREAKING** **FEAT**: add package commitlint_parse. ([7969732f](https://github.com/hyiso/commitlint/commit/7969732f2fda5b55fc604d995a57a83f029032e8))
87-
88-
#### `commitlint_rules` - `v0.2.0`
89-
90-
- **BREAKING** **FEAT**: change dependency from conventional_commit to commitlint_parse. ([66f40000](https://github.com/hyiso/commitlint/commit/66f40000c33749b5e9e8d5d01b47c643d878c8c9))
91-
92-
#### `commitlint_types` - `v0.2.0`
93-
94-
- **BREAKING** **FEAT**: change conventional_commit to internal commit. ([12af3b1a](https://github.com/hyiso/commitlint/commit/12af3b1acf7626fd0b9a2e1ebeeac9946951e51e))
95-
96-
#### `commitlint_cli` - `v0.2.1`
11+
## 0.2.1
9712

9813
- **FEAT**: add documentation link. ([305bb990](https://github.com/hyiso/commitlint/commit/305bb990f0e1f70e6f0ca7266231603a28c84820))
9914

100-
#### `commitlint_config` - `v0.1.1`
101-
102-
- **FEAT**: add documentation link. ([f95daef4](https://github.com/hyiso/commitlint/commit/f95daef42cf69e0d1b612e57d7ad18baa4bfef6d))
103-
104-
#### `commitlint_format` - `v0.1.1`
105-
106-
- **FEAT**: add documentation link. ([216a68ba](https://github.com/hyiso/commitlint/commit/216a68ba5e90c5afb8249c25cc8fc5f29690ed4c))
107-
108-
#### `commitlint_load` - `v0.1.1`
109-
110-
- **FEAT**: add documentation link. ([6f189096](https://github.com/hyiso/commitlint/commit/6f189096fb67cdc003761bfcc1e52c278c8fd4f0))
111-
112-
#### `commitlint_read` - `v0.2.1`
113-
114-
- **FEAT**: add documentation link. ([61a80b2e](https://github.com/hyiso/commitlint/commit/61a80b2e0d0bc89e9ee7061b06cd65c5edd8c390))
115-
116-
117-
## 2023-01-18
118-
119-
### Changes
120-
121-
---
122-
123-
Packages with breaking changes:
124-
125-
- [`commitlint_cli` - `v0.2.0`](#commitlint_cli---v020)
126-
- [`commitlint_read` - `v0.2.0`](#commitlint_read---v020)
15+
## 0.2.0
12716

128-
Packages with other changes:
129-
130-
- [`commitlint_load` - `v0.1.0+2`](#commitlint_load---v0102)
131-
132-
---
133-
134-
#### `commitlint_cli` - `v0.2.0`
17+
> Note: This release has breaking changes.
13518
13619
- **FEAT**: change cli to CommandRunner. ([f8b640ab](https://github.com/hyiso/commitlint/commit/f8b640ab1b337ed27ae4b37808d4fea74869c709))
13720
- **BREAKING** **FEAT**: change --edit preceded to --from and --to. ([fb9a6a8d](https://github.com/hyiso/commitlint/commit/fb9a6a8d33b87d8ee3784642e284a68b6cc90dea))
13821

139-
#### `commitlint_read` - `v0.2.0`
140-
141-
- **BREAKING** **FEAT**: change --edit preceded to --from and --to. ([221f789b](https://github.com/hyiso/commitlint/commit/221f789baac439080f76c7aa9d97b46bb616cddc))
142-
- **BREAKING** **CHORE**: add test. ([6b442533](https://github.com/hyiso/commitlint/commit/6b442533a305ad922a59705836d7d07187af9005))
143-
144-
#### `commitlint_load` - `v0.1.0+2`
145-
146-
- **FIX**: path-like include dir. ([67cb367f](https://github.com/hyiso/commitlint/commit/67cb367f00aefc9144b791ab07db4a75c876b7f0))
147-
148-
149-
## 2023-01-15
150-
151-
### Changes
152-
153-
---
154-
155-
Packages with breaking changes:
156-
157-
- There are no breaking changes in this release.
158-
159-
Packages with other changes:
160-
161-
- [`commitlint_cli` - `v0.1.0+1`](#commitlint_cli---v0101)
162-
- [`commitlint_load` - `v0.1.0+1`](#commitlint_load---v0101)
163-
164-
---
165-
166-
#### `commitlint_cli` - `v0.1.0+1`
22+
## 0.1.0+1
16723

16824
- **DOCS**: add usage documentation. ([23f70976](https://github.com/hyiso/commitlint/commit/23f70976f2bb87776a0951f6fb7ccb067f743c52))
16925

170-
#### `commitlint_load` - `v0.1.0+1`
171-
172-
- **FIX**: recusively load config bug. ([50f657ac](https://github.com/hyiso/commitlint/commit/50f657ac3fe694fed94879e4fef54be16127f538))
26+
## 0.1.0
17327

28+
- Initial version.

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2022 hyiso Limited
189+
Copyright 2022 Zhu Huiyuan Limited
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

README.md

+35-17
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,34 @@
1-
## commitlint
1+
# commitlint
2+
3+
[![Pub Version](https://img.shields.io/pub/v/commitlint_cli?color=blue)](https://pub.dev/packages/commitlint_cli)
4+
[![popularity](https://img.shields.io/pub/popularity/commitlint_cli?logo=dart)](https://pub.dev/packages/commitlint_cli/score)
5+
[![likes](https://img.shields.io/pub/likes/commitlint_cli?logo=dart)](https://pub.dev/packages/commitlint_cli/score)
6+
[![CI](https://github.com/hyiso/commitlint/actions/workflows/ci.yml/badge.svg)](https://github.com/hyiso/commitlint/actions/workflows/ci.yml)
27

38
> Dart version commitlint - A tool to lint commit messages. (Inspired by JavaScript [commitlint](https://github.com/conventional-changelog/commitlint))
9+
> Dart version commitlint cli (known in JavaScript comunity)
410
5-
## Getting started
11+
commitlint lint commit messages to satisfy [conventional commit format](https://www.conventionalcommits.org/)
612

713
commitlint helps your team adhere to a commit convention. By supporting pub-installed configurations it makes sharing of commit conventions easy.
814

15+
16+
## Getting started
17+
918
### Install
1019

20+
Add `commitlint_cli` to your `dev_dependencies` in pubspec.yaml
21+
1122
```bash
12-
# Install commitlint cli and upstream configure if needed
13-
dart pub add --dev commitlint_cli commitlint_config
23+
# Install commitlint_cli
24+
dart pub add --dev commitlint_cli
1425
```
1526

1627
### Configuration
1728

1829
```bash
1930
# Configure commitlint to use conventional config
20-
echo "include: package:commitlint_config/commitlint.yaml" > commitlint.yaml
31+
echo "include: package:commitlint_cli/commitlint.yaml" > commitlint.yaml
2132
```
2233

2334
### Test
@@ -35,21 +46,28 @@ echo 'foo: bar' | dart run commitlint_cli
3546
# Lint last commit from history
3647
commitlint --from=HEAD~1
3748
```
49+
## Setup git hook
3850

39-
?> To get the most out of `commitlint` you'll want to automate it in your project lifecycle. See our [Setup guide](https://hyiso.github.io/commitlint/#/guides-setup) for next steps.
51+
With [husky](https://pub.dev/packages/husky) (a tool for managing git hooks), commitlint cli can be used as commmit-msg git hook
4052

41-
## Packages
53+
and [husky](https://pub.dev/packages/husky)
54+
### Set `commit-msg` hook:
55+
56+
```sh
57+
dart pub add --dev husky
58+
dart run husky install
59+
dart run husky set .husky/commit-msg 'dart run commitlint_cli --edit "$1"'
60+
```
61+
62+
### Make a commit:
63+
64+
```sh
65+
git add .
66+
git commit -m "Keep calm and commit"
67+
# `dart run commitlint_cli --edit "$1"` will run
68+
```
4269

43-
| Project | Status | Description |
44-
| --------------------- | ------------------------------------------------------------ | ----------------------------------------------------------------- |
45-
| [commitlint_cli](./packages/commitlint_cli/) | [![Pub Version](https://img.shields.io/pub/v/commitlint_cli?color=blue)](https://pub.dev/packages/commitlint_cli) | commitlint command-line tool entry |
46-
| [commitlint_config](./packages/commitlint_config/) | [![Pub Version](https://img.shields.io/pub/v/commitlint_config?color=blue)](https://pub.dev/packages/commitlint_config) | commitlint rules configuration, can be included. |
47-
| [commitlint_format](./packages/commitlint_format/) | [![Pub Version](https://img.shields.io/pub/v/commitlint_format?color=blue)](https://pub.dev/packages/commitlint_format) | commitlint output formatting package. |
48-
| [commitlint_lint](./packages/commitlint_lint/) | [![Pub Version](https://img.shields.io/pub/v/commitlint_lint?color=blue)](https://pub.dev/packages/commitlint_lint) | commitlint linting package |
49-
| [commitlint_load](./packages/commitlint_parse/) | [![Pub Version](https://img.shields.io/pub/v/commitlint_load?color=blue)](https://pub.dev/packages/commitlint_load) | load configured rules for commitlint |
50-
| [commitlint_read](./packages/commitlint_read/) | [![Pub Version](https://img.shields.io/pub/v/commitlint_read?color=blue)](https://pub.dev/packages/commitlint_read) | read commit message for commitlint. |
51-
| [commitlint_rules](./packages/commitlint_rules/) | [![Pub Version](https://img.shields.io/pub/v/commitlint_rules?color=blue)](https://pub.dev/packages/commitlint_rules) | rules set of commitlint. |
52-
| [commitlint_types](./packages/commitlint_types/) | [![Pub Version](https://img.shields.io/pub/v/commitlint_types?color=blue)](https://pub.dev/packages/commitlint_types) | types package for commitlint. |
70+
> To get the most out of `commitlint` you'll want to automate it in your project lifecycle. See our [Setup guide](https://hyiso.github.io/commitlint/#/guides-setup) for next steps.
5371
5472
## Documentation
5573

File renamed without changes.

bin/commitlint.dart

-14
This file was deleted.

commitlint.yaml

+3-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
1-
include: ./packages/commitlint_config/lib/commitlint.yaml
1+
include: ./lib/commitlint.yaml
22

33
rules:
44
scope-enum:
55
- 2
66
- always
7-
- - cli
8-
- config
9-
- format
10-
- lint
11-
- load
12-
- read
13-
- release
14-
- rules
15-
- types
7+
- - deps
8+
- release

0 commit comments

Comments
 (0)