conventional-changelog-angular 8.2.0 → 8.3.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "conventional-changelog-angular",
3
3
  "type": "module",
4
- "version": "8.2.0",
4
+ "version": "8.3.0",
5
5
  "description": "Angular preset for conventional-changelog.",
6
6
  "author": "Steve Mao",
7
7
  "license": "ISC",
package/src/index.js CHANGED
@@ -2,14 +2,14 @@ import { createParserOpts } from './parser.js'
2
2
  import { createWriterOpts } from './writer.js'
3
3
  import { whatBump } from './whatBump.js'
4
4
 
5
- export default async function createPreset(config) {
5
+ export default function createPreset(config) {
6
6
  return {
7
7
  commits: {
8
8
  ignore: config?.ignoreCommits,
9
9
  merges: false
10
10
  },
11
11
  parser: createParserOpts(),
12
- writer: await createWriterOpts(),
12
+ writer: createWriterOpts(),
13
13
  whatBump
14
14
  }
15
15
  }
@@ -1,4 +1,47 @@
1
- *{{#if scope}} **{{scope}}:**
1
+ export const mainTemplate = `{{> header}}
2
+
3
+ {{#each commitGroups}}
4
+
5
+ {{#if title}}
6
+ ### {{title}}
7
+
8
+ {{/if}}
9
+ {{#each commits}}
10
+ {{> commit root=@root}}
11
+ {{/each}}
12
+
13
+ {{/each}}
14
+ {{> footer}}
15
+ `
16
+
17
+ export const headerPartial = `{{#if isPatch~}}
18
+ ##
19
+ {{~else~}}
20
+ #
21
+ {{~/if}} {{#if @root.linkCompare~}}
22
+ [{{version}}](
23
+ {{~#if @root.repository~}}
24
+ {{~#if @root.host}}
25
+ {{~@root.host}}/
26
+ {{~/if}}
27
+ {{~#if @root.owner}}
28
+ {{~@root.owner}}/
29
+ {{~/if}}
30
+ {{~@root.repository}}
31
+ {{~else}}
32
+ {{~@root.repoUrl}}
33
+ {{~/if~}}
34
+ /compare/{{previousTag}}...{{currentTag}})
35
+ {{~else}}
36
+ {{~version}}
37
+ {{~/if}}
38
+ {{~#if title}} "{{title}}"
39
+ {{~/if}}
40
+ {{~#if date}} ({{date}})
41
+ {{/if}}
42
+ `
43
+
44
+ export const commitPartial = `*{{#if scope}} **{{scope}}:**
2
45
  {{~/if}} {{#if subject}}
3
46
  {{~subject}}
4
47
  {{~else}}
@@ -59,3 +102,17 @@
59
102
  {{~/if}}{{/each}}
60
103
  {{~/if}}
61
104
 
105
+ `
106
+
107
+ export const footerPartial = `{{#if noteGroups}}
108
+ {{#each noteGroups}}
109
+
110
+ ### {{title}}
111
+
112
+ {{#each notes}}
113
+ * {{#if commit.scope}}**{{commit.scope}}:** {{/if}}{{text}}
114
+ {{/each}}
115
+ {{/each}}
116
+
117
+ {{/if}}
118
+ `
package/src/writer.js CHANGED
@@ -1,35 +1,19 @@
1
- import { readFile } from 'fs/promises'
2
- import { resolve } from 'path'
3
- import { fileURLToPath } from 'url'
4
1
  import compareFunc from 'compare-func'
2
+ import {
3
+ mainTemplate,
4
+ headerPartial,
5
+ commitPartial,
6
+ footerPartial
7
+ } from './templates.js'
5
8
 
6
- const dirname = fileURLToPath(new URL('.', import.meta.url))
7
9
  const COMMIT_HASH_LENGTH = 7
8
10
 
9
- export async function createWriterOpts() {
10
- const [
11
- template,
12
- header,
13
- commit,
14
- footer
15
- ] = await Promise.all([
16
- readFile(resolve(dirname, './templates/template.hbs'), 'utf-8'),
17
- readFile(resolve(dirname, './templates/header.hbs'), 'utf-8'),
18
- readFile(resolve(dirname, './templates/commit.hbs'), 'utf-8'),
19
- readFile(resolve(dirname, './templates/footer.hbs'), 'utf-8')
20
- ])
21
- const writerOpts = getWriterOpts()
22
-
23
- writerOpts.mainTemplate = template
24
- writerOpts.headerPartial = header
25
- writerOpts.commitPartial = commit
26
- writerOpts.footerPartial = footer
27
-
28
- return writerOpts
29
- }
30
-
31
- function getWriterOpts() {
11
+ export function createWriterOpts() {
32
12
  return {
13
+ mainTemplate,
14
+ headerPartial,
15
+ commitPartial,
16
+ footerPartial,
33
17
  transform: (commit, context) => {
34
18
  let discard = true
35
19
  const notes = commit.notes.map((note) => {
@@ -1,11 +0,0 @@
1
- {{#if noteGroups}}
2
- {{#each noteGroups}}
3
-
4
- ### {{title}}
5
-
6
- {{#each notes}}
7
- * {{#if commit.scope}}**{{commit.scope}}:** {{/if}}{{text}}
8
- {{/each}}
9
- {{/each}}
10
-
11
- {{/if}}
@@ -1,25 +0,0 @@
1
- {{#if isPatch~}}
2
- ##
3
- {{~else~}}
4
- #
5
- {{~/if}} {{#if @root.linkCompare~}}
6
- [{{version}}](
7
- {{~#if @root.repository~}}
8
- {{~#if @root.host}}
9
- {{~@root.host}}/
10
- {{~/if}}
11
- {{~#if @root.owner}}
12
- {{~@root.owner}}/
13
- {{~/if}}
14
- {{~@root.repository}}
15
- {{~else}}
16
- {{~@root.repoUrl}}
17
- {{~/if~}}
18
- /compare/{{previousTag}}...{{currentTag}})
19
- {{~else}}
20
- {{~version}}
21
- {{~/if}}
22
- {{~#if title}} "{{title}}"
23
- {{~/if}}
24
- {{~#if date}} ({{date}})
25
- {{/if}}
@@ -1,14 +0,0 @@
1
- {{> header}}
2
-
3
- {{#each commitGroups}}
4
-
5
- {{#if title}}
6
- ### {{title}}
7
-
8
- {{/if}}
9
- {{#each commits}}
10
- {{> commit root=@root}}
11
- {{/each}}
12
-
13
- {{/each}}
14
- {{> footer}}