zx-bulk-release 4.0.0 → 4.0.2
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 +10 -0
- package/package.json +2 -2
- package/src/main/js/post/api/npm.js +19 -2
- package/src/main/js/post/depot/deps.js +12 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## [4.0.2](https://github.com/semrel-extra/zx-bulk-release/compare/v4.0.1...v4.0.2) (2026-11-29)
|
|
2
|
+
|
|
3
|
+
### Fixes & improvements
|
|
4
|
+
* fix(deps): never publish a declared dependency version the dependency does not satisfy ([a9a10e8](https://github.com/semrel-extra/zx-bulk-release/commit/a9a10e80648fb4f94fd6886cdd0ae810f3691df5))
|
|
5
|
+
|
|
6
|
+
## [4.0.1](https://github.com/semrel-extra/zx-bulk-release/compare/v4.0.0...v4.0.1) (2026-10-12)
|
|
7
|
+
|
|
8
|
+
### Fixes & improvements
|
|
9
|
+
* fix(pack): replace manifests atomically, siblings never read a torn package.json ([01f9784](https://github.com/semrel-extra/zx-bulk-release/commit/01f9784fc702b167e941840d99d1ee5e243a3986))
|
|
10
|
+
|
|
1
11
|
## [4.0.0](https://github.com/semrel-extra/zx-bulk-release/compare/v3.3.0...v4.0.0) (2026-10-12)
|
|
2
12
|
|
|
3
13
|
### Features
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zx-bulk-release",
|
|
3
3
|
"alias": "bulk-release",
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.2",
|
|
5
5
|
"description": "zx-based alternative for multi-semantic-release",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@vitest/coverage-v8": "^5.0.4",
|
|
37
37
|
"esbuild": "^0.28.2",
|
|
38
|
-
"verdaccio": "6.
|
|
38
|
+
"verdaccio": "6.11.3",
|
|
39
39
|
"vite": "^8.3.4",
|
|
40
40
|
"vitest": "^5.0.4"
|
|
41
41
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import zlib from 'node:zlib'
|
|
2
|
+
import {randomUUID} from 'node:crypto'
|
|
2
3
|
import _fs from 'node:fs/promises'
|
|
3
4
|
import _path from 'node:path'
|
|
4
5
|
import tar from 'tar-stream'
|
|
@@ -69,13 +70,29 @@ export const fetchManifest = async (pkg, {nothrow} = {}) => {
|
|
|
69
70
|
export const npmPersist = async (pkg) => {
|
|
70
71
|
const {name, version, manifest, manifestAbsPath} = pkg
|
|
71
72
|
log.info(`updating ${manifestAbsPath} inners: ${name} ${version}`)
|
|
72
|
-
await
|
|
73
|
+
await replaceFile(manifestAbsPath, JSON.stringify(manifest, null, 2) + '\n')
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
export const npmRestore = async (pkg) => {
|
|
76
77
|
const {manifestRaw, manifestAbsPath} = pkg
|
|
77
78
|
log.info(`rolling back ${manifestAbsPath} inners to manifestRaw`)
|
|
78
|
-
await
|
|
79
|
+
await replaceFile(manifestAbsPath, manifestRaw)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Packages go in parallel, and npm (yarn, pnpm) in any of them reads every manifest of the workspace:
|
|
83
|
+
// a reader sees the old file or the new one, never a torn one. A symlinked manifest stays a symlink.
|
|
84
|
+
const replaceFile = async (file, data) => {
|
|
85
|
+
const target = await fs.realpath(file)
|
|
86
|
+
const {mode} = await fs.stat(target)
|
|
87
|
+
const tmp = `${target}.${randomUUID()}.tmp`
|
|
88
|
+
try {
|
|
89
|
+
await fs.writeFile(tmp, data, 'utf8')
|
|
90
|
+
await fs.chmod(tmp, mode & 0o7777)
|
|
91
|
+
await fs.rename(tmp, target)
|
|
92
|
+
} catch (e) {
|
|
93
|
+
await fs.rm(tmp, {force: true})
|
|
94
|
+
throw e
|
|
95
|
+
}
|
|
79
96
|
}
|
|
80
97
|
|
|
81
98
|
export const npmPublish = async (pkg) => {
|
|
@@ -23,7 +23,7 @@ export const updateDeps = async (pkg) => {
|
|
|
23
23
|
const prev = pkg.latest.meta?.[scope]?.[name]
|
|
24
24
|
const actual = dep?.version
|
|
25
25
|
const next = resolveNextVersion(version, actual, prev)
|
|
26
|
-
const _version = dep?.preversion ||
|
|
26
|
+
const _version = dep?.preversion || resolvePin(version, actual) // NOTE preversion should always be pinned
|
|
27
27
|
|
|
28
28
|
pkg[scope] = {...pkg[scope], [name]: _version} // Update pkg context
|
|
29
29
|
deps[name] = _version // Update manifest
|
|
@@ -40,15 +40,19 @@ export const updateDeps = async (pkg) => {
|
|
|
40
40
|
return changes
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
// The pin a release carries: the declaration if the dependency's version satisfies it, else that version. The manifest
|
|
44
|
+
// is never written back, so an old exact pin there would otherwise go out again on every release that keeps it.
|
|
45
|
+
export const resolvePin = (decl, actual) => {
|
|
46
46
|
// https://yarnpkg.com/features/workspaces
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
const range = subsWorkspace(decl, actual)
|
|
48
|
+
return actual && !semver.satisfies(actual, range) ? actual : range
|
|
49
|
+
}
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
// The new pin, or null if the last release (prev) went out with it already.
|
|
52
|
+
export const resolveNextVersion = (decl, actual, prev) => {
|
|
53
|
+
if (!decl) return null
|
|
54
|
+
const pin = resolvePin(decl, actual)
|
|
55
|
+
return pin === prev ? null : pin
|
|
52
56
|
}
|
|
53
57
|
|
|
54
58
|
export const subsWorkspace = (decl, actual) => {
|