|
1 | 1 | ![logo] |
2 | 2 |
|
3 | | -# Cider (CI for Dart. Efficient Release) |
| 3 | +# Cider (CI for Dart: Efficient Release) |
4 | 4 |
|
5 | | -A command-line utility to automate package maintenance. Manipulates the changelog and pubspec.yaml. |
| 5 | +Cider is a CLI tool for Dart package maintenance. It updates `CHANGELOG.md` and `pubspec.yaml` to help automate releases. |
6 | 6 |
|
7 | | -This tool assumes that the changelog: |
| 7 | +## Assumptions |
8 | 8 |
|
9 | | -- is called `CHANGELOG.md` |
10 | | -- is sitting in the project root folder |
11 | | -- strictly follows the [Changelog] format |
12 | | -- uses basic markdown (no HTML and complex formatting supported) |
| 9 | +Cider expects: |
13 | 10 |
|
14 | | -It also assumes that your project follows [Semantic Versioning v2.0.0](https://semver.org/spec/v2.0.0.html). |
| 11 | +- a `CHANGELOG.md` file in the project root |
| 12 | +- changelog format compatible with [Keep a Changelog][Changelog] |
| 13 | +- simple Markdown in changelog entries (no HTML or complex formatting) |
| 14 | +- project versions that follow [Semantic Versioning 2.0.0][semver] |
15 | 15 |
|
16 | | -## Install |
| 16 | +## Installation |
17 | 17 |
|
18 | | -``` |
19 | | -pub global activate cider |
| 18 | +```bash |
| 19 | +dart pub global activate cider |
20 | 20 | ``` |
21 | 21 |
|
22 | | -## Configure |
| 22 | +## Configuration |
23 | 23 |
|
24 | | -Cider configuration is stored in `pubspec.yaml` under the key `cider`: |
| 24 | +Configure Cider in `pubspec.yaml` under `cider`: |
25 | 25 |
|
26 | 26 | ```yaml |
27 | 27 | cider: |
28 | 28 | link_template: |
29 | | - tag: https://github.com/example/project/releases/tag/%tag% # initial release link template |
30 | | - diff: https://github.com/example/project/compare/%from%...%to% # subsequent releases link template |
| 29 | + tag: https://github.com/example/project/releases/tag/%tag% |
| 30 | + diff: https://github.com/example/project/compare/%from%...%to% |
| 31 | + version: v%version% # default: %version% |
31 | 32 | ``` |
32 | 33 |
|
33 | | -The `%from%`, `%to%`, and `%tag%` placeholders will be replaced with the corresponding version tags. |
| 34 | +Placeholders: |
34 | 35 |
|
35 | | -### Project root |
| 36 | +- `%from%` - previous version tag |
| 37 | +- `%to%` - current version tag |
| 38 | +- `%tag%` - release tag |
36 | 39 |
|
37 | | -Cider may be run from the project root or from any directory within. |
38 | | -In the latter case, it will try to detect the project root automatically |
39 | | -by going up the filesystem tree until it finds a directory containing `pubspec.yaml`. |
| 40 | +## Project root detection |
40 | 41 |
|
41 | | -You can override this behavior by passing the `--project-root` argument: |
| 42 | +You can run Cider from any subdirectory. It searches upward for `pubspec.yaml`. |
42 | 43 |
|
43 | | -``` |
44 | | -cider --project-root=/path/to/my/project version |
45 | | -``` |
| 44 | +To override auto-detection: |
46 | 45 |
|
47 | | -## Changelog |
| 46 | +```bash |
| 47 | +cider --project-root=/path/to/project version |
| 48 | +``` |
48 | 49 |
|
49 | | -These commands manipulate `CHANGELOG.md`. |
| 50 | +## Changelog commands |
50 | 51 |
|
51 | | -### Adding changes |
| 52 | +These commands modify `CHANGELOG.md` unless stated otherwise. |
52 | 53 |
|
53 | | -Adds a new line to the `Unreleased` section of the changelog |
| 54 | +### Add an entry |
54 | 55 |
|
55 | | -``` |
| 56 | +```bash |
56 | 57 | cider log <type> <description> |
57 | 58 | ``` |
58 | 59 |
|
59 | | -- **type** is one of: `added`, `changed`, `deprecated`, `removed`, `fixed`, `security` |
60 | | -- **description** is a markdown text line |
| 60 | +- `<type>`: `added`, `changed`, `deprecated`, `removed`, `fixed`, `security` |
| 61 | +- `<description>`: one Markdown line |
61 | 62 |
|
62 | 63 | Examples: |
63 | 64 |
|
64 | | -``` |
65 | | -cider log changed 'New turbo V6 engine installed' |
66 | | -cider log added 'Support for rocket fuel and kerosene' |
67 | | -cider log fixed 'Wheels falling off sporadically' |
| 65 | +```bash |
| 66 | +cider log changed 'Improve parser performance' |
| 67 | +cider log added 'Support workspace mode' |
| 68 | +cider log fixed 'Null pointer in changelog parser' |
68 | 69 | ``` |
69 | 70 |
|
70 | | -### Releasing the unreleased changes |
| 71 | +### Release `Unreleased` entries |
71 | 72 |
|
72 | | -Takes all changes from the `Unreleased` section on the changelog and creates a new release under the current version in |
73 | | -pubspec.yaml |
74 | | -
|
75 | | -``` |
| 73 | +```bash |
76 | 74 | cider release [options] |
77 | 75 | ``` |
78 | 76 |
|
79 | 77 | Options: |
80 | 78 |
|
81 | | -- `--date` to provide the release date (the default is today). |
| 79 | +- `--date` - release date (default: today) |
82 | 80 |
|
83 | | -Cider will automatically generate the diff links in the changelog if the diff link template is found in the config. |
| 81 | +If `link_template.diff` is configured, Cider generates changelog diff links automatically. |
84 | 82 |
|
85 | | -### Printing the list of changes in the given version |
| 83 | +### Print changes for a version (read-only) |
86 | 84 |
|
87 | | -Prints the corresponding section from `CHANGELOG.md` in markdown format. This command is read-only. |
88 | | -
|
89 | | -``` |
| 85 | +```bash |
90 | 86 | cider describe [<version>] [options] |
91 | 87 | ``` |
92 | 88 |
|
93 | | -- **version** is an existing version from the changelog. If not specified, the `Unreleased` section will |
94 | | - be used. |
| 89 | +- `<version>` defaults to `Unreleased` if omitted |
95 | 90 |
|
96 | 91 | Options: |
97 | 92 |
|
98 | | -- `--only-body` will skip the header and the link part of the changelog section. |
| 93 | +- `--only-body` - omit section header and link footer |
99 | 94 |
|
100 | | -### Listing all versions in the changelog |
| 95 | +### List versions |
101 | 96 |
|
102 | | -Prints all versions from the changelog, highest to lowest. |
103 | | -
|
104 | | -``` |
| 97 | +```bash |
105 | 98 | cider list [options] |
106 | 99 | ``` |
107 | 100 |
|
108 | 101 | Options: |
109 | 102 |
|
110 | | -- `--include-yanked` or `-y` - includes yanked versions. |
111 | | -- `--include-unreleased` or `-u` - prints "Unreleased" in the top of the version list if there are unreleased changes. |
| 103 | +- `--include-yanked`, `-y` |
| 104 | +- `--include-unreleased`, `-u` |
112 | 105 |
|
113 | | -## Version |
| 106 | +## Version commands |
114 | 107 |
|
115 | | -These commands affect the `version` line in `pubspec.yaml`. If applied successfully, Cider will print the resulting |
116 | | -version. |
| 108 | +These commands operate on `version` in `pubspec.yaml`. |
117 | 109 |
|
118 | | -### Printing the current project version |
| 110 | +### Print current version (read-only) |
119 | 111 |
|
120 | | -Prints the current version from `pubspec.yaml`. This command is read-only. |
121 | | -
|
122 | | -``` |
| 112 | +```bash |
123 | 113 | cider version |
124 | 114 | ``` |
125 | 115 |
|
126 | | -### Setting version to an arbitrary value |
| 116 | +### Set version |
127 | 117 |
|
128 | | -Sets the version in `pubspec.yaml` to the one provided. The new version must be [semver]-compatible. |
129 | | -
|
130 | | -``` |
| 118 | +```bash |
131 | 119 | cider version <new_version> |
132 | 120 | ``` |
133 | 121 |
|
134 | | -- **new_version** new value, must be [semver]-compatible |
| 122 | +`<new_version>` must be [SemVer][semver]-compatible. |
135 | 123 |
|
136 | 124 | Examples: |
137 | 125 |
|
138 | | -| Version before | Command | Version after | |
139 | | -|----------------|--------------------------------|----------------| |
140 | | -| 1.2.3+1 | `cider version 3.2.1` | 3.2.1 | |
141 | | -| 0.2.1-dev | `cider version 0.0.1-alpha+42` | 0.0.1-alpha+42 | |
| 126 | +| Before | Command | After | |
| 127 | +|----------|-----------------------------------|----------------| |
| 128 | +| 1.2.3+1 | `cider version 3.2.1` | 3.2.1 | |
| 129 | +| 0.2.1-dev| `cider version 0.0.1-alpha+42` | 0.0.1-alpha+42 | |
142 | 130 |
|
143 | | -### Yanking/unyanking a version |
| 131 | +### Yank / unyank a release in changelog |
144 | 132 |
|
145 | | -The [Changelog] defines yanked releases as version that are pulled (withdrawn) due to a serious bug or security issue. |
146 | | -According to the [Changelog], a yanked release should be marked with a `[YANKED]` tag in the changelog file. |
147 | | -
|
148 | | -To mark a version as yanked, run the following command: |
149 | | -
|
150 | | -``` |
| 133 | +```bash |
151 | 134 | cider yank <version> |
152 | | -``` |
153 | | -
|
154 | | -To unyank a version, run the following command: |
155 | | -
|
156 | | -``` |
157 | 135 | cider unyank <version> |
158 | 136 | ``` |
159 | 137 |
|
160 | | -### Bumping the project version |
| 138 | +Yanked versions are marked as `[YANKED]` in `CHANGELOG.md`. |
161 | 139 |
|
162 | | -Bumps the corresponding part of the project version according to [semver]. |
| 140 | +### Bump version |
163 | 141 |
|
164 | | -``` |
| 142 | +```bash |
165 | 143 | cider bump <part> [options] |
166 | 144 | ``` |
167 | 145 |
|
168 | | -- **part** can be any of the following: |
169 | | - - `breaking` (means `y` for `0.y.z` and `x` for `x.y.z`) |
170 | | - - `major` |
171 | | - - `minor` |
172 | | - - `patch` |
173 | | - - `build` |
174 | | - - `pre` (pre-release) |
175 | | - - `release` (promotes the version to a release, removing the pre-release part) |
| 146 | +`<part>` can be: |
| 147 | + |
| 148 | +- `breaking` (`y` for `0.y.z`, otherwise `x` for `x.y.z`) |
| 149 | +- `major` |
| 150 | +- `minor` |
| 151 | +- `patch` |
| 152 | +- `build` |
| 153 | +- `pre` (pre-release) |
| 154 | +- `release` (remove pre-release suffix) |
176 | 155 |
|
177 | 156 | Options: |
178 | 157 |
|
179 | | -- `--keep-build` will retain the existing build part. |
180 | | -- `--bump-build` will increment the build part (see below). |
181 | | -- `--build=<value>` will set the build part to the given value. This is useful when build is a not a simple numeric |
182 | | - value, e.g. a timestamp. |
183 | | -- `--pre=<prefix>` sets the prerelease prefix. |
184 | | -
|
185 | | -When bumping the `prerelease` or `build` parts, Cider will look for the rightmost dot-separated identifier. If the |
186 | | -identifier is an integer, it will be incremented stripping the leading zeroes. Otherwise, Cider will append `.1` to the |
187 | | -corresponding part. |
188 | | -
|
189 | | -Remember that according to [semver] v2, `build` is considered metadata and is ignored when determining version |
190 | | -precedence. |
191 | | -
|
192 | | -| Version before | Command | Version after | |
193 | | -|----------------|---------------------------------------------|------------------| |
194 | | -| 1.2.1-alpha+42 | `cider bump breaking` | 2.0.0 | |
195 | | -| 0.2.1-alpha+42 | `cider bump breaking` | 0.3.0 | |
196 | | -| 0.2.1-alpha+42 | `cider bump major` | 1.0.0 | |
197 | | -| 0.2.1-alpha+42 | `cider bump minor` | 0.3.0 | |
198 | | -| 0.2.1-alpha+42 | `cider bump patch` | 0.2.1 | |
199 | | -| 0.2.1 | `cider bump patch` | 0.2.2 | |
200 | | -| 0.2.1-alpha+42 | `cider bump pre` | 0.2.1-alpha.1 | |
201 | | -| 1.2.1-alpha+42 | `cider bump breaking --keep-build` | 2.0.0+42 | |
202 | | -| 0.2.1-alpha+42 | `cider bump breaking --bump-build` | 0.3.0+43 | |
203 | | -| 0.2.1-alpha+42 | `cider bump major --build=2020-02-02` | 1.0.0+2020-02-02 | |
204 | | -| 0.2.1-alpha+42 | `cider bump minor --pre=alpha --bump-build` | 0.3.0-alpha+43 | |
205 | | -| 0.2.1-alpha+42 | `cider bump release` | 0.2.1 | |
206 | | -| 0.2.1-alpha+42 | `cider bump release --keep-build` | 0.2.1+42 | |
| 158 | +- `--keep-build` - keep existing build metadata |
| 159 | +- `--bump-build` - increment build metadata |
| 160 | +- `--build=<value>` - set build metadata explicitly |
| 161 | +- `--pre=<prefix>` - set pre-release prefix |
| 162 | + |
| 163 | +Notes: |
| 164 | + |
| 165 | +- For `pre` and `build`, Cider increments the rightmost dot-separated numeric identifier. |
| 166 | +- If no numeric identifier exists, Cider appends `.1`. |
| 167 | +- Per SemVer, build metadata does not affect version precedence. |
| 168 | + |
| 169 | +Examples: |
| 170 | + |
| 171 | +| Before | Command | After | |
| 172 | +|------------------|---------------------------------------------|------------------| |
| 173 | +| 1.2.1-alpha+42 | `cider bump breaking` | 2.0.0 | |
| 174 | +| 0.2.1-alpha+42 | `cider bump breaking` | 0.3.0 | |
| 175 | +| 0.2.1-alpha+42 | `cider bump major` | 1.0.0 | |
| 176 | +| 0.2.1-alpha+42 | `cider bump minor` | 0.3.0 | |
| 177 | +| 0.2.1-alpha+42 | `cider bump patch` | 0.2.1 | |
| 178 | +| 0.2.1 | `cider bump patch` | 0.2.2 | |
| 179 | +| 0.2.1-alpha+42 | `cider bump pre` | 0.2.1-alpha.1 | |
| 180 | +| 1.2.1-alpha+42 | `cider bump breaking --keep-build` | 2.0.0+42 | |
| 181 | +| 0.2.1-alpha+42 | `cider bump breaking --bump-build` | 0.3.0+43 | |
| 182 | +| 0.2.1-alpha+42 | `cider bump major --build=2020-02-02` | 1.0.0+2020-02-02 | |
| 183 | +| 0.2.1-alpha+42 | `cider bump minor --pre=alpha --bump-build` | 0.3.0-alpha+43 | |
| 184 | +| 0.2.1-alpha+42 | `cider bump release` | 0.2.1 | |
| 185 | +| 0.2.1-alpha+42 | `cider bump release --keep-build` | 0.2.1+42 | |
207 | 186 |
|
208 | 187 | ## Exit codes |
209 | 188 |
|
210 | | -| Code | Meaning | |
211 | | -|------|-------------------------------------------------------------------| |
212 | | -| 0 | Successful exit. | |
213 | | -| 64 | Usage error, e.g. invalid arguments. | |
214 | | -| 65 | Data error, e.g. missing or invalid project files. | |
215 | | -| 70 | Software error. If you see this, you might want to open an issue. | |
| 189 | +| Code | Meaning | |
| 190 | +|------|---------| |
| 191 | +| 0 | Success | |
| 192 | +| 64 | Usage error (invalid arguments) | |
| 193 | +| 65 | Data error (missing/invalid project files) | |
| 194 | +| 70 | Internal software error (consider opening an issue) | |
216 | 195 |
|
217 | 196 | [logo]: https://raw.githubusercontent.com/f3ath/cider/master/cider.png |
218 | | -
|
219 | 197 | [semver]: https://semver.org |
220 | | -
|
221 | | -[Changelog]: https://keepachangelog.com/en/1.1.0/ |
| 198 | +[Changelog]: https://keepachangelog.com/en/1.1.0/ |
0 commit comments