zx-bulk-release 2.6.0 → 2.7.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/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## [2.7.0](https://github.com/semrel-extra/zx-bulk-release/compare/v2.6.1...v2.7.0) (2023-04-30)
2
+
3
+ ### Fixes & improvements
4
+ * fix: fix `latestVersion` fallback value ([9d25129](https://github.com/semrel-extra/zx-bulk-release/commit/9d25129dcf41c74cdd2d0670e86d20a32f7734c0))
5
+
6
+ ### Features
7
+ * feat: let `releaseRules` be configured via opts ([4ae4606](https://github.com/semrel-extra/zx-bulk-release/commit/4ae4606678d13cf619e36861ce889e4e73c8a370))
8
+
9
+ ## [2.6.1](https://github.com/semrel-extra/zx-bulk-release/compare/v2.6.0...v2.6.1) (2023-04-21)
10
+
11
+ ### Fixes & improvements
12
+ * docs: readme struct edits, mention `wget` and `git` as requirements ([2f76f12](https://github.com/semrel-extra/zx-bulk-release/commit/2f76f12b142a700dd53045fc4d268d6d8e64b721))
13
+
1
14
  ## [2.6.0](https://github.com/semrel-extra/zx-bulk-release/compare/v2.5.3...v2.6.0) (2023-04-21)
2
15
 
3
16
  ### Features
package/README.md CHANGED
@@ -25,6 +25,9 @@
25
25
  * macOS / linux
26
26
  * Node.js >= 16.0.0
27
27
  * npm >=7 / yarn >= 3
28
+ * wget
29
+ * tar
30
+ * git
28
31
 
29
32
  ## Usage
30
33
  ### Install
@@ -63,23 +66,9 @@ await run({
63
66
  })
64
67
  ```
65
68
 
66
- ### ENV
67
- ```ts
68
- export const parseEnv = ({GH_USER, GH_USERNAME, GITHUB_USER, GITHUB_USERNAME, GH_TOKEN, GITHUB_TOKEN, NPM_TOKEN, NPM_REGISTRY, NPMRC, NPM_USERCONFIG, NPM_CONFIG_USERCONFIG, NPM_PROVENANCE, GIT_COMMITTER_NAME, GIT_COMMITTER_EMAIL} = process.env) =>
69
- ({
70
- ghUser: GH_USER || GH_USERNAME || GITHUB_USER || GITHUB_USERNAME,
71
- ghToken: GH_TOKEN || GITHUB_TOKEN,
72
- npmConfig: NPMRC || NPM_USERCONFIG || NPM_CONFIG_USERCONFIG,
73
- npmToken: NPM_TOKEN,
74
- npmProvenance: NPM_PROVENANCE,
75
- npmRegistry: NPM_REGISTRY || 'https://registry.npmjs.org',
76
- gitCommitterName: GIT_COMMITTER_NAME || 'Semrel Extra Bot',
77
- gitCommitterEmail: GIT_COMMITTER_EMAIL || 'semrel-extra-bot@hotmail.com',
78
- })
79
- ```
80
-
81
- ### Config
82
- Any [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) compliant format: `.releaserc`, `.release.json`, `.release.yaml`, etc.
69
+ ## Config
70
+ ### cosmiconfig
71
+ Any [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) compliant format: `.releaserc`, `.release.json`, `.release.yaml`, etc in the package root or in the repo root dir.
83
72
  ```json
84
73
  {
85
74
  "cmd": "yarn && yarn build && yarn test",
@@ -89,51 +78,29 @@ Any [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) compliant format
89
78
  }
90
79
  ```
91
80
 
92
- ### Demo
93
- * [demo-zx-bulk-release](https://github.com/semrel-extra/demo-zx-bulk-release)
94
- * [qiwi/pijma](https://github.com/qiwi/pijma)
95
-
96
- ### Output
97
-
98
- [Compact and clear logs](https://github.com/semrel-extra/demo-zx-bulk-release/runs/7090161341?check_suite_focus=true#step:6:1)
81
+ ### env vars
82
+ ```js
83
+ export const parseEnv = (env = process.env) => {
84
+ const {GH_USER, GH_USERNAME, GITHUB_USER, GITHUB_USERNAME, GH_TOKEN, GITHUB_TOKEN, NPM_TOKEN, NPM_REGISTRY, NPMRC, NPM_USERCONFIG, NPM_CONFIG_USERCONFIG, NPM_PROVENANCE, GIT_COMMITTER_NAME, GIT_COMMITTER_EMAIL} = env
99
85
 
100
- ```shell
101
- Run npm_config_yes=true npx zx-bulk-release
102
- zx-bulk-release
103
- [@semrel-extra/zxbr-test-a] semantic changes [
104
- {
105
- group: 'Fixes & improvements',
106
- releaseType: 'patch',
107
- change: 'fix(a): random',
108
- subj: 'fix(a): random',
109
- body: '',
110
- short: '6ff25bd',
111
- hash: '6ff25bd421755b929ef2b58f35c727670fd93849'
112
- }
113
- ]
114
- [@semrel-extra/zxbr-test-a] run cmd 'yarn && yarn build && yarn test'
115
- [@semrel-extra/zxbr-test-a] push release tag 2022.6.27-semrel-extra.zxbr-test-a.1.8.1-f0
116
- [@semrel-extra/zxbr-test-a] push artifact to branch 'meta'
117
- [@semrel-extra/zxbr-test-a] push changelog
118
- [@semrel-extra/zxbr-test-a] publish npm package @semrel-extra/zxbr-test-a 1.8.1 to https://registry.npmjs.org
119
- [@semrel-extra/zxbr-test-a] create gh release
120
- [@semrel-extra/zxbr-test-b] semantic changes [
121
- {
122
- group: 'Dependencies',
123
- releaseType: 'patch',
124
- change: 'perf',
125
- subj: 'perf: @semrel-extra/zxbr-test-a updated to 1.8.1'
86
+ return {
87
+ ghUser: GH_USER || GH_USERNAME || GITHUB_USER || GITHUB_USERNAME,
88
+ ghToken: GH_TOKEN || GITHUB_TOKEN,
89
+ npmToken: NPM_TOKEN,
90
+ // npmConfig suppresses npmToken
91
+ npmConfig: NPMRC || NPM_USERCONFIG || NPM_CONFIG_USERCONFIG,
92
+ npmRegistry: NPM_REGISTRY || 'https://registry.npmjs.org',
93
+ npmProvenance: NPM_PROVENANCE,
94
+ gitCommitterName: GIT_COMMITTER_NAME || 'Semrel Extra Bot',
95
+ gitCommitterEmail: GIT_COMMITTER_EMAIL || 'semrel-extra-bot@hotmail.com',
126
96
  }
127
- ]
128
- [@semrel-extra/zxbr-test-b] run cmd 'yarn && yarn build && yarn test'
129
- [@semrel-extra/zxbr-test-b] push release tag 2022.6.27-semrel-extra.zxbr-test-b.1.3.5-f0
130
- [@semrel-extra/zxbr-test-b] push artifact to branch 'meta'
131
- [@semrel-extra/zxbr-test-b] push changelog
132
- [@semrel-extra/zxbr-test-b] publish npm package @semrel-extra/zxbr-test-b 1.3.5 to https://registry.npmjs.org
133
- [@semrel-extra/zxbr-test-b] create gh release
134
- [@semrel-extra/zxbr-test-d] semantic changes [
97
+ }
135
98
  ```
136
99
 
100
+ ## Demo
101
+ * [demo-zx-bulk-release](https://github.com/semrel-extra/demo-zx-bulk-release)
102
+ * [qiwi/pijma](https://github.com/qiwi/pijma)
103
+
137
104
  ## Implementation notes
138
105
  ### Flow
139
106
  ```js
@@ -184,6 +151,15 @@ export const analyze = async (pkg, packages, root) => {
184
151
  }
185
152
  ```
186
153
 
154
+ Set `config.releaseRules` to override the default rules preset:
155
+ ```ts
156
+ [
157
+ {group: 'Features', releaseType: 'minor', prefixes: ['feat']},
158
+ {group: 'Fixes & improvements', releaseType: 'patch', prefixes: ['fix', 'perf', 'refactor', 'docs', 'patch']},
159
+ {group: 'BREAKING CHANGES', releaseType: 'major', keywords: ['BREAKING CHANGE', 'BREAKING CHANGES']},
160
+ ]
161
+ ```
162
+
187
163
  ### `build`
188
164
  Applies `config.cmd` to build pkg assets: bundles, docs, etc.
189
165
  ```js
@@ -223,25 +199,6 @@ Note, [npm-package-name charset](https://www.npmjs.com/package/validate-npm-pack
223
199
  // date name ver b64 format
224
200
  ```
225
201
 
226
- ### env vars
227
-
228
- ```js
229
- export const parseEnv = (env = process.env) => {
230
- const {GH_USER, GH_USERNAME, GITHUB_USER, GITHUB_USERNAME, GH_TOKEN, GITHUB_TOKEN, NPM_TOKEN, NPM_REGISTRY, NPMRC, NPM_USERCONFIG, NPM_CONFIG_USERCONFIG, GIT_COMMITTER_NAME, GIT_COMMITTER_EMAIL} = env
231
-
232
- return {
233
- ghUser: GH_USER || GH_USERNAME || GITHUB_USER || GITHUB_USERNAME,
234
- ghToken: GH_TOKEN || GITHUB_TOKEN,
235
- npmToken: NPM_TOKEN,
236
- // npmConfig suppresses npmToken
237
- npmConfig: NPMRC || NPM_USERCONFIG || NPM_CONFIG_USERCONFIG,
238
- npmRegistry: NPM_REGISTRY || 'https://registry.npmjs.org',
239
- gitCommitterName: GIT_COMMITTER_NAME || 'Semrel Extra Bot',
240
- gitCommitterEmail: GIT_COMMITTER_EMAIL || 'semrel-extra-bot@hotmail.com',
241
- }
242
- }
243
- ```
244
-
245
202
  ### Meta
246
203
 
247
204
  Each release stores its result into the `meta` branch.
@@ -305,6 +262,46 @@ Release process state is reported to the console and to a file if `--report` fla
305
262
  }
306
263
  ```
307
264
 
265
+ ### Output
266
+ [Compact and clear logs](https://github.com/semrel-extra/demo-zx-bulk-release/runs/7090161341?check_suite_focus=true#step:6:1)
267
+
268
+ ```shell
269
+ Run npm_config_yes=true npx zx-bulk-release
270
+ zx-bulk-release
271
+ [@semrel-extra/zxbr-test-a] semantic changes [
272
+ {
273
+ group: 'Fixes & improvements',
274
+ releaseType: 'patch',
275
+ change: 'fix(a): random',
276
+ subj: 'fix(a): random',
277
+ body: '',
278
+ short: '6ff25bd',
279
+ hash: '6ff25bd421755b929ef2b58f35c727670fd93849'
280
+ }
281
+ ]
282
+ [@semrel-extra/zxbr-test-a] run cmd 'yarn && yarn build && yarn test'
283
+ [@semrel-extra/zxbr-test-a] push release tag 2022.6.27-semrel-extra.zxbr-test-a.1.8.1-f0
284
+ [@semrel-extra/zxbr-test-a] push artifact to branch 'meta'
285
+ [@semrel-extra/zxbr-test-a] push changelog
286
+ [@semrel-extra/zxbr-test-a] publish npm package @semrel-extra/zxbr-test-a 1.8.1 to https://registry.npmjs.org
287
+ [@semrel-extra/zxbr-test-a] create gh release
288
+ [@semrel-extra/zxbr-test-b] semantic changes [
289
+ {
290
+ group: 'Dependencies',
291
+ releaseType: 'patch',
292
+ change: 'perf',
293
+ subj: 'perf: @semrel-extra/zxbr-test-a updated to 1.8.1'
294
+ }
295
+ ]
296
+ [@semrel-extra/zxbr-test-b] run cmd 'yarn && yarn build && yarn test'
297
+ [@semrel-extra/zxbr-test-b] push release tag 2022.6.27-semrel-extra.zxbr-test-b.1.3.5-f0
298
+ [@semrel-extra/zxbr-test-b] push artifact to branch 'meta'
299
+ [@semrel-extra/zxbr-test-b] push changelog
300
+ [@semrel-extra/zxbr-test-b] publish npm package @semrel-extra/zxbr-test-b 1.3.5 to https://registry.npmjs.org
301
+ [@semrel-extra/zxbr-test-b] create gh release
302
+ [@semrel-extra/zxbr-test-d] semantic changes [
303
+ ```
304
+
308
305
  ## References
309
306
  * [semrel-extra/zx-semrel](https://github.com/semrel-extra/zx-semrel)
310
307
  * [dhoulb/multi-semantic-release](https://github.com/dhoulb/multi-semantic-release)
@@ -323,6 +320,7 @@ Release process state is reported to the console and to a file if `--report` fla
323
320
  * [moonrepo/moon](https://github.com/moonrepo/moon)
324
321
  * [ojkelly/yarn.build](https://github.com/ojkelly/yarn.build)
325
322
  * [antfu/bumpp](https://github.com/antfu/bumpp)
323
+ * [googleapis/release-please](https://github.com/googleapis/release-please)
326
324
 
327
325
  ## License
328
326
  [MIT](./LICENSE)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zx-bulk-release",
3
3
  "alias": "bulk-release",
4
- "version": "2.6.0",
4
+ "version": "2.7.0",
5
5
  "description": "zx-based alternative for multi-semantic-release",
6
6
  "type": "module",
7
7
  "exports": {
@@ -31,7 +31,7 @@
31
31
  "devDependencies": {
32
32
  "c8": "^7.13.0",
33
33
  "uvu": "^0.5.6",
34
- "verdaccio": "^5.23.2"
34
+ "verdaccio": "^5.24.1"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"
@@ -5,12 +5,12 @@ import {log} from './log.js'
5
5
  import {getCommits} from './git.js'
6
6
 
7
7
  export const analyze = async (pkg) => {
8
- const semanticChanges = await getSemanticChanges(pkg.absPath, pkg.latest.tag?.ref)
8
+ const semanticChanges = await getSemanticChanges(pkg.absPath, pkg.latest.tag?.ref, undefined, pkg.config.releaseRules)
9
9
  const depsChanges = await updateDeps(pkg)
10
10
  const changes = [...semanticChanges, ...depsChanges]
11
11
  const releaseType = getNextReleaseType(changes)
12
12
  const pre = pkg.context.flags.snapshot ? `-snap.${pkg.context.git.sha.slice(0, 7)}` : undefined
13
- const latestVersion = pkg.latest.tag?.version || pkg.latest.meta?.versio
13
+ const latestVersion = pkg.latest.tag?.version || pkg.latest.meta?.version
14
14
 
15
15
  pkg.changes = changes
16
16
  pkg.releaseType = releaseType
@@ -34,15 +34,15 @@ export const semanticRules = [
34
34
  {group: 'BREAKING CHANGES', releaseType: 'major', keywords: ['BREAKING CHANGE', 'BREAKING CHANGES']},
35
35
  ]
36
36
 
37
- export const getSemanticChanges = async (cwd, from, to) => {
37
+ export const getSemanticChanges = async (cwd, from, to, rules = semanticRules) => {
38
38
  const commits = await getCommits(cwd, from, to)
39
39
 
40
- return analyzeCommits(commits)
40
+ return analyzeCommits(commits, rules)
41
41
  }
42
42
 
43
- export const analyzeCommits = (commits) =>
43
+ export const analyzeCommits = (commits, rules) =>
44
44
  commits.reduce((acc, {subj, body, short, hash}) => {
45
- semanticRules.forEach(({group, releaseType, prefixes, keywords}) => {
45
+ rules.forEach(({group, releaseType, prefixes, keywords}) => {
46
46
  const prefixMatcher = prefixes && new RegExp(`^(${prefixes.join('|')})(\\([a-z0-9\\-_,]+\\))?:\\s.+$`)
47
47
  const keywordsMatcher = keywords && new RegExp(`(${keywords.join('|')}):\\s(.+)`)
48
48
  const change = subj.match(prefixMatcher)?.[0] || body.match(keywordsMatcher)?.[2]
@@ -31,6 +31,7 @@ export const getPkgConfig = async (...cwds) =>
31
31
  export const normalizePkgConfig = (config, env) => ({
32
32
  ...parseEnv(env),
33
33
  ...config,
34
+ releaseRules: config.releaseRules || config.semanticRules,
34
35
  npmFetch: config.npmFetch || config.fetch || config.fetchPkg,
35
36
  buildCmd: config.buildCmd || config.cmd,
36
37
  get ghBasicAuth() {