@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
@@ -1,369 +1,76 @@
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]
1
+ # conventional-changelog-writer
2
2
 
3
- > Write logs based on conventional commits and templates
3
+ [![ESM-only package][package]][package-url]
4
+ [![NPM version][npm]][npm-url]
5
+ [![Node version][node]][node-url]
6
+ [![Dependencies status][deps]][deps-url]
7
+ [![Install size][size]][size-url]
8
+ [![Build status][build]][build-url]
9
+ [![Coverage status][coverage]][coverage-url]
4
10
 
5
- ## Install
6
-
7
- ```sh
8
- $ npm install --save conventional-changelog-writer
9
- ```
10
-
11
- ## Usage
12
-
13
- ```js
14
- var conventionalChangelogWriter = require('conventional-changelog-writer');
15
-
16
- conventionalChangelogWriter(context, options);
17
- ```
18
-
19
- It returns a transform stream.
20
-
21
- It expects an object mode upstream that looks something like this:
22
-
23
- ```js
24
- { hash: '9b1aff905b638aa274a5fc8f88662df446d374bd',
25
- header: 'feat(scope): broadcast $destroy event on scope destruction',
26
- type: 'feat',
27
- scope: 'scope',
28
- subject: 'broadcast $destroy event on scope destruction',
29
- body: null,
30
- footer: 'Closes #1',
31
- notes: [],
32
- references: [ { action: 'Closes', owner: null, repository: null, issue: '1', raw: '#1' } ] }
33
- { hash: '13f31602f396bc269076ab4d389cfd8ca94b20ba',
34
- header: 'feat(ng-list): Allow custom separator',
35
- type: 'feat',
36
- scope: 'ng-list',
37
- subject: 'Allow custom separator',
38
- body: 'bla bla bla',
39
- footer: 'BREAKING CHANGE: some breaking change',
40
- notes: [ { title: 'BREAKING CHANGE', text: 'some breaking change' } ],
41
- references: [] }
42
- ```
43
-
44
- Each chunk should be a commit. Json object is also **valid**. Parts of the objects will be formatted and combined into a log based on the handlebars context, templates and options.
45
-
46
- The downstream might look something like this:
47
-
48
- ```js
49
- ## 0.0.1 "this is a title" (2015-05-29)
50
-
51
-
52
- ### Features
53
-
54
- * **ng-list:** Allow custom separator ([13f3160](https://github.com/a/b/commits/13f3160))
55
- * **scope:** broadcast $destroy event on scope destruction ([9b1aff9](https://github.com/a/b/commits/9b1aff9)), closes [#1](https://github.com/a/b/issues/1)
56
-
57
-
58
- ### BREAKING CHANGES
59
-
60
- * some breaking change
61
- ```
62
-
63
-
64
- ## API
65
-
66
- ### conventionalChangelogWriter([context, [options]])
67
-
68
- Returns a transform stream.
69
-
70
- ### conventionalChangelogWriter.parseArray(commits, [context, [options]])
71
-
72
- Rather than returning a transform stream for parsing commits,
73
- parses the array of commits provided generating a CHANGELOG entry.
74
-
75
- #### context
76
-
77
- Variables that will be interpolated to the template. This object contains, but not limits to the following fields.
78
-
79
- ##### version
80
-
81
- Type: `string`
82
-
83
- Version number of the up-coming release. If `version` is found in the last commit before generating logs, it will be overwritten.
84
-
85
- ##### title
86
-
87
- Type: `string`
88
-
89
- ##### isPatch
90
-
91
- Type: `boolean` Default: `semver.patch(context.version) !== 0`
92
-
93
- By default, this value is true if `version`'s patch is `0`.
94
-
95
- ##### host
96
-
97
- Type: `string`
98
-
99
- The hosting website. Eg: `'https://github.com'` or `'https://bitbucket.org'`
100
-
101
- ##### owner
102
-
103
- Type: `string`
104
-
105
- The owner of the repository. Eg: `'stevemao'`.
106
-
107
- ##### repository
108
-
109
- Type: `string`
110
-
111
- The repository name on `host`. Eg: `'conventional-changelog-writer'`.
112
-
113
- ##### repoUrl
114
-
115
- Type: `string`
116
-
117
- The whole repository url. Eg: `'https://github.com/conventional-changelog/conventional-changelog-writer'`.
118
- The should be used as a fallback when `context.repository` doesn't exist.
119
-
120
- ##### linkReferences
121
-
122
- Type: `boolean` Default: `true` if (`context.repository` or `context.repoUrl`), `context.commit` and `context.issue` are truthy
123
-
124
- Should all references be linked?
125
-
126
- ##### commit
127
-
128
- Type: `string` Default: `'commits'`
129
-
130
- Commit keyword in the url if `context.linkReferences === true`.
131
-
132
- ##### issue
133
-
134
- Type: `string` Default: `'issues'`
135
-
136
- Issue or pull request keyword in the url if `context.linkReferences === true`.
137
-
138
- ##### date
139
-
140
- Type: `string` Default: formatted (`'yyyy-mm-dd'`) today's date in UTC timezone
141
-
142
- If `version` is found in the last commit, `committerDate` will overwrite this.
143
-
144
- #### options
145
-
146
- Type: `object`
147
-
148
- ##### transform
149
-
150
- Type: `object` or `function` Default: get the first 7 digits of hash, and `committerDate` will be formatted as `'yyyy-mm-dd'`.
151
-
152
- Replace with new values in each commit.
153
-
154
- If this is an object, the keys are paths to a nested object property. the values can be a string (static) and a function (dynamic) with the old value and path passed as arguments. This value is merged with your own transform object.
155
-
156
- If this is a function, the commit chunk will be passed as the argument and the returned value would be the new commit object. This is a handy function if you can't provide a transform stream as an upstream of this one. If returns a falsy value this commit is ignored.
157
-
158
- a `raw` object that is originally poured form upstream is attached to `commit`.
159
-
160
- ##### groupBy
161
-
162
- Type: `string` Default: `'type'`
163
-
164
- How to group the commits. EG: based on the same type. If this value is falsy, commits are not grouped.
165
-
166
- ##### commitGroupsSort
167
-
168
- Type: `function`, `string` or `array`
169
-
170
- A compare function used to sort commit groups. If it's a string or array, it sorts on the property(ies) by `localeCompare`. Will not sort if this is a falsy value.
171
-
172
- ##### commitsSort
11
+ [package]: https://img.shields.io/badge/package-ESM--only-ffe536.svg
12
+ [package-url]: https://nodejs.org/api/esm.html
173
13
 
174
- Type: `function`, `string` or `array` Default: `'header'`
14
+ [npm]: https://img.shields.io/npm/v/conventional-changelog-writer.svg
15
+ [npm-url]: https://npmjs.com/package/conventional-changelog-writer
175
16
 
176
- A compare function used to sort commits. If it's a string or array, it sorts on the property(ies) by `localeCompare`. Will not sort if this is a falsy value.
17
+ [node]: https://img.shields.io/node/v/conventional-changelog-writer.svg
18
+ [node-url]: https://nodejs.org
177
19
 
178
- ##### noteGroupsSort
20
+ [deps]: https://img.shields.io/librariesio/release/npm/conventional-changelog-writer
21
+ [deps-url]: https://libraries.io/npm/conventional-changelog-writer
179
22
 
180
- Type: `function`, `string` or `array` Default: `'title'`
23
+ [size]: https://packagephobia.com/badge?p=conventional-changelog-writer
24
+ [size-url]: https://packagephobia.com/result?p=conventional-changelog-writer
181
25
 
182
- A compare function used to sort note groups. If it's a string or array, it sorts on the property(ies) by `localeCompare`. Will not sort if this is a falsy value.
26
+ [build]: https://img.shields.io/github/actions/workflow/status/conventional-changelog/conventional-changelog/tests.yaml?branch=master
27
+ [build-url]: https://github.com/conventional-changelog/conventional-changelog/actions
183
28
 
184
- ##### notesSort
185
-
186
- Type: `function`, `string` or `array` Default: `'text'`
187
-
188
- A compare function used to sort note groups. If it's a string or array, it sorts on the property(ies) by `localeCompare`. Will not sort if this is a falsy value.
189
-
190
- ##### generateOn
191
-
192
- Type: `function`, `string` or `any` Default: if `commit.version` is a valid semver.
193
-
194
- When the upstream finishes pouring the commits it will generate a block of logs if `doFlush` is `true`. However, you can generate more than one block based on this criteria (usually a version) even if there are still commits from the upstream.
195
-
196
- ###### generateOn(commit, commits, context, options)
197
-
198
- ####### commit
199
-
200
- Current commit.
201
-
202
- ####### commits
203
-
204
- Current collected commits.
205
-
206
- ####### context
207
-
208
- The generated context based on original input `context` and `options`.
209
-
210
- ####### options
211
-
212
- Normalized options.
213
-
214
- **NOTE**: It checks on the transformed commit chunk instead of the original one (you can check on the original by access the `raw` object on the `commit`). However, if the transformed commit is ignored it falls back to the original commit.
215
-
216
- If this value is a `string`, it checks the existence of the field. Set to other type to disable it.
217
-
218
- ##### finalizeContext
219
-
220
- Type: `function` Default: pass through
221
-
222
- Last chance to modify your context before generating a changelog.
223
-
224
- ###### finalizeContext(context, options, commits, keyCommit)
225
-
226
- ####### context
227
-
228
- The generated context based on original input `context` and `options`.
229
-
230
- ####### options
231
-
232
- Normalized options.
233
-
234
- ####### commits
235
-
236
- Filtered commits from your git metadata.
237
-
238
- ####### keyCommit
239
-
240
- The commit that triggers to generate the log.
241
-
242
- ##### debug
243
-
244
- Type: `function` Default: `function() {}`
245
-
246
- A function to get debug information.
247
-
248
- ##### reverse
249
-
250
- Type: `boolean` Default: `false`
251
-
252
- The normal order means reverse chronological order. `reverse` order means chronological order. Are the commits from upstream in the reverse order? You should only worry about this when generating more than one blocks of logs based on `generateOn`. If you find the last commit is in the wrong block inverse this value.
253
-
254
- ##### includeDetails
255
-
256
- Type: `boolean` Default: `false`
257
-
258
- If this value is `true`, instead of emitting strings of changelog, it emits objects containing the details the block.
259
-
260
- *NOTE:* The downstream must be in object mode if this is `true`.
261
- *NOTE:* This is only supported when using streaming mode.
262
-
263
- ##### ignoreReverted
264
-
265
- Type: `boolean` Default: `true`
266
-
267
- If `true`, reverted commits will be ignored.
268
-
269
- ##### doFlush
270
-
271
- Type: `boolean` Default: `true`
272
-
273
- If `true`, the stream will flush out the last bit of commits (could be empty) to changelog.
274
-
275
- *NOTE:* This is only supported when using streaming mode.
276
-
277
- ##### mainTemplate
278
-
279
- Type: `string` Default: [template.hbs](templates/template.hbs)
280
-
281
- The main handlebars template.
282
-
283
- ##### headerPartial
284
-
285
- Type: `string` Default: [header.hbs](templates/header.hbs)
286
-
287
- ##### commitPartial
288
-
289
- Type: `string` Default: [commit.hbs](templates/commit.hbs)
290
-
291
- ##### footerPartial
292
-
293
- Type: `string` Default: [footer.hbs](templates/footer.hbs)
294
-
295
- ##### partials
296
-
297
- Type: `object`
298
-
299
- Partials that used in the main template, if any. The key should be the partial name and the value should be handlebars template strings. If you are using handlebars template files, read files by yourself.
300
-
301
-
302
- ## Customization Guide
303
-
304
- It is possible to customize this the changelog to suit your needs. Templates are written in [handlebars](http://handlebarsjs.com). You can customize all partials or the whole template. Template variables are from either `upstream` or `context`. The following are a suggested way of defining variables.
305
-
306
- ### upstream
307
-
308
- Variables in upstream are commit specific and should be used per commit. Eg: *commit date* and *commit username*. You can think of them as "local" or "isolate" variables. A "raw" commit message (original commit poured from upstream) is attached to `commit`. `transform` can be used to modify a commit.
309
-
310
- ### context
311
-
312
- context should be module specific and can be used across the whole log. Thus these variables should not be related to any single commit and should be generic information of the module or all commits. Eg: *repository url* and *author names*, etc. You can think of them as "global" or "root" variables.
313
-
314
- Basically you can make your own templates and define all your template context. Extra context are based on commits from upstream and `options`. For more details, please checkout [handlebars](http://handlebarsjs.com) and the source code of this module. `finalizeContext` can be used at last to modify context before generating a changelog.
29
+ [coverage]: https://coveralls.io/repos/github/conventional-changelog/conventional-changelog/badge.svg?branch=master
30
+ [coverage-url]: https://coveralls.io/github/conventional-changelog/conventional-changelog?branch=master
315
31
 
32
+ Write logs based on conventional commits and templates.
316
33
 
317
- ## CLI
34
+ ## Install
318
35
 
319
- ```sh
320
- $ npm install --global conventional-changelog-writer
321
- $ conventional-changelog-writer --help # for more details
36
+ ```bash
37
+ # pnpm
38
+ pnpm add conventional-changelog-writer
39
+ # yarn
40
+ yarn add conventional-changelog-writer
41
+ # npm
42
+ npm i conventional-changelog-writer
322
43
  ```
323
44
 
324
- It works with [Line Delimited JSON](http://en.wikipedia.org/wiki/Line_Delimited_JSON).
325
-
326
- If you have commits.ldjson
45
+ ## Usage
327
46
 
328
47
  ```js
329
- {"hash":"9b1aff905b638aa274a5fc8f88662df446d374bd","header":"feat(ngMessages): provide support for dynamic message resolution","type":"feat","scope":"ngMessages","subject":"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"}]}
330
- ```
48
+ import { writeChangelogString } from 'conventional-changelog-writer'
331
49
 
332
- And you run
333
-
334
- ```sh
335
- $ conventional-changelog-writer commits.ldjson -o options.js
336
- ```
337
-
338
- The output might look something like this
339
-
340
- ```md
341
- # 1.0.0 (2015-04-09)
50
+ // commits parsed by conventional-commits-parser
51
+ const commits = [/* ... */]
52
+ const context = {
53
+ version: '1.0.0',
54
+ host: 'https://github.com',
55
+ owner: 'conventional-changelog',
56
+ repository: 'conventional-changelog'
57
+ }
342
58
 
59
+ console.log(await writeChangelogString(commits, context))
60
+ /*
61
+ ## 1.0.0 (2015-05-29)
343
62
 
344
63
  ### Features
345
64
 
346
- * **ngMessages:** provide support for dynamic message resolution 9b1aff9, closes #10036 #9338
347
-
348
-
349
- ### BREAKING CHANGES
350
-
351
- * The `ngMessagesInclude` attribute is now its own directive and that must be placed as a **child** element within the element with the ngMessages directive.
65
+ * **ng-list:** Allow custom separator ([13f3160](https://github.com/...))
66
+ ...
67
+ */
352
68
  ```
353
69
 
354
- It is printed to stdout.
70
+ ## Documentation
355
71
 
72
+ For streams and async iterables helpers, context and options reference, customization guide, and CLI usage, visit the [documentation website](https://conventional-changelog.js.org/changelog-writer/).
356
73
 
357
74
  ## License
358
75
 
359
76
  MIT © [Steve Mao](https://github.com/stevemao)
360
-
361
-
362
- [npm-image]: https://badge.fury.io/js/conventional-changelog-writer.svg
363
- [npm-url]: https://npmjs.org/package/conventional-changelog-writer
364
- [travis-image]: https://travis-ci.org/conventional-changelog/conventional-changelog-writer.svg?branch=master
365
- [travis-url]: https://travis-ci.org/conventional-changelog/conventional-changelog-writer
366
- [daviddm-image]: https://david-dm.org/conventional-changelog/conventional-changelog-writer.svg?theme=shields.io
367
- [daviddm-url]: https://david-dm.org/conventional-changelog/conventional-changelog-writer
368
- [coverage-image]: https://coveralls.io/repos/github/conventional-changelog/conventional-changelog/badge.svg?branch=master
369
- [coverage-url]: https://coveralls.io/github/conventional-changelog/conventional-changelog?branch=master
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env node
2
+ import { pipeline } from 'stream/promises';
3
+ import { readFile } from 'fs/promises';
4
+ import { readOptions, option, flag, alias, rest } from 'argue-cli';
5
+ import { writeChangelog } from '../index.js';
6
+ import { loadDataFile, readCommitsFromFiles, readCommitsFromStdin } from './utils.js';
7
+ const HELP = `
8
+ Usage
9
+ conventional-changelog-writer <path> [<path> ...]
10
+ cat <path> | conventional-changelog-writer
11
+
12
+ Example
13
+ conventional-changelog-writer commits.ldjson
14
+ cat commits.ldjson | conventional-changelog-writer
15
+
16
+ Options
17
+ -c, --context A filepath of a json that is used to define template variables
18
+ -o, --options A filepath of a javascript object that is used to define options
19
+ `;
20
+ const flags = readOptions(option(alias('context', 'c'), String), option(alias('options', 'o'), String), flag('help'), flag('version'));
21
+ const files = rest();
22
+ if (flags.help || flags.version) {
23
+ const pkg = JSON.parse(await readFile(new URL('../../package.json', import.meta.url), 'utf8'));
24
+ console.log(flags.help
25
+ ? `\n ${pkg.description}\n${HELP}`
26
+ : pkg.version);
27
+ process.exit(0);
28
+ }
29
+ const { context: contextPath, options: optionsPath } = flags;
30
+ let context;
31
+ let options;
32
+ if (contextPath) {
33
+ try {
34
+ context = await loadDataFile(contextPath);
35
+ }
36
+ catch (err) {
37
+ console.error(`Failed to get context from file ${contextPath}:\n ${err}`);
38
+ process.exit(1);
39
+ }
40
+ }
41
+ if (optionsPath) {
42
+ try {
43
+ options = await loadDataFile(optionsPath);
44
+ }
45
+ catch (err) {
46
+ console.error(`Failed to get options from file ${optionsPath}:\n ${err}`);
47
+ process.exit(1);
48
+ }
49
+ }
50
+ let inputStream;
51
+ try {
52
+ if (files.length) {
53
+ inputStream = readCommitsFromFiles(files);
54
+ }
55
+ else if (process.stdin.isTTY) {
56
+ console.error('You must specify at least one line delimited json file');
57
+ process.exit(1);
58
+ }
59
+ else {
60
+ inputStream = readCommitsFromStdin();
61
+ }
62
+ await pipeline(inputStream, writeChangelog(context, options), process.stdout);
63
+ }
64
+ catch (err) {
65
+ console.error(err);
66
+ process.exit(1);
67
+ }
68
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY2xpL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFDQSxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0saUJBQWlCLENBQUE7QUFDMUMsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGFBQWEsQ0FBQTtBQUV0QyxPQUFPLEVBQ0wsV0FBVyxFQUNYLE1BQU0sRUFDTixJQUFJLEVBQ0osS0FBSyxFQUNMLElBQUksRUFDTCxNQUFNLFdBQVcsQ0FBQTtBQUNsQixPQUFPLEVBR0wsY0FBYyxFQUNmLE1BQU0sYUFBYSxDQUFBO0FBQ3BCLE9BQU8sRUFDTCxZQUFZLEVBQ1osb0JBQW9CLEVBQ3BCLG9CQUFvQixFQUNyQixNQUFNLFlBQVksQ0FBQTtBQUVuQixNQUFNLElBQUksR0FBRzs7Ozs7Ozs7Ozs7O0NBWVosQ0FBQTtBQUNELE1BQU0sS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UFjLENBQUMsT0FBTyxFQUFFLE9BQU8sQ0FBQyxFQUNoQyxPQUFPLENBQUMsTUFBTSxDQUNmLENBQUE7QUFDSCxDQUFDO0FBQUMsT0FBTyxHQUFHLEVBQUUsQ0FBQztJQUNiLE9BQU8sQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLENBQUE7SUFDbEIsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQTtBQUNqQixDQUFDIn0=
@@ -0,0 +1,4 @@
1
+ export declare function readCommitsFromFiles<T>(files: string[]): AsyncGenerator<Awaited<T>, void, unknown>;
2
+ export declare function readCommitsFromStdin<T>(): AsyncGenerator<Awaited<T>, void, unknown>;
3
+ export declare function loadDataFile(filePath: string): Promise<object>;
4
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/cli/utils.ts"],"names":[],"mappings":"AAQA,wBAAuB,oBAAoB,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,6CAQ7D;AAED,wBAAgB,oBAAoB,CAAC,CAAC,+CAErC;AAMD,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAWpE"}
@@ -0,0 +1,39 @@
1
+ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
2
+ if (typeof path === "string" && /^\.\.?\//.test(path)) {
3
+ return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
4
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
5
+ });
6
+ }
7
+ return path;
8
+ };
9
+ import { resolve, extname } from 'path';
10
+ import { pathToFileURL } from 'url';
11
+ import { readFile } from 'fs/promises';
12
+ import { parseJsonStream } from '@simple-libs/stream-utils';
13
+ export async function* readCommitsFromFiles(files) {
14
+ for (const file of files) {
15
+ try {
16
+ yield JSON.parse(await readFile(file, 'utf8'));
17
+ }
18
+ catch (err) {
19
+ console.warn(`Failed to read file ${file}:\n ${err}`);
20
+ }
21
+ }
22
+ }
23
+ export function readCommitsFromStdin() {
24
+ return parseJsonStream(process.stdin);
25
+ }
26
+ function relativeResolve(filePath) {
27
+ return pathToFileURL(resolve(process.cwd(), filePath));
28
+ }
29
+ export async function loadDataFile(filePath) {
30
+ const resolvedFilePath = relativeResolve(filePath);
31
+ const ext = extname(resolvedFilePath.toString());
32
+ if (ext === '.json') {
33
+ return JSON.parse(await readFile(resolvedFilePath, 'utf8'));
34
+ }
35
+ // @ts-expect-error Dynamic import actually works with file URLs
36
+ // oxlint-disable-next-line typescript/no-unsafe-member-access
37
+ return (await import(__rewriteRelativeImportExtension(resolvedFilePath))).default;
38
+ }
39
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY2xpL3V0aWxzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7O0FBQUEsT0FBTyxFQUNMLE9BQU8sRUFDUCxPQUFPLEVBQ1IsTUFBTSxNQUFNLENBQUE7QUFDYixPQUFPLEVBQUUsYUFBYSxFQUFFLE1BQU0sS0FBSyxDQUFBO0FBQ25DLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxhQUFhLENBQUE7QUFDdEMsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLDJCQUEyQixDQUFBO0FBRTNELE1BQU0sQ0FBQyxLQUFLLFNBQVMsQ0FBQyxDQUFDLG9CQUFvQixDQUFJLEtBQWU7SUFDNUQsS0FBSyxNQUFNLElBQUksSUFBSSxLQUFLLEVBQUUsQ0FBQztRQUN6QixJQUFJLENBQUM7WUFDSCxNQUFNLElBQUksQ0FB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ject, TransformedCommit } from '@conventional-changelog/template';
2
+ /**
3
+ * Apply transformation to commit.
4
+ * @param commit
5
+ * @param transform
6
+ * @param args - Additional arguments for transformation function.
7
+ * @returns Transformed commit.
8
+ */
9
+ export declare function transformCommit<Commit extends AnyObject, Args extends unknown[]>(commit: Commit, transform: ((commit: Commit, ...args: Args) => Partial<Commit> | null | Promise<Partial<Commit> | null>) | null | undefined, ...args: Args): Promise<TransformedCommit<Commit> | null>;
10
+ //# sourceMappingURL=commit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commit.d.ts","sourceRoot":"","sources":["../src/commit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,iBAAiB,EAClB,MAAM,kCAAkC,CAAA;AA2BzC;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,MAAM,SAAS,SAAS,EAAE,IAAI,SAAS,OAAO,EAAE,EACpF,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,EAC3H,GAAG,IAAI,EAAE,IAAI,GACZ,OAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAgB3C"}
@@ -0,0 +1,43 @@
1
+ function preventModifications(object) {
2
+ return new Proxy(object, {
3
+ get(target, prop) {
4
+ const value = target[prop];
5
+ // https://github.com/conventional-changelog/conventional-changelog/pull/1285
6
+ if (value instanceof Date) {
7
+ return value;
8
+ }
9
+ if (typeof value === 'object' && value !== null) {
10
+ return preventModifications(value);
11
+ }
12
+ return value;
13
+ },
14
+ set() {
15
+ throw new Error('Cannot modify immutable object.');
16
+ },
17
+ deleteProperty() {
18
+ throw new Error('Cannot modify immutable object.');
19
+ }
20
+ });
21
+ }
22
+ /**
23
+ * Apply transformation to commit.
24
+ * @param commit
25
+ * @param transform
26
+ * @param args - Additional arguments for transformation function.
27
+ * @returns Transformed commit.
28
+ */
29
+ export async function transformCommit(commit, transform, ...args) {
30
+ if (typeof transform === 'function') {
31
+ const patch = await transform(preventModifications(commit), ...args);
32
+ if (patch) {
33
+ return {
34
+ ...commit,
35
+ ...patch,
36
+ raw: commit
37
+ };
38
+ }
39
+ return null;
40
+ }
41
+ return commit;
42
+ }
43
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbWl0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2NvbW1pdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLQSxTQUFTLG9CQUFvQixDQUFzQixNQUFTO0lBQzFELE9BQU8sSUFBSSxLQUFLLENBQUMsTUFBTSxFQUFFO1FBQ3ZCLEdBQUcsQ0FBQyxNQUFNLEVBQUUsSUFBWTtZQUN0QixNQUFNLEtBQUssR0FBRyxNQUFNLENBQUMsSUFBSSxDQUFZLENBQUE7WUFFckMsNkVBQTZFO1lBQzdFLElBQUksS0FBSyxZQUFZLElBQUksRUFBRSxDQUFDO2dCQUMxQixPQUFPLEtBQUssQ0FBQTtZQUNkLENBQUM7WUFFRCxJQUFJLE9BQU8sS0FBSyxLQUFLLFFBQVEsSUFBSSxLQUFLLEtBQUssSUFBSSxFQUFFLENBQUM7Z0JBQ2hELE9BQU8sb0JBQW9CLENBQUMsS0FBSyxDQUFDLENBQUE7WUFDcEMsQ0FBQztZQUVELE9BQU8sS0FBSyxDQUFBO1FBQ2QsQ0FBQztRQUNELEdBQUc7WUFDRCxNQUFNLElBQUksS0FBSyxDQUFDLGlDQUFpQyxDQUFDLENBQUE7UUFDcEQsQ0FBQztRQUNELGNBQWM7WUFDWixNQUFNLElBQUksS0FBSyxDQUFDLGlDQUFpQyxDQUFDLENBQUE7UUFDcEQsQ0FBQztLQUNGLENBQUMsQ0FBQTtBQUNKLENBQUM7QUFFRDs7Ozs7O0dBTUc7QUFDSCxNQUFNLENBQUMsS0FBSyxVQUFVLGVBQWUsQ0FDbkMsTUFBYyxFQUNkLFNBQTJILEVBQzNILEdBQUcsSUFBVTtJQUViLElBQUksT0FBTyxTQUFTLEtBQUssVUFBVSxFQUFFLENBQUM7UUFDcEMsTUFBTSxLQUFLLEdBQUcsTUFBTSxTQUFTLENBQUMsb0JBQW9CLENBQUMsTUFBTSxDQUFDLEVBQUUsR0FBRyxJQUFJLENBQUMsQ0FBQTtRQUVwRSxJQUFJLEtBQUssRUFBRSxDQUFDO1lBQ1YsT0FBTztnQkFDTCxHQUFHLE1BQU07Z0JBQ1QsR0FBRyxLQUFLO2dCQUNSLEdBQUcsRUFBRSxNQUFNO2FBQ1osQ0FBQTtRQUNILENBQUM7UUFFRCxPQUFPLElBQUksQ0FBQTtJQUNiLENBQUM7SUFFRCxPQUFPLE1BQU0sQ0FBQTtBQUNmLENBQUMifQ==
@@ -0,0 +1,27 @@
1
+ import type { CommitKnownProps, CommitGroup, CommitNote, NoteGroup, FinalTemplateContext, TemplateContext, TransformedCommit } from '@conventional-changelog/template';
2
+ import type { FinalOptions } from './types/index.js';
3
+ export declare function getCommitGroups<Commit extends CommitKnownProps = CommitKnownProps>(commits: Commit[], options: Pick<FinalOptions<Commit>, 'groupBy' | 'commitGroupsSort' | 'commitsSort'>): CommitGroup<Commit>[];
4
+ export declare function getNoteGroups<Commit extends CommitKnownProps = CommitKnownProps>(notes: CommitNote[], options: Pick<FinalOptions<Commit>, 'noteGroupsSort' | 'notesSort'>): NoteGroup[];
5
+ export declare function getExtraContext<Commit extends CommitKnownProps = CommitKnownProps>(commits: Commit[], notes: CommitNote[], options: Pick<FinalOptions<Commit>, 'groupBy' | 'commitGroupsSort' | 'commitsSort' | 'noteGroupsSort' | 'notesSort'>): {
6
+ commitGroups: CommitGroup<Commit>[];
7
+ noteGroups: NoteGroup[];
8
+ };
9
+ /**
10
+ * Get final context with default values.
11
+ * @param context
12
+ * @param options
13
+ * @returns Final context with default values.
14
+ */
15
+ export declare function getFinalContext<Commit extends CommitKnownProps = CommitKnownProps>(context: TemplateContext<Commit>, options: Pick<FinalOptions<Commit>, 'formatDate' | 'headerPartial' | 'preamblePartial' | 'commitPartial' | 'footerPartial'>): FinalTemplateContext<Commit>;
16
+ /**
17
+ * Get context prepared for template.
18
+ * @param keyCommit
19
+ * @param commits
20
+ * @param filteredCommits
21
+ * @param notes
22
+ * @param context
23
+ * @param options
24
+ * @returns TemplateContext prepared for template.
25
+ */
26
+ export declare function getTemplateContext<Commit extends CommitKnownProps = CommitKnownProps>(keyCommit: Commit | null, commits: TransformedCommit<Commit>[], context: FinalTemplateContext<Commit>, options: FinalOptions<Commit>): Promise<FinalTemplateContext<Commit>>;
27
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EAClB,MAAM,kCAAkC,CAAA;AAGzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAGpD,wBAAgB,eAAe,CAAC,MAAM,SAAS,gBAAgB,GAAG,gBAAgB,EAChF,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,SAAS,GAAG,kBAAkB,GAAG,aAAa,CAAC,yBAoCpF;AAED,wBAAgB,aAAa,CAAC,MAAM,SAAS,gBAAgB,GAAG,gBAAgB,EAC9E,KAAK,EAAE,UAAU,EAAE,EACnB,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,WAAW,CAAC,eAsCpE;AAED,wBAAgB,eAAe,CA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