zx-bulk-release 1.20.0 → 1.22.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/.github/workflows/ci.yml +6 -0
- package/CHANGELOG.md +15 -0
- package/package.json +3 -3
- package/src/main/js/analyze.js +1 -6
- package/src/main/js/cli.js +1 -1
- package/src/main/js/contextify.js +18 -0
- package/src/main/js/index.js +4 -1
- package/src/main/js/repo.js +3 -3
- package/src/main/js/tag.js +1 -0
- package/src/main/js/util.js +2 -2
- package/src/test/fixtures/regular-monorepo/.yarn/releases/yarn-4.0.0-rc.14.cjs +779 -0
- package/src/test/fixtures/regular-monorepo/.yarnrc.yml +1 -1
- package/src/test/fixtures/regular-monorepo/package.json +1 -1
- package/src/test/js/integration.test.js +29 -6
- package/src/test/js/util.test.js +17 -2
- package/src/test/fixtures/regular-monorepo/.yarn/releases/yarn-4.0.0-rc.9.cjs +0 -781
package/.github/workflows/ci.yml
CHANGED
|
@@ -27,6 +27,12 @@ jobs:
|
|
|
27
27
|
timeout-minutes: 2
|
|
28
28
|
run: yarn test
|
|
29
29
|
|
|
30
|
+
- name: Push coverage
|
|
31
|
+
if: github.ref == 'refs/heads/master'
|
|
32
|
+
run: |
|
|
33
|
+
npx ggcp lcov.info https://${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}.git/coverage/${{ github.sha }} --cwd=${{ github.workspace }}/coverage --message='chore: push coverage'
|
|
34
|
+
|
|
35
|
+
|
|
30
36
|
test_pr:
|
|
31
37
|
if: github.event_name == 'pull_request'
|
|
32
38
|
name: Test PR (Node v${{ matrix.node-version }}, OS ${{ matrix.os }})
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## [1.22.0](https://github.com/semrel-extra/zx-bulk-release/compare/v1.21.0...v1.22.0) (2022-07-30)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
* feat: introduce pkg context ([b57d4b0](https://github.com/semrel-extra/zx-bulk-release/commit/b57d4b0d9c5bb4501e79c556f64aacfebb83458a))
|
|
5
|
+
|
|
6
|
+
## [1.21.0](https://github.com/semrel-extra/zx-bulk-release/compare/v1.20.1...v1.21.0) (2022-07-30)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
* feat: introduce `debug` flag ([b3e384c](https://github.com/semrel-extra/zx-bulk-release/commit/b3e384c1f32f27b5babf1f7adac7154e5827c1fb))
|
|
10
|
+
|
|
11
|
+
## [1.20.1](https://github.com/semrel-extra/zx-bulk-release/compare/v1.20.0...v1.20.1) (2022-07-28)
|
|
12
|
+
|
|
13
|
+
### Fixes & improvements
|
|
14
|
+
* fix: swap git user.name and user.email values ([8595f1b](https://github.com/semrel-extra/zx-bulk-release/commit/8595f1b67344166a6b7c51e2b62e948f9f2f0dc5))
|
|
15
|
+
|
|
1
16
|
## [1.20.0](https://github.com/semrel-extra/zx-bulk-release/compare/v1.19.3...v1.20.0) (2022-07-20)
|
|
2
17
|
|
|
3
18
|
### Features
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zx-bulk-release",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.0",
|
|
4
4
|
"description": "zx-based alternative for multi-semantic-release",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./src/main/js/index.js",
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
"docs": "mkdir -p docs && cp ./README.md ./docs/README.md"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@semrel-extra/topo": "^1.4.
|
|
14
|
+
"@semrel-extra/topo": "^1.4.3",
|
|
15
15
|
"cosmiconfig": "^7.0.1",
|
|
16
16
|
"zx-extra": "^2.5.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"c8": "^7.12.0",
|
|
20
20
|
"uvu": "^0.5.6",
|
|
21
|
-
"verdaccio": "^5.
|
|
21
|
+
"verdaccio": "^5.14.0"
|
|
22
22
|
},
|
|
23
23
|
"publishConfig": {
|
|
24
24
|
"access": "public"
|
package/src/main/js/analyze.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import {ctx, semver} from 'zx-extra'
|
|
2
|
-
import {getConfig} from './config.js'
|
|
3
|
-
import {getLatest} from './publish.js'
|
|
4
2
|
import {updateDeps} from './deps.js'
|
|
5
3
|
|
|
6
|
-
export const analyze = async (pkg, packages
|
|
7
|
-
pkg.config = await getConfig(pkg.absPath, root.absPath)
|
|
8
|
-
pkg.latest = await getLatest(pkg)
|
|
9
|
-
|
|
4
|
+
export const analyze = async (pkg, packages) => {
|
|
10
5
|
const semanticChanges = await getSemanticChanges(pkg.absPath, pkg.latest.tag?.ref)
|
|
11
6
|
const depsChanges = await updateDeps(pkg, packages)
|
|
12
7
|
const changes = [...semanticChanges, ...depsChanges]
|
package/src/main/js/cli.js
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Inspired by https://docs.github.com/en/actions/learn-github-actions/contexts
|
|
2
|
+
|
|
3
|
+
import {getConfig} from './config.js'
|
|
4
|
+
import {getLatest} from './publish.js'
|
|
5
|
+
import {$} from 'zx-extra'
|
|
6
|
+
|
|
7
|
+
export const contextify = async (pkg, packages, root) => {
|
|
8
|
+
pkg.config = await getConfig(pkg.absPath, root.absPath)
|
|
9
|
+
pkg.latest = await getLatest(pkg)
|
|
10
|
+
pkg.context = {
|
|
11
|
+
git: {
|
|
12
|
+
sha: (await $`git rev-parse HEAD`).toString().trim(),
|
|
13
|
+
root: (await $`git rev-parse --show-toplevel`).toString().trim(),
|
|
14
|
+
},
|
|
15
|
+
env: $.env,
|
|
16
|
+
packages
|
|
17
|
+
}
|
|
18
|
+
}
|
package/src/main/js/index.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import {analyze} from './analyze.js'
|
|
2
2
|
import {publish} from './publish.js'
|
|
3
3
|
import {build} from './build.js'
|
|
4
|
+
import {contextify} from './contextify.js'
|
|
4
5
|
import {topo} from './topo.js'
|
|
5
6
|
import {within, $} from 'zx-extra'
|
|
6
7
|
|
|
7
8
|
export const run = async ({cwd = process.cwd(), env, flags = {}} = {}) => within(async () => {
|
|
8
9
|
console.log('zx-bulk-release')
|
|
9
10
|
$.env = {...process.env, ...env}
|
|
11
|
+
$.verbose = !!(flags.debug || $.env.DEBUG ) || $.verbose
|
|
10
12
|
|
|
11
13
|
try {
|
|
12
14
|
const {packages, queue, root} = await topo({cwd, flags})
|
|
@@ -15,7 +17,8 @@ export const run = async ({cwd = process.cwd(), env, flags = {}} = {}) => within
|
|
|
15
17
|
for (let name of queue) {
|
|
16
18
|
const pkg = packages[name]
|
|
17
19
|
|
|
18
|
-
await
|
|
20
|
+
await contextify(pkg, packages, root)
|
|
21
|
+
await analyze(pkg, packages)
|
|
19
22
|
|
|
20
23
|
if (pkg.changes.length === 0) continue
|
|
21
24
|
|
package/src/main/js/repo.js
CHANGED
|
@@ -35,8 +35,8 @@ export const push = async ({cwd, from, to, branch, origin, msg, ignoreFiles, fil
|
|
|
35
35
|
|
|
36
36
|
$.cwd = _cwd
|
|
37
37
|
|
|
38
|
-
await $`git config user.name ${
|
|
39
|
-
await $`git config user.email ${
|
|
38
|
+
await $`git config user.name ${gitCommitterName}`
|
|
39
|
+
await $`git config user.email ${gitCommitterEmail}`
|
|
40
40
|
await $`git add .`
|
|
41
41
|
try {
|
|
42
42
|
await $`git commit -m ${msg}`
|
|
@@ -58,7 +58,7 @@ export const parseRepo = async (_cwd) => {
|
|
|
58
58
|
const [, , repoHost, repoName] = originUrl.replace(':', '/').replace(/\.git/, '').match(/.+(@|\/\/)([^/]+)\/(.+)$/) || []
|
|
59
59
|
const repoPublicUrl = `https://${repoHost}/${repoName}`
|
|
60
60
|
const repoAuthedUrl = ghToken && ghUser && repoHost && repoName ?
|
|
61
|
-
`https://${ghUser}:${ghToken}@${repoHost}/${repoName}`
|
|
61
|
+
`https://${ghUser}:${ghToken}@${repoHost}/${repoName}.git`
|
|
62
62
|
: originUrl
|
|
63
63
|
|
|
64
64
|
repos[cwd] = {
|
package/src/main/js/tag.js
CHANGED
package/src/main/js/util.js
CHANGED
|
@@ -8,14 +8,14 @@ export const get = (obj, path = '.') => {
|
|
|
8
8
|
let result = obj
|
|
9
9
|
|
|
10
10
|
for (let i = 0, len = chunks.length; i < len && result !== undefined && result !== null; i++) {
|
|
11
|
-
result =
|
|
11
|
+
result = result[chunks[i]]
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
return result
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export const runHook = async (pkg, name) => {
|
|
18
|
-
const cmd = tpl(pkg.config[name], pkg)
|
|
18
|
+
const cmd = tpl(pkg.config[name], {...pkg, ...pkg.context})
|
|
19
19
|
|
|
20
20
|
if (cmd) {
|
|
21
21
|
console.log(`[${pkg.name}] run ${name} '${cmd}'`)
|