@govbr-ds/release-config 3.3.0-alpha.2 → 4.0.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/README.md +2 -2
- package/package.json +12 -16
- package/{semantic-release.cjs → src/index.js} +8 -12
- package/src/templates/commit.hbs +29 -0
- package/src/templates/footer.hbs +0 -0
- package/src/templates/header.hbs +9 -0
- package/src/templates/template.hbs +22 -0
- package/src/writer.js +39 -0
package/README.md
CHANGED
|
@@ -19,9 +19,9 @@ Configurações para o [Semantic Release](https://github.com/semantic-release/se
|
|
|
19
19
|
1. Crie um arquivo `release.config.js` na raiz do seu projeto e importe os plugins que deseja usar:
|
|
20
20
|
|
|
21
21
|
```javascript
|
|
22
|
-
|
|
22
|
+
import { branches, commitAnalyzer, releaseNotesGenerator, changelog, gitlab, git } from './node_modules/@govbr-ds/config-tools/src/semantic-release.cjs'
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
export defaul {
|
|
25
25
|
branches: branches,
|
|
26
26
|
plugins: [
|
|
27
27
|
commitAnalyzer,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@govbr-ds/release-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Configuração compartilhada do semantic-release para projetos do GovBR-DS",
|
|
6
6
|
"keywords": [
|
|
@@ -13,29 +13,25 @@
|
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
|
-
"url": "git@gitlab.com:govbr-ds/tools/govbr-ds-config-tools.git"
|
|
16
|
+
"url": "git@gitlab.com:govbr-ds/tools/govbr-ds-config-tools.git",
|
|
17
|
+
"directory": "packages/release"
|
|
17
18
|
},
|
|
18
19
|
"license": "MIT",
|
|
19
20
|
"author": "SERPRO (http://serpro.gov.br/)",
|
|
20
|
-
"
|
|
21
|
+
"type": "module",
|
|
22
|
+
"exports": "./src/index.js",
|
|
23
|
+
"main": "./src/index.js",
|
|
21
24
|
"files": [
|
|
22
|
-
"
|
|
25
|
+
"src"
|
|
23
26
|
],
|
|
24
|
-
"scripts": {
|
|
25
|
-
"commit": "git-cz",
|
|
26
|
-
"lint:md": "markdownlint -d --fix **/*.md"
|
|
27
|
-
},
|
|
28
|
-
"config": {
|
|
29
|
-
"commitizen": {
|
|
30
|
-
"path": "@commitlint/cz-commitlint"
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
27
|
"dependencies": {
|
|
34
28
|
"@semantic-release/changelog": "^6.0.3",
|
|
35
|
-
"@semantic-release/commit-analyzer": "^
|
|
29
|
+
"@semantic-release/commit-analyzer": "^12.0.0",
|
|
36
30
|
"@semantic-release/git": "^10.0.1",
|
|
37
31
|
"@semantic-release/gitlab": "^13.0.3",
|
|
38
|
-
"@semantic-release/release-notes-generator": "^
|
|
39
|
-
"
|
|
32
|
+
"@semantic-release/release-notes-generator": "^13.0.0",
|
|
33
|
+
"compare-func": "^2.0.0",
|
|
34
|
+
"inquirer": "^9.2.19",
|
|
35
|
+
"semantic-release": "^23.0.8"
|
|
40
36
|
}
|
|
41
37
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { createWriterOpts } from './writer.js'
|
|
2
|
+
|
|
1
3
|
const branches = [
|
|
2
4
|
'main',
|
|
3
5
|
'+([0-9])?(.{+([0-9]),x}).x', //1.x.x
|
|
@@ -68,17 +70,7 @@ const releaseNotesGenerator = [
|
|
|
68
70
|
parserOpts: {
|
|
69
71
|
noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES', 'BREAKING'],
|
|
70
72
|
},
|
|
71
|
-
writerOpts:
|
|
72
|
-
commitsSort: ['scope', 'subject'],
|
|
73
|
-
finalizeContext: (context) => {
|
|
74
|
-
const date = new Date()
|
|
75
|
-
context.date = date.toLocaleString('pt-BR', {
|
|
76
|
-
timeZone: 'America/Sao_Paulo',
|
|
77
|
-
dateStyle: 'short',
|
|
78
|
-
})
|
|
79
|
-
return context
|
|
80
|
-
},
|
|
81
|
-
},
|
|
73
|
+
writerOpts: await createWriterOpts(),
|
|
82
74
|
},
|
|
83
75
|
]
|
|
84
76
|
|
|
@@ -94,6 +86,10 @@ const gitlab = [
|
|
|
94
86
|
{
|
|
95
87
|
successComment:
|
|
96
88
|
':tada: Issue/Merge Request incluído(a) na versão ${nextRelease.version} :tada:\n\nPara mais detalhes:\n- [GitLab release]($CI_PROJECT_URL/-/releases/${nextRelease.version})\n- [GitLab tag]($CI_PROJECT_URL/-/tags/${nextRelease.version})',
|
|
89
|
+
failComment:
|
|
90
|
+
'A release a partir da branch ${branch.name} falhou devido aos seguintes erros:\n- ${errors.map(err => err.message).join("\\n- ")}',
|
|
91
|
+
failTitle: 'A release automática falhou 🚨',
|
|
92
|
+
labels: 'crítico, precisa-de-triagem, semantic-release',
|
|
97
93
|
},
|
|
98
94
|
]
|
|
99
95
|
|
|
@@ -106,4 +102,4 @@ const git = [
|
|
|
106
102
|
},
|
|
107
103
|
]
|
|
108
104
|
|
|
109
|
-
|
|
105
|
+
export { branches, changelog, commitAnalyzer, git, gitlab, releaseNotesGenerator }
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
*{{#if scope}} **{{scope}}:**
|
|
2
|
+
{{~/if}} {{#if subject}}
|
|
3
|
+
{{~subject}}
|
|
4
|
+
{{~else}}
|
|
5
|
+
{{~header}}
|
|
6
|
+
{{~/if}}
|
|
7
|
+
|
|
8
|
+
{{~!-- commit link --}}{{~#if hash}} {{#if @root.linkReferences~}}
|
|
9
|
+
([{{shortHash}}]({{commitUrlFormat}}))
|
|
10
|
+
{{~else}}
|
|
11
|
+
{{~shortHash}}
|
|
12
|
+
{{~/if}}{{~/if}}
|
|
13
|
+
|
|
14
|
+
{{~!-- commit references --}}
|
|
15
|
+
{{~#if references~}}
|
|
16
|
+
, closes
|
|
17
|
+
{{~#each references}} {{#if @root.linkReferences~}}
|
|
18
|
+
[
|
|
19
|
+
{{~#if this.owner}}
|
|
20
|
+
{{~this.owner}}/
|
|
21
|
+
{{~/if}}
|
|
22
|
+
{{~this.repository}}{{this.prefix}}{{this.issue}}]({{issueUrlFormat}})
|
|
23
|
+
{{~else}}
|
|
24
|
+
{{~#if this.owner}}
|
|
25
|
+
{{~this.owner}}/
|
|
26
|
+
{{~/if}}
|
|
27
|
+
{{~this.repository}}{{this.prefix}}{{this.issue}}
|
|
28
|
+
{{~/if}}{{/each}}
|
|
29
|
+
{{~/if}}
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{{> header}}
|
|
2
|
+
|
|
3
|
+
{{#if noteGroups}}
|
|
4
|
+
{{#each noteGroups}}
|
|
5
|
+
### 💥 {{title}}
|
|
6
|
+
|
|
7
|
+
{{#each notes}}
|
|
8
|
+
* {{#if commit.scope}}**{{commit.scope}}:** {{/if}}{{text}}
|
|
9
|
+
{{/each}}
|
|
10
|
+
{{/each}}
|
|
11
|
+
{{/if}}
|
|
12
|
+
{{#each commitGroups}}
|
|
13
|
+
|
|
14
|
+
{{#if title}}
|
|
15
|
+
### {{title}}
|
|
16
|
+
|
|
17
|
+
{{/if}}
|
|
18
|
+
{{#each commits}}
|
|
19
|
+
{{> commit root=@root}}
|
|
20
|
+
|
|
21
|
+
{{/each}}
|
|
22
|
+
{{/each}}
|
package/src/writer.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import compareFunc from 'compare-func'
|
|
2
|
+
import { readFile } from 'fs/promises'
|
|
3
|
+
import { resolve } from 'path'
|
|
4
|
+
import { fileURLToPath } from 'url'
|
|
5
|
+
|
|
6
|
+
const dirname = fileURLToPath(new URL('.', import.meta.url))
|
|
7
|
+
|
|
8
|
+
export async function createWriterOpts() {
|
|
9
|
+
const [template, header, commit, footer] = await Promise.all([
|
|
10
|
+
readFile(resolve(dirname, './templates/template.hbs'), 'utf-8'),
|
|
11
|
+
readFile(resolve(dirname, './templates/header.hbs'), 'utf-8'),
|
|
12
|
+
readFile(resolve(dirname, './templates/commit.hbs'), 'utf-8'),
|
|
13
|
+
readFile(resolve(dirname, './templates/footer.hbs'), 'utf-8'),
|
|
14
|
+
])
|
|
15
|
+
const writerOpts = getWriterOpts()
|
|
16
|
+
|
|
17
|
+
writerOpts.mainTemplate = template
|
|
18
|
+
writerOpts.headerPartial = header
|
|
19
|
+
writerOpts.commitPartial = commit
|
|
20
|
+
writerOpts.footerPartial = footer
|
|
21
|
+
|
|
22
|
+
return writerOpts
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function getWriterOpts() {
|
|
26
|
+
return {
|
|
27
|
+
groupBy: 'type',
|
|
28
|
+
commitsSort: ['scope', 'subject', 'header'],
|
|
29
|
+
finalizeContext: (context) => {
|
|
30
|
+
const date = new Date()
|
|
31
|
+
context.date = date.toLocaleString('pt-BR', {
|
|
32
|
+
timeZone: 'America/Sao_Paulo',
|
|
33
|
+
dateStyle: 'short',
|
|
34
|
+
})
|
|
35
|
+
return context
|
|
36
|
+
},
|
|
37
|
+
notesSort: compareFunc,
|
|
38
|
+
}
|
|
39
|
+
}
|