Skip to content

Commit

Permalink
feat: format the BREAKING CHANGE block
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Oct 7, 2021
1 parent fc7584a commit 22f1da0
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 79 deletions.
13 changes: 12 additions & 1 deletion 3_transformer.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@ func generateCommitHashURL(remoteURL *url.URL, longHash string) string {
}
}

func paddingLeft(txt string, cur string) string {
lines := strings.Split(txt, "\n")
newArr := make([]string, 0)

for _, line := range lines {
newArr = append(newArr, cur+line)
}

return strings.Join(newArr, "\n")
}

func Transform(g *client.GitClient, splices []*ExtractSplice) ([]*TemplateContext, error) {
context := make([]*TemplateContext, 0)

Expand Down Expand Up @@ -182,7 +193,7 @@ func Transform(g *client.GitClient, splices []*ExtractSplice) ([]*TemplateContex
c.Field.Footer = &Footer{
BreakingChange: &BreakingChange{
Title: breakingChangeFooter.Title,
Content: breakingChangeFooter.Content,
Content: paddingLeft(breakingChangeFooter.Content, " "),
},
}
}
Expand Down
46 changes: 25 additions & 21 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v0.5.2 (2021-10-08)

### Bugs fixed:

- default template([`fc7584a`](https://github.com/release-lab/whatchanged/commit/fc7584a8f2051b3692253e05780efec0ea174a20)) (@Axetroy)

## v0.5.1 (2021-10-08)

### New feature:
Expand Down Expand Up @@ -59,9 +65,9 @@
- remove stringsJoin method in template renderer and make
- remove npm publish

```diff
- npm install @axetroy/whatchanged -g
```
```diff
- npm install @axetroy/whatchanged -g
```

## v0.3.6 (2021-02-18)

Expand Down Expand Up @@ -202,29 +208,27 @@

- rename

```diff
- tag:0~tag:1
+ @0~@1
```

```diff
- tag:0~tag:1
+ @0~@1
```
- new flags

```diff
- --dir=/path/to/dir
+ --project=/path/to/project
```

```diff
- --file=CHANGELOG.md
+ --output=CHANGELOG.md
```
```diff
- --dir=/path/to/dir
+ --project=/path/to/project
```

```diff
- --file=CHANGELOG.md
+ --output=CHANGELOG.md
```
- repo and binary rename to whatchanged

```diff
- $ changelog --help
+ $ whatchanged --help
```
```diff
- $ changelog --help
+ $ whatchanged --help
```

## v0.1.0 (2020-11-24)

Expand Down
40 changes: 20 additions & 20 deletions __test__/vscode-deno.CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,32 +110,32 @@

- no more use `deno.dts_file` anymore

We think this configuration item is redundant
We think this configuration item is redundant

```
You can configure external declaration files in `tsconfig.json`
```
You can configure external declaration files in `tsconfig.json`
before:
before:
```json5
//.vscode/settings.json
{
"deno.enable": true,
"deno.dts_file": ["./path/to/demo.d.ts"]
}
```json5
//.vscode/settings.json
{
"deno.enable": true,
"deno.dts_file": ["./path/to/demo.d.ts"]
}
```
```

after:
after:

```json5
//.vscode/settings.json
{
"deno.enable": true
}
```json5
//.vscode/settings.json
{
"deno.enable": true
}

```
```
```
```
## v3.2.1 (2020-03-08)
Expand All @@ -156,7 +156,7 @@ after:
- improve fetching module message([`3bb70e2`](https://github.com/axetroy/vscode-deno/commit/3bb70e23f51750a3eab053289772f154740c3045)) (@axetroy)
- support Deno Dependency Viewer. close #83([`1b327b8`](https://github.com/axetroy/vscode-deno/commit/1b327b869cf74d2022dab71451c92ec3c4b5c5ea)) (@axetroy)
### ⚡️ Performance improves:
### Performance improves:
- improve performance for file_walker([`77ce898`](https://github.com/axetroy/vscode-deno/commit/77ce898b12c1e9ec9f995c1ae2b14342547f7cbd)) (@axetroy)
Expand Down
35 changes: 16 additions & 19 deletions __test__/whatchanged-[v0.2.0].CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,23 @@

- rename

```diff
- tag:0~tag:1
+ @0~@1
```

```diff
- tag:0~tag:1
+ @0~@1
```
- new flags

```diff
- --dir=/path/to/dir
+ --project=/path/to/project
```

```diff
- --file=CHANGELOG.md
+ --output=CHANGELOG.md
```

```diff
- --dir=/path/to/dir
+ --project=/path/to/project
```
```diff
- --file=CHANGELOG.md
+ --output=CHANGELOG.md
```
- repo and binary rename to whatchanged

```diff
- $ changelog --help
+ $ whatchanged --help
```
```diff
- $ changelog --help
+ $ whatchanged --help
```
34 changes: 16 additions & 18 deletions __test__/whatchanged-[v0.2.0~v0.1.0].CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,27 @@

- rename

```diff
- tag:0~tag:1
+ @0~@1
```

```diff
- tag:0~tag:1
+ @0~@1
```
- new flags

```diff
- --dir=/path/to/dir
+ --project=/path/to/project
```

```diff
- --file=CHANGELOG.md
+ --output=CHANGELOG.md
```
```diff
- --dir=/path/to/dir
+ --project=/path/to/project
```

```diff
- --file=CHANGELOG.md
+ --output=CHANGELOG.md
```
- repo and binary rename to whatchanged

```diff
- $ changelog --help
+ $ whatchanged --help
```
```diff
- $ changelog --help
+ $ whatchanged --help
```

## v0.1.0 (2020-11-24)

Expand Down

0 comments on commit 22f1da0

Please sign in to comment.