zx-bulk-release 1.7.5 → 1.7.8
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 +16 -0
- package/README.md +22 -2
- package/package.json +1 -1
- package/src/main/js/build.js +3 -3
- package/src/main/js/deps.js +1 -1
- package/src/main/js/publish.js +11 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## [1.7.8](https://github.com/semrel-extra/zx-bulk-release/compare/v1.7.7...v1.7.8) (2022-06-26)
|
|
2
|
+
|
|
3
|
+
### Fixes & improvements
|
|
4
|
+
* docs: mention jscutlery/semver and intuit/auto ([36b3da0](https://github.com/semrel-extra/zx-bulk-release/commit/36b3da029958c94e8a2e1a03da162ad3ac89bcac))
|
|
5
|
+
|
|
6
|
+
## [1.7.7](https://github.com/semrel-extra/zx-bulk-release/compare/v1.7.6...v1.7.7) (2022-06-26)
|
|
7
|
+
|
|
8
|
+
### Fixes & improvements
|
|
9
|
+
* docs: describe envs ([de70c03](https://github.com/semrel-extra/zx-bulk-release/commit/de70c03e3e6166cb722a03f8a43ff75614de5941))
|
|
10
|
+
* refactor: enhance `parseRepo` helper ([7545427](https://github.com/semrel-extra/zx-bulk-release/commit/75454271e4fb472884ce80559c1713fca46faeb8))
|
|
11
|
+
|
|
12
|
+
## [1.7.6](https://github.com/semrel-extra/zx-bulk-release/compare/v1.7.5...v1.7.6) (2022-06-25)
|
|
13
|
+
|
|
14
|
+
### Fixes & improvements
|
|
15
|
+
* fix: fix fallback version on cross-update ([d757329](https://github.com/semrel-extra/zx-bulk-release/commit/d7573299793d03b334f47640e61c7efa2d03e911))
|
|
16
|
+
|
|
1
17
|
## [1.7.5](https://github.com/semrel-extra/zx-bulk-release/compare/v1.7.4...v1.7.5) (2022-06-25)
|
|
2
18
|
|
|
3
19
|
### Fixes & improvements
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
```shell
|
|
13
|
-
GH_TOKEN=
|
|
13
|
+
GH_TOKEN=ghtoken GH_USER=username NPM_TOKEN=npmtoken npx zx-bulk-release [opts]
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
## Roadmap
|
|
@@ -18,7 +18,7 @@ GH_TOKEN=foo NPM_TOKEN=bar npx zx-bulk-release [opts]
|
|
|
18
18
|
* [x] Predictable [toposort](https://githib.com/semrel-extra/topo)-driven flow.
|
|
19
19
|
* [x] No blocking (no release commits).
|
|
20
20
|
* [ ] Changelogs, docs, bundles go to: release assets and/or meta branch.
|
|
21
|
-
* [
|
|
21
|
+
* [x] No extra builds. The required deps are fetched from the pkg registry.
|
|
22
22
|
|
|
23
23
|
## Tags
|
|
24
24
|
[Lerna](https://github.com/lerna/lerna) tags (like `@pkg/name@v1.0.0-beta.0`) are suitable for monorepos, but they don’t follow [semver spec](https://semver.org/). Therefore, we propose another contract:
|
|
@@ -43,6 +43,24 @@ const flags = {dryRun: true}
|
|
|
43
43
|
await run({cwd, flags, env})
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
+
## env vars
|
|
47
|
+
```js
|
|
48
|
+
export const parseEnv = (env = process.env) => {
|
|
49
|
+
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
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
ghUser: GH_USER || GH_USERNAME || GITHUB_USER || GITHUB_USERNAME,
|
|
53
|
+
ghToken: GH_TOKEN || GITHUB_TOKEN,
|
|
54
|
+
npmToken: NPM_TOKEN,
|
|
55
|
+
// npmConfig suppresses npmToken
|
|
56
|
+
npmConfig: NPMRC || NPM_USERCONFIG || NPM_CONFIG_USERCONFIG,
|
|
57
|
+
npmRegistry: NPM_REGISTRY || 'https://registry.npmjs.org',
|
|
58
|
+
gitCommitterName: GIT_COMMITTER_NAME || 'Semrel Extra Bot',
|
|
59
|
+
gitCommitterEmail: GIT_COMMITTER_EMAIL || 'semrel-extra-bot@hotmail.com',
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
46
64
|
## References
|
|
47
65
|
* [semrel-extra/zx-semrel](https://github.com/semrel-extra/zx-semrel)
|
|
48
66
|
* [dhoulb/multi-semantic-release](https://github.com/dhoulb/multi-semantic-release)
|
|
@@ -50,6 +68,8 @@ await run({cwd, flags, env})
|
|
|
50
68
|
* [tophat/monodeploy](https://github.com/tophat/monodeploy)
|
|
51
69
|
* [conventional-changelog/releaser-tools](https://github.com/conventional-changelog/releaser-tools)
|
|
52
70
|
* [pmowrer/semantic-release-monorepo](https://github.com/pmowrer/semantic-release-monorepo)
|
|
71
|
+
* [jscutlery/semver](https://github.com/jscutlery/semver)
|
|
72
|
+
* [intuit/auto](https://github.com/intuit/auto)
|
|
53
73
|
|
|
54
74
|
## License
|
|
55
75
|
[MIT](./LICENSE)
|
package/package.json
CHANGED
package/src/main/js/build.js
CHANGED
|
@@ -36,9 +36,9 @@ const fetchPkg = (pkg) => ctx(async ($) => {
|
|
|
36
36
|
const cwd = pkg.absPath
|
|
37
37
|
const {npmRegistry, npmToken, npmConfig} = parseEnv($.env)
|
|
38
38
|
const temp = tempy.temporaryDirectory()
|
|
39
|
-
const token =
|
|
40
|
-
?
|
|
41
|
-
:
|
|
39
|
+
const token = npmConfig
|
|
40
|
+
? getAuthToken(npmRegistry, ini.parse(await fs.readFile(npmConfig, 'utf8')))
|
|
41
|
+
: npmToken
|
|
42
42
|
const auth = `Authorization: Bearer ${token}`
|
|
43
43
|
const tarball = getTarballUrl(npmRegistry, pkg.name, pkg.version)
|
|
44
44
|
|
package/src/main/js/deps.js
CHANGED
|
@@ -25,7 +25,7 @@ export const updateDeps = async (pkg, packages) => {
|
|
|
25
25
|
const actual = dep?.version
|
|
26
26
|
const next = resolveVersion(version, actual, prev)
|
|
27
27
|
|
|
28
|
-
pkg[scope] = {...pkg[scope], [name]: next ||
|
|
28
|
+
pkg[scope] = {...pkg[scope], [name]: next || prev}
|
|
29
29
|
|
|
30
30
|
if (!next) return
|
|
31
31
|
|
package/src/main/js/publish.js
CHANGED
|
@@ -98,23 +98,12 @@ ${commits.join('\n')}`).join('\n')
|
|
|
98
98
|
await $`curl -u ${ghUser}:${ghToken} -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${repoName}/releases -d ${releaseData}`
|
|
99
99
|
})
|
|
100
100
|
|
|
101
|
-
export const getOrigin = (cwd) => ctx(async ($) => {
|
|
102
|
-
$.cwd = cwd
|
|
103
|
-
const {ghToken, ghUser} = parseEnv($.env)
|
|
104
|
-
const originUrl = (await $`git config --get remote.origin.url`).toString().trim()
|
|
105
|
-
const [,,repoHost, repoName] = originUrl.replace(':', '/').replace(/\.git/, '').match(/.+(@|\/\/)([^/]+)\/(.+)$/) || []
|
|
106
|
-
|
|
107
|
-
return ghToken && ghUser && repoHost && repoName?
|
|
108
|
-
`https://${ghUser}:${ghToken}@${repoHost}/${repoName}`
|
|
109
|
-
: originUrl
|
|
110
|
-
})
|
|
111
|
-
|
|
112
101
|
const branches = {}
|
|
113
102
|
export const fetch = async ({cwd: _cwd, branch, origin: _origin}) => ctx(async ($) => {
|
|
114
103
|
let cwd = branches[branch]
|
|
115
104
|
if (cwd) return cwd
|
|
116
105
|
|
|
117
|
-
const origin = _origin || await
|
|
106
|
+
const origin = _origin || (await parseRepo(_cwd)).repoAuthedUrl
|
|
118
107
|
|
|
119
108
|
cwd = tempy.temporaryDirectory()
|
|
120
109
|
$.cwd = cwd
|
|
@@ -189,15 +178,21 @@ export const parseEnv = (env = process.env) => {
|
|
|
189
178
|
}
|
|
190
179
|
}
|
|
191
180
|
|
|
192
|
-
export const parseRepo = (cwd
|
|
181
|
+
export const parseRepo = (cwd) => ctx(async ($) => {
|
|
193
182
|
$.cwd = cwd
|
|
194
|
-
const
|
|
183
|
+
const {ghToken, ghUser} = parseEnv($.env)
|
|
184
|
+
const originUrl = (await $`git config --get remote.origin.url`).toString().trim()
|
|
195
185
|
const [,,repoHost, repoName] = originUrl.replace(':', '/').replace(/\.git/, '').match(/.+(@|\/\/)([^/]+)\/(.+)$/) || []
|
|
196
|
-
|
|
197
186
|
const repoPublicUrl = `https://${repoHost}/${repoName}`
|
|
187
|
+
const repoAuthedUrl = ghToken && ghUser && repoHost && repoName?
|
|
188
|
+
`https://${ghUser}:${ghToken}@${repoHost}/${repoName}`
|
|
189
|
+
: originUrl
|
|
190
|
+
|
|
198
191
|
return {
|
|
199
192
|
repoName,
|
|
200
193
|
repoHost,
|
|
201
|
-
repoPublicUrl
|
|
194
|
+
repoPublicUrl,
|
|
195
|
+
repoAuthedUrl,
|
|
196
|
+
originUrl,
|
|
202
197
|
}
|
|
203
198
|
})
|