@govbr-ds/release-config 2.1.1 → 2.2.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 (2) hide show
  1. package/package.json +14 -10
  2. package/shared.config.js +58 -19
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@govbr-ds/release-config",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "description": "Configuração compartilhada do semantic-release para projetos do GovBR-DS no gitlab",
5
5
  "keywords": [
6
6
  "gitlab",
@@ -25,11 +25,14 @@
25
25
  ],
26
26
  "scripts": {
27
27
  "commit": "git-cz",
28
- "md": "markdownlint **/*.{md,mdx} --fix",
29
- "prepare": "husky install"
28
+ "lint:md": "markdownlint --fix **/*.md -d -c .markdownlint.yml",
29
+ "prepare": "chmod +x ./node_modules/husky/lib/bin.js && husky install"
30
30
  },
31
31
  "lint-staged": {
32
- "*.{md,mdx}": "markdownlint --fix"
32
+ "*.md": [
33
+ "markdownlint -d -c .markdownlint.yml --fix **/*.md",
34
+ "prettier --write"
35
+ ]
33
36
  },
34
37
  "config": {
35
38
  "commitizen": {
@@ -37,19 +40,20 @@
37
40
  }
38
41
  },
39
42
  "dependencies": {
40
- "@govbr-ds/release-config": "^2.1.0",
43
+ "@govbr-ds/release-config": "^2.1.2",
41
44
  "@semantic-release/changelog": "^6.0.3",
42
45
  "@semantic-release/git": "^10.0.1",
43
- "@semantic-release/gitlab": "^12.0.1",
44
- "conventional-changelog-conventionalcommits": "^5.0.0",
45
- "semantic-release": "^21.0.1"
46
+ "@semantic-release/gitlab": "^12.0.4",
47
+ "conventional-changelog-conventionalcommits": "^6.1.0",
48
+ "semantic-release": "^21.0.7"
46
49
  },
47
50
  "devDependencies": {
48
51
  "@govbr-ds/commit-config": "latest",
49
52
  "git-pull-run": "^1.4.0",
50
53
  "husky": "^8.0.3",
51
- "lint-staged": "^13.2.1",
52
- "markdownlint-cli": "^0.33.0"
54
+ "lint-staged": "^13.2.3",
55
+ "markdownlint-cli": "^0.35.0",
56
+ "prettier": "^3.0.1"
53
57
  },
54
58
  "engines": {
55
59
  "node": ">=18"
package/shared.config.js CHANGED
@@ -36,10 +36,6 @@ module.exports = {
36
36
  prerelease: 'alpha',
37
37
  },
38
38
  ],
39
- /**
40
- * As configurações de cada plugin não podem ser sobrescritas.
41
- * Devem ser usadas por inteiro.
42
- */
43
39
  plugins: {
44
40
  commitAnalyzer: [
45
41
  '@semantic-release/commit-analyzer',
@@ -76,18 +72,17 @@ module.exports = {
76
72
  preset: 'conventionalcommits',
77
73
  presetConfig: {
78
74
  header: '# CHANGELOG',
79
- // O release notes/changelog vai ser gerado nessa ordem
80
75
  types: [
81
- { type: 'breaking', section: ':boom: Breaking Changes' },
82
- { type: 'deprecated', section: ':wastebasket: Depreciado' },
83
- { type: 'feat', section: ':sparkles: Novidades' },
84
- { type: 'removed', section: ':fire: Removido' },
85
- { type: 'docs', section: ':memo: Documentação' },
86
- { type: 'fix', section: ':bug: Correções' },
87
- { type: 'ops', section: ':technologist: Atividades Operacionais' },
88
- { type: 'perf', section: ':zap: Performance' },
89
- { type: 'refactor', section: ':recycle: Refatorado' },
90
- { type: 'revert', section: ':rewind: Revertido' },
76
+ { type: 'breaking', section: '💥 BREAKING CHANGES' },
77
+ { type: 'deprecated', section: '👎 DEPRECIADO' },
78
+ { type: 'feat', section: '✨ NOVIDADES' },
79
+ { type: 'removed', section: '🚧 REMOVIDO' },
80
+ { type: 'docs', section: '📚 DOCUMENTAÇÃO' },
81
+ { type: 'fix', section: '🪲 CORREÇÕES' },
82
+ { type: 'ops', section: '🔧 ATIVIDADES OPERACIONAIS' },
83
+ { type: 'perf', section: '🚀 PERFORMANCE' },
84
+ { type: 'refactor', section: '🔁 REFATORADO' },
85
+ { type: 'revert', section: '⏪ REVERTIDO' },
91
86
  { type: 'build', hidden: true },
92
87
  { type: 'chore', hidden: true },
93
88
  { type: 'ci', hidden: true },
@@ -101,6 +96,50 @@ module.exports = {
101
96
  },
102
97
  writerOpts: {
103
98
  commitsSort: ['subject', 'scope'],
99
+ generateNotes: (commits, context) => {
100
+ const breakingChangesType = context.options.presetConfig.types.find(
101
+ (type) => type.type === 'breaking'
102
+ )
103
+
104
+ if (!breakingChangesType) {
105
+ return ''
106
+ }
107
+
108
+ const breakingChangesCommits = commits.filter((commit) =>
109
+ commit.notes?.some((note) =>
110
+ context.options.parserOpts.noteKeywords.some((keyword) =>
111
+ note.title.includes(keyword)
112
+ )
113
+ )
114
+ )
115
+
116
+ if (breakingChangesCommits.length === 0) {
117
+ return ''
118
+ }
119
+
120
+ const breakingChangesSections = [
121
+ `## ${context.nextRelease.version} (${context.date})\n`,
122
+ `### ${breakingChangesType.section}\n`,
123
+ ]
124
+
125
+ for (const commit of breakingChangesCommits) {
126
+ const scope = commit.scope ? `**${commit.scope}**: ` : ''
127
+ const message = `${scope}${commit.header}`
128
+ breakingChangesSections.push(`- ${message}`)
129
+ if (
130
+ commit.notes?.some((note) =>
131
+ context.options.parserOpts.noteKeywords.some((keyword) =>
132
+ note.title.includes(keyword)
133
+ )
134
+ ) &&
135
+ commit.body
136
+ ) {
137
+ breakingChangesSections.push(` ${commit.body}`)
138
+ }
139
+ }
140
+
141
+ return breakingChangesSections.join('\n')
142
+ },
104
143
  finalizeContext: (context) => {
105
144
  const date = new Date()
106
145
  context.date = date.toLocaleString('pt-BR', {
@@ -121,8 +160,7 @@ module.exports = {
121
160
  gitlab: [
122
161
  '@semantic-release/gitlab',
123
162
  {
124
- successComment:
125
- ':tada: Essa issue foi resolvida 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})',
163
+ successComment: ':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})',
126
164
  },
127
165
  ],
128
166
  npm: ['@semantic-release/npm'],
@@ -130,9 +168,10 @@ module.exports = {
130
168
  '@semantic-release/git',
131
169
  {
132
170
  assets: ['package.json', 'CHANGELOG.md'],
133
- message:
134
- 'chore(release): ${nextRelease.version} [skip ci] \n\n${nextRelease.notes} \n\nEsse commit foi gerado automaticamente durante o processo de release',
171
+ message: 'chore(release): ${nextRelease.version} [skip ci] \n\n${nextRelease.notes} \n\nCommit gerado automaticamente durante o processo de release',
135
172
  },
136
173
  ],
137
174
  },
138
175
  }
176
+
177
+