@hugojosefson/cli 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/README.md +1 -1
  2. package/esm/deno.js +16 -8
  3. package/esm/hj.js +19 -0
  4. package/esm/node_modules/@conventional-changelog/template/LICENSE.md +21 -0
  5. package/esm/node_modules/@conventional-changelog/template/README.md +66 -0
  6. package/esm/node_modules/@conventional-changelog/template/dist/elements.d.ts +78 -0
  7. package/esm/node_modules/@conventional-changelog/template/dist/elements.d.ts.map +1 -0
  8. package/esm/node_modules/@conventional-changelog/template/dist/elements.js +132 -0
  9. package/esm/node_modules/@conventional-changelog/template/dist/index.d.ts +6 -0
  10. package/esm/node_modules/@conventional-changelog/template/dist/index.d.ts.map +1 -0
  11. package/esm/node_modules/@conventional-changelog/template/dist/index.js +5 -0
  12. package/esm/node_modules/@conventional-changelog/template/dist/legacy.d.ts +20 -0
  13. package/esm/node_modules/@conventional-changelog/template/dist/legacy.d.ts.map +1 -0
  14. package/esm/node_modules/@conventional-changelog/template/dist/legacy.js +22 -0
  15. package/esm/node_modules/@conventional-changelog/template/dist/references.d.ts +43 -0
  16. package/esm/node_modules/@conventional-changelog/template/dist/references.d.ts.map +1 -0
  17. package/esm/node_modules/@conventional-changelog/template/dist/references.js +82 -0
  18. package/esm/node_modules/@conventional-changelog/template/dist/templates.d.ts +74 -0
  19. package/esm/node_modules/@conventional-changelog/template/dist/templates.d.ts.map +1 -0
  20. package/esm/node_modules/@conventional-changelog/template/dist/templates.js +125 -0
  21. package/esm/node_modules/@conventional-changelog/template/dist/types/commit.d.ts +37 -0
  22. package/esm/node_modules/@conventional-changelog/template/dist/types/commit.d.ts.map +1 -0
  23. package/esm/node_modules/@conventional-changelog/template/dist/types/commit.js +2 -0
  24. package/esm/node_modules/@conventional-changelog/template/dist/types/context.d.ts +113 -0
  25. package/esm/node_modules/@conventional-changelog/template/dist/types/context.d.ts.map +1 -0
  26. package/esm/node_modules/@conventional-changelog/template/dist/types/context.js +2 -0
  27. package/esm/node_modules/@conventional-changelog/template/dist/types/index.d.ts +4 -0
  28. package/esm/node_modules/@conventional-changelog/template/dist/types/index.d.ts.map +1 -0
  29. package/esm/node_modules/@conventional-changelog/template/dist/types/index.js +2 -0
  30. package/esm/node_modules/@conventional-changelog/template/dist/types/utils.d.ts +2 -0
  31. package/esm/node_modules/@conventional-changelog/template/dist/types/utils.d.ts.map +1 -0
  32. package/esm/node_modules/@conventional-changelog/template/dist/types/utils.js +2 -0
  33. package/esm/node_modules/@conventional-changelog/template/package.json +38 -0
  34. package/esm/node_modules/@simple-libs/stream-utils/LICENSE +21 -0
  35. package/esm/node_modules/@simple-libs/stream-utils/README.md +79 -0
  36. package/esm/node_modules/@simple-libs/stream-utils/dist/index.d.ts +51 -0
  37. package/esm/node_modules/@simple-libs/stream-utils/dist/index.d.ts.map +1 -0
  38. package/esm/node_modules/@simple-libs/stream-utils/dist/index.js +116 -0
  39. package/esm/node_modules/@simple-libs/stream-utils/package.json +38 -0
  40. package/esm/node_modules/argue-cli/LICENSE +21 -0
  41. package/esm/node_modules/argue-cli/README.md +239 -0
  42. package/esm/node_modules/argue-cli/dist/args.d.ts +30 -0
  43. package/esm/node_modules/argue-cli/dist/args.d.ts.map +1 -0
  44. package/esm/node_modules/argue-cli/dist/argv.d.ts +14 -0
  45. package/esm/node_modules/argue-cli/dist/argv.d.ts.map +1 -0
  46. package/esm/node_modules/argue-cli/dist/core.d.ts +24 -0
  47. package/esm/node_modules/argue-cli/dist/core.d.ts.map +1 -0
  48. package/esm/node_modules/argue-cli/dist/index.d.ts +6 -0
  49. package/esm/node_modules/argue-cli/dist/index.d.ts.map +1 -0
  50. package/esm/node_modules/argue-cli/dist/index.js +254 -0
  51. package/esm/node_modules/argue-cli/dist/index.js.map +1 -0
  52. package/esm/node_modules/argue-cli/dist/options.d.ts +9 -0
  53. package/esm/node_modules/argue-cli/dist/options.d.ts.map +1 -0
  54. package/esm/node_modules/argue-cli/dist/types.d.ts +16 -0
  55. package/esm/node_modules/argue-cli/dist/types.d.ts.map +1 -0
  56. package/esm/node_modules/argue-cli/dist/utils.d.ts +24 -0
  57. package/esm/node_modules/argue-cli/dist/utils.d.ts.map +1 -0
  58. package/esm/node_modules/argue-cli/package.json +34 -0
  59. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-changelog-writer/LICENSE.md +21 -0
  60. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-changelog-writer/README.md +369 -0
  61. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-changelog-writer/package.json +53 -0
  62. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-filter/LICENSE +21 -0
  63. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-filter/README.md +184 -0
  64. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-filter/package.json +31 -0
  65. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-parser/LICENSE.md +21 -0
  66. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-parser/README.md +383 -0
  67. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-parser/package.json +47 -0
  68. package/esm/node_modules/conventional-changelog-writer/README.md +49 -342
  69. package/esm/node_modules/conventional-changelog-writer/dist/cli/index.d.ts +3 -0
  70. package/esm/node_modules/conventional-changelog-writer/dist/cli/index.d.ts.map +1 -0
  71. package/esm/node_modules/conventional-changelog-writer/dist/cli/index.js +68 -0
  72. package/esm/node_modules/conventional-changelog-writer/dist/cli/utils.d.ts +4 -0
  73. package/esm/node_modules/conventional-changelog-writer/dist/cli/utils.d.ts.map +1 -0
  74. package/esm/node_modules/conventional-changelog-writer/dist/cli/utils.js +39 -0
  75. package/esm/node_modules/conventional-changelog-writer/dist/commit.d.ts +10 -0
  76. package/esm/node_modules/conventional-changelog-writer/dist/commit.d.ts.map +1 -0
  77. package/esm/node_modules/conventional-changelog-writer/dist/commit.js +43 -0
  78. package/esm/node_modules/conventional-changelog-writer/dist/context.d.ts +27 -0
  79. package/esm/node_modules/conventional-changelog-writer/dist/context.d.ts.map +1 -0
  80. package/esm/node_modules/conventional-changelog-writer/dist/context.js +134 -0
  81. package/esm/node_modules/conventional-changelog-writer/dist/index.d.ts +7 -0
  82. package/esm/node_modules/conventional-changelog-writer/dist/index.d.ts.map +1 -0
  83. package/esm/node_modules/conventional-changelog-writer/dist/index.js +6 -0
  84. package/esm/node_modules/conventional-changelog-writer/dist/options.d.ts +25 -0
  85. package/esm/node_modules/conventional-changelog-writer/dist/options.d.ts.map +1 -0
  86. package/esm/node_modules/conventional-changelog-writer/dist/options.js +79 -0
  87. package/esm/node_modules/conventional-changelog-writer/dist/template.d.ts +10 -0
  88. package/esm/node_modules/conventional-changelog-writer/dist/template.d.ts.map +1 -0
  89. package/esm/node_modules/conventional-changelog-writer/dist/template.js +18 -0
  90. package/esm/node_modules/conventional-changelog-writer/dist/types/index.d.ts +8 -0
  91. package/esm/node_modules/conventional-changelog-writer/dist/types/index.d.ts.map +1 -0
  92. package/esm/node_modules/conventional-changelog-writer/dist/types/index.js +2 -0
  93. package/esm/node_modules/conventional-changelog-writer/dist/types/options.d.ts +122 -0
  94. package/esm/node_modules/conventional-changelog-writer/dist/types/options.d.ts.map +1 -0
  95. package/esm/node_modules/conventional-changelog-writer/dist/types/options.js +2 -0
  96. package/esm/node_modules/conventional-changelog-writer/dist/types/utils.d.ts +9 -0
  97. package/esm/node_modules/conventional-changelog-writer/dist/types/utils.d.ts.map +1 -0
  98. package/esm/node_modules/conventional-changelog-writer/dist/types/utils.js +2 -0
  99. package/esm/node_modules/conventional-changelog-writer/dist/utils.d.ts +20 -0
  100. package/esm/node_modules/conventional-changelog-writer/dist/utils.d.ts.map +1 -0
  101. package/esm/node_modules/conventional-changelog-writer/dist/utils.js +70 -0
  102. package/esm/node_modules/conventional-changelog-writer/dist/writers.d.ts +29 -0
  103. package/esm/node_modules/conventional-changelog-writer/dist/writers.d.ts.map +1 -0
  104. package/esm/node_modules/conventional-changelog-writer/dist/writers.js +94 -0
  105. package/esm/node_modules/conventional-changelog-writer/package.json +24 -26
  106. package/esm/node_modules/conventional-commits-filter/README.md +51 -170
  107. package/esm/node_modules/conventional-commits-filter/dist/RevertedCommitsFilter.d.ts +17 -0
  108. package/esm/node_modules/conventional-commits-filter/dist/RevertedCommitsFilter.d.ts.map +1 -0
  109. package/esm/node_modules/conventional-commits-filter/dist/RevertedCommitsFilter.js +46 -0
  110. package/esm/node_modules/conventional-commits-filter/dist/filters.d.ts +19 -0
  111. package/esm/node_modules/conventional-commits-filter/dist/filters.d.ts.map +1 -0
  112. package/esm/node_modules/conventional-commits-filter/dist/filters.js +34 -0
  113. package/esm/node_modules/conventional-commits-filter/dist/index.d.ts +4 -0
  114. package/esm/node_modules/conventional-commits-filter/dist/index.d.ts.map +1 -0
  115. package/esm/node_modules/conventional-commits-filter/dist/index.js +3 -0
  116. package/esm/node_modules/conventional-commits-filter/dist/types.d.ts +6 -0
  117. package/esm/node_modules/conventional-commits-filter/dist/types.d.ts.map +1 -0
  118. package/esm/node_modules/conventional-commits-filter/dist/types.js +2 -0
  119. package/esm/node_modules/conventional-commits-filter/dist/utils.d.ts +16 -0
  120. package/esm/node_modules/conventional-commits-filter/dist/utils.d.ts.map +1 -0
  121. package/esm/node_modules/conventional-commits-filter/dist/utils.js +43 -0
  122. package/esm/node_modules/conventional-commits-filter/package.json +22 -16
  123. package/esm/node_modules/conventional-commits-parser/README.md +49 -353
  124. package/esm/node_modules/conventional-commits-parser/dist/CommitParser.d.ts +40 -0
  125. package/esm/node_modules/conventional-commits-parser/dist/CommitParser.d.ts.map +1 -0
  126. package/esm/node_modules/conventional-commits-parser/dist/CommitParser.js +319 -0
  127. package/esm/node_modules/conventional-commits-parser/dist/cli/index.d.ts +3 -0
  128. package/esm/node_modules/conventional-commits-parser/dist/cli/index.d.ts.map +1 -0
  129. package/esm/node_modules/conventional-commits-parser/dist/cli/index.js +67 -0
  130. package/esm/node_modules/conventional-commits-parser/dist/cli/options.d.ts +3 -0
  131. package/esm/node_modules/conventional-commits-parser/dist/cli/options.d.ts.map +1 -0
  132. package/esm/node_modules/conventional-commits-parser/dist/cli/options.js +40 -0
  133. package/esm/node_modules/conventional-commits-parser/dist/cli/utils.d.ts +5 -0
  134. package/esm/node_modules/conventional-commits-parser/dist/cli/utils.d.ts.map +1 -0
  135. package/esm/node_modules/conventional-commits-parser/dist/cli/utils.js +49 -0
  136. package/esm/node_modules/conventional-commits-parser/dist/index.d.ts +4 -0
  137. package/esm/node_modules/conventional-commits-parser/dist/index.d.ts.map +1 -0
  138. package/esm/node_modules/conventional-commits-parser/dist/index.js +3 -0
  139. package/esm/node_modules/conventional-commits-parser/dist/options.d.ts +3 -0
  140. package/esm/node_modules/conventional-commits-parser/dist/options.d.ts.map +1 -0
  141. package/esm/node_modules/conventional-commits-parser/dist/options.js +27 -0
  142. package/esm/node_modules/conventional-commits-parser/dist/regex.d.ts +8 -0
  143. package/esm/node_modules/conventional-commits-parser/dist/regex.d.ts.map +1 -0
  144. package/esm/node_modules/conventional-commits-parser/dist/regex.js +63 -0
  145. package/esm/node_modules/conventional-commits-parser/dist/stream.d.ts +14 -0
  146. package/esm/node_modules/conventional-commits-parser/dist/stream.d.ts.map +1 -0
  147. package/esm/node_modules/conventional-commits-parser/dist/stream.js +38 -0
  148. package/esm/node_modules/conventional-commits-parser/dist/types.d.ts +100 -0
  149. package/esm/node_modules/conventional-commits-parser/dist/types.d.ts.map +1 -0
  150. package/esm/node_modules/conventional-commits-parser/dist/types.js +2 -0
  151. package/esm/node_modules/conventional-commits-parser/dist/utils.d.ts +41 -0
  152. package/esm/node_modules/conventional-commits-parser/dist/utils.d.ts.map +1 -0
  153. package/esm/node_modules/conventional-commits-parser/dist/utils.js +75 -0
  154. package/esm/node_modules/conventional-commits-parser/package.json +22 -23
  155. package/esm/src/cli/command-help.js +15 -0
  156. package/esm/src/cli/repair-configuration-description.js +98 -0
  157. package/esm/src/cli/run-changelog.js +51 -0
  158. package/esm/src/cli/run-cli.js +8 -0
  159. package/esm/src/features/built-in-feature-registry.js +2 -0
  160. package/esm/src/features/changelog-feature.js +155 -0
  161. package/esm/src/features/github-ci-artifacts.js +17 -3
  162. package/esm/src/features/github-ci-runtime-matrix.js +50 -0
  163. package/esm/src/features/github-release-publish-artifacts.js +5 -4
  164. package/esm/src/features/github-release-publish-feature.js +7 -2
  165. package/esm/src/features/github-workflow-cache.js +18 -0
  166. package/esm/src/features/npm-readme-badge.js +163 -0
  167. package/esm/src/features/readme-contribution-plans.js +18 -1
  168. package/esm/src/features/workflow-deno.js +1 -1
  169. package/esm/src/package/npm-name.js +5 -0
  170. package/esm/src/readme/contribution-blocks.js +33 -6
  171. package/esm/src/release/changelog-markdown.js +41 -0
  172. package/esm/src/release/changelog.js +155 -7
  173. package/esm/src/release/format-changelog.js +15 -0
  174. package/esm/src/release/migrate-changelog.js +92 -0
  175. package/esm/src/release/publish-github.js +7 -3
  176. package/esm/src/release/publish-npm.js +2 -2
  177. package/esm/src/release/publish-tag-prepare.js +63 -78
  178. package/esm/src/release/release-history.js +53 -0
  179. package/npm-dependencies.lock.json +115 -48
  180. package/package.json +7 -5
  181. package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/dependencies.js +0 -11036
  182. package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/index.d.ts +0 -1416
  183. package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/index.js +0 -100
  184. package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/licenses.md +0 -1767
  185. package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/options.js +0 -92
  186. package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/parser.js +0 -84
  187. package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/utils.js +0 -7
  188. package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/validate.js +0 -122
  189. package/esm/node_modules/conventional-commits-parser/node_modules/meow/license +0 -9
  190. package/esm/node_modules/conventional-commits-parser/node_modules/meow/package.json +0 -107
  191. package/esm/node_modules/conventional-commits-parser/node_modules/meow/readme.md +0 -314
  192. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/cli.mjs +0 -0
  193. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/index.js +0 -0
  194. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/lib/util.js +0 -0
  195. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/templates/commit.hbs +0 -0
  196. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/templates/footer.hbs +0 -0
  197. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/templates/header.hbs +0 -0
  198. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/templates/template.hbs +0 -0
  199. /package/esm/node_modules/{conventional-commits-filter → conventional-changelog-core/node_modules/conventional-commits-filter}/index.js +0 -0
  200. /package/esm/node_modules/{conventional-commits-parser → conventional-changelog-core/node_modules/conventional-commits-parser}/cli.mjs +0 -0
  201. /package/esm/node_modules/{conventional-commits-parser → conventional-changelog-core/node_modules/conventional-commits-parser}/index.js +0 -0
  202. /package/esm/node_modules/{conventional-commits-parser → conventional-changelog-core/node_modules/conventional-commits-parser}/lib/parser.js +0 -0
  203. /package/esm/node_modules/{conventional-commits-parser → conventional-changelog-core/node_modules/conventional-commits-parser}/lib/regex.js +0 -0
  204. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/dependencies.js +0 -0
  205. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/index.d.ts +0 -0
  206. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/index.js +0 -0
  207. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/licenses.md +0 -0
  208. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/options.js +0 -0
  209. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/parser.js +0 -0
  210. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/utils.js +0 -0
  211. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/validate.js +0 -0
  212. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/license +0 -0
  213. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/package.json +0 -0
  214. /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/readme.md +0 -0
@@ -0,0 +1,383 @@
1
+ # [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage Status][coverage-image]][coverage-url]
2
+
3
+ > Parse raw conventional commits
4
+
5
+
6
+ ## Conventional Commit Message Format
7
+
8
+ A minimum input should contain a raw message.
9
+
10
+ Each commit message consists of a **merge header**, a **header** (mandatory), a **body** and a **footer**. **Mention** (optional) someone using the `@` notation.
11
+
12
+ ```
13
+ <merge>
14
+ <header>
15
+ <body>
16
+ <footer>
17
+ ```
18
+
19
+ ### merge
20
+
21
+ The merge header may optionally have a special format that includes other parts, such as **branch**, **issueId** or **source**.
22
+
23
+ ```
24
+ Merge branch <branch>
25
+ Merge pull request <issue-id> from <source>
26
+ ```
27
+
28
+ ### header
29
+
30
+ The header may optionally have a special format that includes other parts, such as **type**, **scope** and **subject**. You could **reference** (optional) issues here.
31
+
32
+ ```
33
+ <type>(<scope>): <subject>
34
+ ```
35
+
36
+ ### footer
37
+
38
+ The footer should contain any information about **Important Notes** (optional) and is also the place to **reference** (optional) issues.
39
+
40
+ ```
41
+ <important note>
42
+ <references>
43
+ ```
44
+
45
+ ### other parts
46
+
47
+ This module will only parse the message body. However, it is possible to include other fields such as hash, committer or date.
48
+
49
+ ```
50
+ My commit message
51
+ -sideNotes-
52
+ It should warn the correct unfound file names.
53
+ Also it should continue if one file cannot be found.
54
+ Tests are added for these
55
+ ```
56
+
57
+ Then `sideNotes` will be `It should warn the correct unfound file names.\nAlso it should continue if one file cannot be found.\nTests are added for these`. You can customize the `fieldPattern`.
58
+
59
+
60
+ ## Install
61
+
62
+ ```sh
63
+ $ npm install --save conventional-commits-parser
64
+ ```
65
+
66
+
67
+ ## Usage
68
+
69
+ ```js
70
+ var conventionalCommitsParser = require('conventional-commits-parser');
71
+
72
+ conventionalCommitsParser(options);
73
+ ```
74
+
75
+ It returns a transform stream and expects an upstream that looks something like this:
76
+
77
+ ```
78
+ 'feat(scope): broadcast $destroy event on scope destruction\nCloses #1'
79
+ 'feat(ng-list): Allow custom separator\nbla bla bla\n\nBREAKING CHANGE: some breaking change.\nThanks @stevemao\n'
80
+ ```
81
+
82
+ Each chunk should be a commit. The downstream will look something like this:
83
+
84
+ ```js
85
+ { type: 'feat',
86
+ scope: 'scope',
87
+ subject: 'broadcast $destroy event on scope destruction',
88
+ merge: null,
89
+ header: 'feat(scope): broadcast $destroy event on scope destruction',
90
+ body: null,
91
+ footer: 'Closes #1',
92
+ notes: [],
93
+ references:
94
+ [ { action: 'Closes',
95
+ owner: null,
96
+ repository: null,
97
+ issue: '1',
98
+ raw: '#1',
99
+ prefix: '#' } ],
100
+ mentions: [],
101
+ revert: null }
102
+ { type: 'feat',
103
+ scope: 'ng-list',
104
+ subject: 'Allow custom separator',
105
+ merge: null,
106
+ header: 'feat(ng-list): Allow custom separator',
107
+ body: 'bla bla bla',
108
+ footer: 'BREAKING CHANGE: some breaking change.\nThanks @stevemao',
109
+ notes:
110
+ [ { title: 'BREAKING CHANGE',
111
+ text: 'some breaking change.\nThanks @stevemao' } ],
112
+ references: [],
113
+ mentions: [ 'stevemao' ],
114
+ revert: null }
115
+ ```
116
+
117
+
118
+ ## API
119
+
120
+ ### conventionalCommitsParser([options])
121
+
122
+ Returns an transform stream. If there is any malformed commits it will be gracefully ignored (an empty data will be emitted so down stream can notice).
123
+
124
+ #### options
125
+
126
+ Type: `object`
127
+
128
+ ##### mergePattern
129
+
130
+ Type: `regex` or `string` Default: null
131
+
132
+ Pattern to match merge headers. EG: branch merge, GitHub or GitLab like pull requests headers. When a merge header is parsed, the next line is used for conventional header parsing.
133
+
134
+ For example, if we have a commit
135
+
136
+ ```
137
+ Merge pull request #1 from user/feature/feature-name
138
+
139
+ feat(scope): broadcast $destroy event on scope destruction
140
+ ```
141
+
142
+ We can parse it with these options and the default headerPattern:
143
+
144
+ ```js
145
+ {
146
+ mergePattern: /^Merge pull request #(\d+) from (.*)$/,
147
+ mergeCorrespondence: ['id', 'source']
148
+ }
149
+ ```
150
+
151
+ ##### mergeCorrespondence
152
+
153
+ Type: `array` of `string` or `string` Default: null
154
+
155
+ Used to define what capturing group of `mergePattern`.
156
+
157
+ If it's a `string` it will be converted to an `array` separated by a comma.
158
+
159
+ ##### headerPattern
160
+
161
+ Type: `regex` or `string` Default: `/^(\w*)(?:\(([\w\$\.\-\* ]*)\))?\: (.*)$/`
162
+
163
+ Used to match header pattern.
164
+
165
+ ##### headerCorrespondence
166
+
167
+ Type: `array` of `string` or `string` Default `['type', 'scope', 'subject']`
168
+
169
+ Used to define what capturing group of `headerPattern` captures what header part. The order of the array should correspond to the order of `headerPattern`'s capturing group. If the part is not captured it is `null`. If it's a `string` it will be converted to an `array` separated by a comma.
170
+
171
+ ##### referenceActions
172
+
173
+ Type: `array` of `string` or `string` Default:
174
+ `[
175
+ 'close',
176
+ 'closes',
177
+ 'closed',
178
+ 'fix',
179
+ 'fixes',
180
+ 'fixed',
181
+ 'resolve',
182
+ 'resolves',
183
+ 'resolved'
184
+ ]`
185
+
186
+ Keywords to reference an issue. This value is case **insensitive**. If it's a `string` it will be converted to an `array` separated by a comma.
187
+
188
+ Set it to `null` to reference an issue without any action.
189
+
190
+ ##### issuePrefixes
191
+
192
+ Type: `array` of `string` or `string` Default: `['#']`
193
+
194
+ The prefixes of an issue. EG: In `gh-123` `gh-` is the prefix.
195
+
196
+ ##### issuePrefixesCaseSensitive
197
+
198
+ Type: `boolean` Default: false
199
+
200
+ Used to define if `issuePrefixes` should be considered case sensitive.
201
+
202
+ ##### noteKeywords
203
+
204
+ Type: `array` of `string` or `string` Default: `['BREAKING CHANGE',
205
+ 'BREAKING-CHANGE']`
206
+
207
+ Keywords for important notes. This value is case **insensitive**. If it's a `string` it will be converted to an `array` separated by a comma.
208
+
209
+ ##### notesPattern
210
+
211
+ Type: `function` Default: `noteKeywordsSelection => ^[\\s|*]*(' + noteKeywordsSelection + ')[:\\s]+(.*)` where `noteKeywordsSelection` is `join(noteKeywords, '|')`
212
+
213
+ A function that takes `noteKeywordsSelection` and returns a `RegExp` to be matched against the notes.
214
+
215
+ ##### fieldPattern
216
+
217
+ Type: `regex` or `string` Default: `/^-(.*?)-$/`
218
+
219
+ Pattern to match other fields.
220
+
221
+ ##### revertPattern
222
+
223
+ Type: `regex` or `string` Default: `/^Revert\s"([\s\S]*)"\s*This reverts commit (\w*)\./`
224
+
225
+ Pattern to match what this commit reverts.
226
+
227
+ ##### revertCorrespondence
228
+
229
+ Type: `array` of `string` or `string` Default: `['header', 'hash']`
230
+
231
+ Used to define what capturing group of `revertPattern` captures what reverted commit fields. The order of the array should correspond to the order of `revertPattern`'s capturing group.
232
+
233
+ For example, if we had commit
234
+
235
+ ```
236
+ Revert "throw an error if a callback is passed"
237
+
238
+ This reverts commit 9bb4d6c.
239
+ ```
240
+
241
+ If configured correctly, the parsed result would be
242
+
243
+ ```js
244
+ {
245
+ revert: {
246
+ header: 'throw an error if a callback is passed',
247
+ hash: '9bb4d6c'
248
+ }
249
+ }
250
+ ```
251
+
252
+ It implies that this commit reverts a commit with header `'throw an error if a callback is passed'` and hash `'9bb4d6c'`.
253
+
254
+ If it's a `string` it will be converted to an `array` separated by a comma.
255
+
256
+ ##### commentChar
257
+
258
+ Type: `string` or `null` Default: null
259
+
260
+ What commentChar to use. By default it is `null`, so no comments are stripped.
261
+ Set to `#` if you pass the contents of `.git/COMMIT_EDITMSG` directly.
262
+
263
+ If you have configured the git commentchar via `git config core.commentchar` you'll want to pass what you have set there.
264
+
265
+ ##### warn
266
+
267
+ Type: `function` or `boolean` Default: `function() {}`
268
+
269
+ What warn function to use. For example, `console.warn.bind(console)` or `grunt.log.writeln`. By default, it's a noop. If it is `true`, it will error if commit cannot be parsed (strict).
270
+
271
+ ### conventionalCommitsParser.sync(commit, [options])
272
+
273
+ The sync version. Useful when parsing a single commit. Returns the result.
274
+
275
+ #### commit
276
+
277
+ A single commit to be parsed.
278
+
279
+ #### options
280
+
281
+ Same as the `options` of `conventionalCommitsParser`.
282
+
283
+
284
+ ## CLI
285
+
286
+ You can use cli to practice writing commit messages or parse messages from files. Note: the sample output might be different. It's just for demonstration purposes.
287
+
288
+ ```sh
289
+ $ npm install --global conventional-commits-parser
290
+ ```
291
+
292
+ If you run `conventional-commits-parser` without any arguments
293
+
294
+ ```sh
295
+ $ conventional-commits-parser
296
+ ```
297
+
298
+ You will enter an interactive shell. To show your parsed output enter "return" three times (or enter your specified separator).
299
+
300
+ ```sh
301
+ > fix(title): a title is fixed
302
+
303
+
304
+ {"type":"fix","scope":"title","subject":"a title is fixed","header":"fix(title): a title is fixed","body":null,"footer":null,"notes":[],"references":[],"revert":null}
305
+ ```
306
+
307
+ You can also use cli to parse messages from files.
308
+
309
+ If you have log.txt
310
+
311
+ ```text
312
+ feat(ngMessages): provide support for dynamic message resolution
313
+
314
+ Prior to this fix it was impossible to apply a binding to a the ngMessage directive to represent the name of the error.
315
+
316
+ BREAKING CHANGE: The `ngMessagesInclude` attribute is now its own directive and that must be placed as a **child** element within the element with the ngMessages directive.
317
+
318
+ Closes #10036
319
+ Closes #9338
320
+ ```
321
+
322
+ And you run
323
+
324
+ ```sh
325
+ $ conventional-commits-parser log.txt
326
+ # or
327
+ $ cat log.txt | conventional-commits-parser
328
+ ```
329
+
330
+ An array of json will be printed to stdout.
331
+
332
+ ```sh
333
+ [
334
+ {"type":"feat","scope":"ngMessages","subject":"provide support for dynamic message resolution","header":"feat(ngMessages): provide support for dynamic message resolution","body":"Prior to this fix it was impossible to apply a binding to a the ngMessage directive to represent the name of the error.","footer":"BREAKING CHANGE: The `ngMessagesInclude` attribute is now its own directive and that must be placed as a **child** element within the element with the ngMessages directive.\nCloses #10036\nCloses #9338","notes":[{"title":"BREAKING CHANGE","text":"The `ngMessagesInclude` attribute is now its own directive and that must be placed as a **child** element within the element with the ngMessages directive."}],"references":[{"action":"Closes","owner":null,"repository":null,"issue":"10036","raw":"#10036"},{"action":"Closes","owner":null,"repository":null,"issue":"9338","raw":"#9338"}],"revert":null}
335
+ ]
336
+ ```
337
+
338
+ Commits should be split by at least three newlines (`\n\n\n`) or you can specify a separator as the second argument.
339
+
340
+ Eg: in log2.txt
341
+
342
+ ```text
343
+
344
+ docs(ngMessageExp): split ngMessage docs up to show its alias more clearly
345
+ ===
346
+
347
+ fix($animate): applyStyles from options on leave
348
+
349
+ Closes #10068
350
+ ```
351
+
352
+ And you run
353
+
354
+ ```sh
355
+ $ conventional-commits-parser log2.txt '==='
356
+ ```
357
+
358
+ ```sh
359
+ [
360
+ {"type":"docs","scope":"ngMessageExp","subject":"split ngMessage docs up to show its alias more clearly","header":"docs(ngMessageExp): split ngMessage docs up to show its alias more clearly","body":null,"footer":null,"notes":[],"references":[],"revert":null}
361
+ ,
362
+ {"type":"fix","scope":"$animate","subject":"applyStyles from options on leave","header":"fix($animate): applyStyles from options on leave","body":null,"footer":"Closes #10068","notes":[],"references":[{"action":"Closes","owner":null,"repository":null,"issue":"10068","raw":"#10068"}],"revert":null}
363
+ ]
364
+ ```
365
+
366
+ Will be printed out.
367
+
368
+ You can specify one or more files. The output array will be in order of the input file paths. If you specify more than one separator, the last one will be used.
369
+
370
+
371
+ ## License
372
+
373
+ MIT © [Steve Mao](https://github.com/stevemao)
374
+
375
+
376
+ [npm-image]: https://badge.fury.io/js/conventional-commits-parser.svg
377
+ [npm-url]: https://npmjs.org/package/conventional-commits-parser
378
+ [travis-image]: https://travis-ci.org/conventional-changelog/conventional-commits-parser.svg?branch=master
379
+ [travis-url]: https://travis-ci.org/conventional-changelog/conventional-commits-parser
380
+ [daviddm-image]: https://david-dm.org/conventional-changelog/conventional-commits-parser.svg?theme=shields.io
381
+ [daviddm-url]: https://david-dm.org/conventional-changelog/conventional-commits-parser
382
+ [coverage-image]: https://coveralls.io/repos/github/conventional-changelog/conventional-changelog/badge.svg?branch=master
383
+ [coverage-url]: https://coveralls.io/github/conventional-changelog/conventional-changelog?branch=master
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "conventional-commits-parser",
3
+ "version": "5.0.0",
4
+ "description": "Parse raw conventional commits",
5
+ "bugs": {
6
+ "url": "https://github.com/conventional-changelog/conventional-changelog/issues"
7
+ },
8
+ "homepage": "https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-commits-parser#readme",
9
+ "author": {
10
+ "name": "Steve Mao",
11
+ "email": "maochenyan@gmail.com",
12
+ "url": "https://github.com/stevemao"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/conventional-changelog/conventional-changelog.git"
17
+ },
18
+ "license": "MIT",
19
+ "engines": {
20
+ "node": ">=16"
21
+ },
22
+ "files": [
23
+ "index.js",
24
+ "cli.mjs",
25
+ "lib"
26
+ ],
27
+ "keywords": [
28
+ "conventional-commits-parser",
29
+ "changelog",
30
+ "conventional",
31
+ "parser",
32
+ "parsing",
33
+ "logs"
34
+ ],
35
+ "dependencies": {
36
+ "JSONStream": "^1.3.5",
37
+ "is-text-path": "^2.0.0",
38
+ "meow": "^12.0.1",
39
+ "split2": "^4.0.0"
40
+ },
41
+ "bin": {
42
+ "conventional-commits-parser": "cli.mjs"
43
+ },
44
+ "devDependencies": {
45
+ "forceable-tty": "^0.1.0"
46
+ }
47
+ }