@govbr-ds/release-config 4.4.0 → 4.6.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 +1 -1
- package/src/index.js +87 -19
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -11,29 +11,54 @@ const branches = [
|
|
|
11
11
|
// { name: 'rc', prerelease: true },
|
|
12
12
|
]
|
|
13
13
|
|
|
14
|
+
const types = [
|
|
15
|
+
{ type: 'deprecated', section: '👎 DEPRECIADO' },
|
|
16
|
+
{ type: 'feat', section: '✨ NOVIDADES' },
|
|
17
|
+
{ type: 'removed', section: '🚧 REMOVIDO' },
|
|
18
|
+
{ type: 'docs', section: '📚 DOCUMENTAÇÃO' },
|
|
19
|
+
{ type: 'fix', section: '🐛 CORREÇÕES' },
|
|
20
|
+
{ type: 'ops', section: '🔧 ATIVIDADES OPERACIONAIS' },
|
|
21
|
+
{ type: 'perf', section: '🚀 PERFORMANCE' },
|
|
22
|
+
{ type: 'refactor', section: '🔁 REFATORADO' },
|
|
23
|
+
{ type: 'revert', section: '⏪ REVERTIDO' },
|
|
24
|
+
{ type: 'build', hidden: true },
|
|
25
|
+
{ type: 'chore', hidden: true },
|
|
26
|
+
{ type: 'ci', hidden: true },
|
|
27
|
+
{ type: 'lint', hidden: true },
|
|
28
|
+
{ type: 'test', hidden: true },
|
|
29
|
+
{ type: 'wip', hidden: true },
|
|
30
|
+
{ type: 'site', hidden: true },
|
|
31
|
+
{ type: 'bump', section: '🆙 Bump' },
|
|
32
|
+
]
|
|
33
|
+
|
|
14
34
|
const commitAnalyzer = [
|
|
15
35
|
'@semantic-release/commit-analyzer',
|
|
16
36
|
{
|
|
17
37
|
preset: 'conventionalcommits',
|
|
18
38
|
releaseRules: [
|
|
19
39
|
{ breaking: true, release: 'major' },
|
|
40
|
+
{ scope: 'minor', release: 'minor' },
|
|
41
|
+
{ scope: 'monorepo', release: false },
|
|
42
|
+
{ scope: 'no-release', release: false },
|
|
43
|
+
{ scope: 'patch', release: 'patch' },
|
|
44
|
+
{ scope: 'site', release: false },
|
|
20
45
|
{ type: '*!', release: 'major' },
|
|
21
46
|
{ type: 'build', release: false },
|
|
47
|
+
{ type: 'bump', release: 'minor' },
|
|
22
48
|
{ type: 'chore', release: false },
|
|
23
49
|
{ type: 'ci', release: false },
|
|
24
50
|
{ type: 'deprecated', release: false },
|
|
25
51
|
{ type: 'docs', release: 'patch' },
|
|
26
52
|
{ type: 'feat', release: 'minor' },
|
|
27
53
|
{ type: 'fix', release: 'patch' },
|
|
54
|
+
{ type: 'lint', release: false },
|
|
28
55
|
{ type: 'ops', release: false },
|
|
29
56
|
{ type: 'perf', release: 'patch' },
|
|
30
57
|
{ type: 'refactor', release: 'patch' },
|
|
31
58
|
{ type: 'removed', release: 'minor' },
|
|
32
59
|
{ type: 'revert', release: 'minor' },
|
|
33
|
-
{ type: 'lint', release: false },
|
|
34
60
|
{ type: 'test', release: false },
|
|
35
61
|
{ type: 'wip', release: false },
|
|
36
|
-
{ scope: 'no-release', release: false },
|
|
37
62
|
],
|
|
38
63
|
parserOpts: {
|
|
39
64
|
noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES', 'BREAKING'],
|
|
@@ -47,28 +72,71 @@ const releaseNotesGenerator = [
|
|
|
47
72
|
preset: 'conventionalcommits',
|
|
48
73
|
presetConfig: {
|
|
49
74
|
header: '# CHANGELOG',
|
|
50
|
-
types
|
|
51
|
-
{ type: 'deprecated', section: '👎 DEPRECIADO' },
|
|
52
|
-
{ type: 'feat', section: '✨ NOVIDADES' },
|
|
53
|
-
{ type: 'removed', section: '🚧 REMOVIDO' },
|
|
54
|
-
{ type: 'docs', section: '📚 DOCUMENTAÇÃO' },
|
|
55
|
-
{ type: 'fix', section: '🐛 CORREÇÕES' },
|
|
56
|
-
{ type: 'ops', section: '🔧 ATIVIDADES OPERACIONAIS' },
|
|
57
|
-
{ type: 'perf', section: '🚀 PERFORMANCE' },
|
|
58
|
-
{ type: 'refactor', section: '🔁 REFATORADO' },
|
|
59
|
-
{ type: 'revert', section: '⏪ REVERTIDO' },
|
|
60
|
-
{ type: 'build', hidden: true },
|
|
61
|
-
{ type: 'chore', hidden: true },
|
|
62
|
-
{ type: 'ci', hidden: true },
|
|
63
|
-
{ type: 'lint', hidden: true },
|
|
64
|
-
{ type: 'test', hidden: true },
|
|
65
|
-
{ type: 'wip', hidden: true },
|
|
66
|
-
],
|
|
75
|
+
types,
|
|
67
76
|
},
|
|
68
77
|
parserOpts: {
|
|
69
78
|
noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES', 'BREAKING'],
|
|
70
79
|
},
|
|
71
80
|
writerOpts: {
|
|
81
|
+
transform: (commit, context) => {
|
|
82
|
+
const issues = []
|
|
83
|
+
const newCommit = { ...commit }
|
|
84
|
+
newCommit.notes = commit.notes.map((note) => ({ ...note }))
|
|
85
|
+
newCommit.references = commit.references.map((ref) => ({ ...ref }))
|
|
86
|
+
|
|
87
|
+
newCommit.notes.forEach((note) => {
|
|
88
|
+
note.title = 'BREAKING CHANGES'
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
const typeConfig = types.find((t) => t.type === newCommit.type)
|
|
92
|
+
|
|
93
|
+
if (typeConfig?.section) {
|
|
94
|
+
newCommit.type = typeConfig.section
|
|
95
|
+
} else if (typeConfig?.hidden) {
|
|
96
|
+
return
|
|
97
|
+
} else {
|
|
98
|
+
return
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (newCommit.scope === '*') {
|
|
102
|
+
newCommit.scope = ''
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (typeof newCommit.hash === 'string') {
|
|
106
|
+
newCommit.shortHash = newCommit.hash.substring(0, 7)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (typeof newCommit.subject === 'string') {
|
|
110
|
+
let url = context.repository ? `${context.host}/${context.owner}/${context.repository}` : context.repoUrl
|
|
111
|
+
if (url) {
|
|
112
|
+
url = `${url}/issues/`
|
|
113
|
+
// Issue URLs
|
|
114
|
+
newCommit.subject = newCommit.subject.replace(/#([0-9]+)/g, (_, issue) => {
|
|
115
|
+
issues.push(issue)
|
|
116
|
+
return `[#${issue}](${url}${issue})`
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
if (context.host) {
|
|
120
|
+
// User URLs
|
|
121
|
+
newCommit.subject = newCommit.subject.replace(/\B@([a-z0-9](?:-?[a-z0-9]){0,38})/g, (_, username) => {
|
|
122
|
+
if (username.includes('/')) {
|
|
123
|
+
return `@${username}`
|
|
124
|
+
}
|
|
125
|
+
return `[@${username}](${context.host}/${username})`
|
|
126
|
+
})
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// remove references that already appear in the subject
|
|
131
|
+
newCommit.references = newCommit.references.filter((reference) => {
|
|
132
|
+
if (issues.indexOf(reference.issue) === -1) {
|
|
133
|
+
return true
|
|
134
|
+
}
|
|
135
|
+
return false
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
return newCommit
|
|
139
|
+
},
|
|
72
140
|
groupBy: 'type',
|
|
73
141
|
commitsSort: ['scope', 'subject', 'header'],
|
|
74
142
|
finalizeContext: (context) => {
|