zx-bulk-release 1.19.0 → 1.19.3
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 +15 -0
- package/package.json +2 -2
- package/src/main/js/config.js +3 -3
- package/src/main/js/deps.js +15 -10
- package/src/main/js/publish.js +3 -3
- package/src/test/js/deps.test.js +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## [1.19.3](https://github.com/semrel-extra/zx-bulk-release/compare/v1.19.2...v1.19.3) (2022-07-20)
|
|
2
|
+
|
|
3
|
+
### Fixes & improvements
|
|
4
|
+
* perf: use PAT instead of basic auth for api.github.com calls ([c153615](https://github.com/semrel-extra/zx-bulk-release/commit/c153615b145f934cd715dc1523bfa99070f1e60e))
|
|
5
|
+
|
|
6
|
+
## [1.19.2](https://github.com/semrel-extra/zx-bulk-release/compare/v1.19.1...v1.19.2) (2022-07-19)
|
|
7
|
+
|
|
8
|
+
### Fixes & improvements
|
|
9
|
+
* fix: subs ws refs in manifests ([b5cd3b8](https://github.com/semrel-extra/zx-bulk-release/commit/b5cd3b8368500f74cecc9d7e065aaeff01e70dfe))
|
|
10
|
+
|
|
11
|
+
## [1.19.1](https://github.com/semrel-extra/zx-bulk-release/compare/v1.19.0...v1.19.1) (2022-07-19)
|
|
12
|
+
|
|
13
|
+
### Fixes & improvements
|
|
14
|
+
* fix: fix workspace refs substitution ([9fed233](https://github.com/semrel-extra/zx-bulk-release/commit/9fed23332988a2dc5a08b1b4854a03998c17a6a4))
|
|
15
|
+
|
|
1
16
|
## [1.19.0](https://github.com/semrel-extra/zx-bulk-release/compare/v1.18.0...v1.19.0) (2022-07-18)
|
|
2
17
|
|
|
3
18
|
### Features
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zx-bulk-release",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.3",
|
|
4
4
|
"description": "zx-based alternative for multi-semantic-release",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./src/main/js/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"zx-extra": "^2.5.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"c8": "^7.
|
|
19
|
+
"c8": "^7.12.0",
|
|
20
20
|
"uvu": "^0.5.6",
|
|
21
21
|
"verdaccio": "^5.13.3"
|
|
22
22
|
},
|
package/src/main/js/config.js
CHANGED
|
@@ -29,8 +29,8 @@ export const getConfig = async (...cwds) =>
|
|
|
29
29
|
|
|
30
30
|
export const normalizeConfig = config => ({
|
|
31
31
|
...config,
|
|
32
|
-
npmFetch:
|
|
33
|
-
buildCmd:
|
|
32
|
+
npmFetch: config.npmFetch || config.fetch || config.fetchPkg,
|
|
33
|
+
buildCmd: config.cmd || (config.buildCmd ? `${config.buildCmd}${config.testCmd ? ` && ${config.testCmd}` : ''}` : '')
|
|
34
34
|
})
|
|
35
35
|
|
|
36
36
|
export const parseEnv = (env = process.env) => {
|
|
@@ -47,5 +47,5 @@ export const parseEnv = (env = process.env) => {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
const camelize = s => s.replace(/-./g, x=>x[1].toUpperCase())
|
|
50
|
+
const camelize = s => s.replace(/-./g, x => x[1].toUpperCase())
|
|
51
51
|
export const normalizeFlags = (flags = {}) => Object.entries(flags).reduce((acc, [k, v]) => ({...acc, [camelize(k)]: v}), {})
|
package/src/main/js/deps.js
CHANGED
|
@@ -23,14 +23,13 @@ export const updateDeps = async (pkg, packages) => {
|
|
|
23
23
|
await traverseDeps(pkg, packages, async (_, {name, version, deps, scope, pkg: dep}) => {
|
|
24
24
|
const prev = pkg.latest.meta?.[scope]?.[name]
|
|
25
25
|
const actual = dep?.version
|
|
26
|
-
const next =
|
|
26
|
+
const next = resolveNextVersion(version, actual, prev)
|
|
27
|
+
const _version = next || subsWorkspace(version, actual)
|
|
27
28
|
|
|
28
|
-
pkg[scope] = {...pkg[scope], [name]:
|
|
29
|
+
pkg[scope] = {...pkg[scope], [name]: _version} // Update pkg context
|
|
30
|
+
deps[name] = _version // Update manifest
|
|
29
31
|
|
|
30
32
|
if (!next) return
|
|
31
|
-
|
|
32
|
-
deps[name] = next
|
|
33
|
-
|
|
34
33
|
changes.push({
|
|
35
34
|
group: 'Dependencies',
|
|
36
35
|
releaseType: 'patch',
|
|
@@ -42,19 +41,25 @@ export const updateDeps = async (pkg, packages) => {
|
|
|
42
41
|
return changes
|
|
43
42
|
}
|
|
44
43
|
|
|
45
|
-
export const
|
|
44
|
+
export const resolveNextVersion = (decl, actual, prev) => {
|
|
46
45
|
if (!decl) return null
|
|
47
46
|
|
|
48
47
|
// https://yarnpkg.com/features/workspaces
|
|
48
|
+
decl = subsWorkspace(decl, actual)
|
|
49
|
+
|
|
50
|
+
if (!semver.satisfies(actual, decl)) return actual === prev ? null : actual
|
|
51
|
+
|
|
52
|
+
return decl === prev ? null : decl
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const subsWorkspace = (decl, actual) => {
|
|
49
56
|
if (decl.startsWith('workspace:')) {
|
|
50
57
|
const [, range, caret] = /^workspace:(([\^~*])?.*)$/.exec(decl)
|
|
51
58
|
|
|
52
|
-
|
|
59
|
+
return caret === range
|
|
53
60
|
? caret === '*' ? actual : caret + actual
|
|
54
61
|
: range
|
|
55
62
|
}
|
|
56
63
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return decl === prev ? null : decl
|
|
64
|
+
return decl
|
|
60
65
|
}
|
package/src/main/js/publish.js
CHANGED
|
@@ -43,8 +43,8 @@ export const pushMeta = async (pkg) => {
|
|
|
43
43
|
export const ghRelease = async (pkg) => {
|
|
44
44
|
console.log(`[${pkg.name}] create gh release`)
|
|
45
45
|
|
|
46
|
-
const {
|
|
47
|
-
if (!ghToken
|
|
46
|
+
const {ghToken} = parseEnv($.env)
|
|
47
|
+
if (!ghToken) return null
|
|
48
48
|
|
|
49
49
|
const {name, version, absPath: cwd} = pkg
|
|
50
50
|
const {repoName} = await parseRepo(cwd)
|
|
@@ -56,7 +56,7 @@ export const ghRelease = async (pkg) => {
|
|
|
56
56
|
body: releaseNotes
|
|
57
57
|
})
|
|
58
58
|
|
|
59
|
-
await $.o({cwd})`curl -
|
|
59
|
+
await $.o({cwd})`curl -H "Authorization: token ${ghToken}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${repoName}/releases -d ${releaseData}`
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
const pushChangelog = async (pkg) => {
|
package/src/test/js/deps.test.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {suite} from 'uvu'
|
|
2
2
|
import * as assert from 'uvu/assert'
|
|
3
|
-
import {
|
|
3
|
+
import {resolveNextVersion} from '../../main/js/deps.js'
|
|
4
4
|
|
|
5
5
|
const test = suite('deps')
|
|
6
6
|
|
|
7
|
-
test('
|
|
7
|
+
test('resolveNextVersion()', async () => {
|
|
8
8
|
const cases = [
|
|
9
9
|
[,,,null],
|
|
10
10
|
['^1.0', '2.0.0',, '2.0.0'],
|
|
@@ -26,7 +26,7 @@ test('resolveVersion()', async () => {
|
|
|
26
26
|
]
|
|
27
27
|
|
|
28
28
|
cases.forEach(([decl, actual, prev, expected]) => {
|
|
29
|
-
assert.is(
|
|
29
|
+
assert.is(resolveNextVersion(decl, actual, prev), expected)
|
|
30
30
|
})
|
|
31
31
|
})
|
|
32
32
|
|