File tree Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change 9
9
10
10
## Quick Start
11
11
12
- Generate changelog in markdown format and update (or create) ` CHANGELOG.md ` :
12
+ Generate changelog in markdown format and show in console :
13
13
14
14
``` sh
15
15
npx changelogen@latest
16
16
```
17
17
18
+ Generate changelog, bump version in ` package.json ` automatically and update ` CHANGELOG.md ` (without commit)
19
+
20
+ ``` sh
21
+ npx changelogen@latest --bump
22
+ ```
23
+
24
+ Bump version, update ` CHANGELOG.md ` and make a git commit and tag:
25
+
26
+ ``` sh
27
+ npx changelogen@latest --release
28
+ ```
29
+
18
30
## CLI Usage
19
31
20
32
``` sh
Original file line number Diff line number Diff line change @@ -34,8 +34,14 @@ async function main () {
34
34
// Generate markdown
35
35
const markdown = generateMarkDown ( commits , config )
36
36
37
- // Update changelog file
38
- if ( config . output ) {
37
+ // Show changelog in CLI unless bumping or releasing
38
+ const displayOnly = ! args . bump && ! args . release
39
+ if ( displayOnly ) {
40
+ consola . log ( '\n\n' + markdown + '\n\n' )
41
+ }
42
+
43
+ // Update changelog file (only when bumping or releasing or when --output is specified as a file)
44
+ if ( config . output && ( args . output || ! displayOnly ) ) {
39
45
let changelogMD : string
40
46
if ( existsSync ( config . output ) ) {
41
47
consola . info ( `Updating ${ config . output } ` )
@@ -57,8 +63,6 @@ async function main () {
57
63
}
58
64
59
65
await fsp . writeFile ( config . output , changelogMD )
60
- } else {
61
- consola . log ( '\n\n' + markdown + '\n\n' )
62
66
}
63
67
64
68
// Bump version optionally
You can’t perform that action at this time.
0 commit comments