zx-bulk-release 3.1.1 → 3.1.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 +12 -0
- package/README.md +3 -3
- package/package.json +1 -1
- package/src/main/js/cli.js +46 -2
- package/src/main/js/index.js +1 -1
- package/src/main/js/post/depot/context.js +1 -1
- package/src/main/js/post/depot/generators/meta.js +2 -2
- package/src/main/js/post/depot/steps/contextify.js +3 -3
- package/src/main/js/post/depot/steps/pack.js +2 -1
- package/src/main/js/post/release.js +9 -34
- package/src/main/js/post/tar.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [3.1.3](https://github.com/semrel-extra/zx-bulk-release/compare/v3.1.2...v3.1.3) (2026-04-13)
|
|
2
|
+
|
|
3
|
+
### Fixes & improvements
|
|
4
|
+
* fix: ensure temp tar dirs ([ffc0b25](https://github.com/semrel-extra/zx-bulk-release/commit/ffc0b2512c16540a4d260ffc6e02488a96b68194))
|
|
5
|
+
|
|
6
|
+
## [3.1.2](https://github.com/semrel-extra/zx-bulk-release/compare/v3.1.1...v3.1.2) (2026-04-13)
|
|
7
|
+
|
|
8
|
+
### Fixes & improvements
|
|
9
|
+
* perf: append pkg scope to internal zx logs ([08471b9](https://github.com/semrel-extra/zx-bulk-release/commit/08471b9c87d9ef2bf24b30a99977c308cee1feaf))
|
|
10
|
+
* perf: update default zx ctx file name ([9857dcd](https://github.com/semrel-extra/zx-bulk-release/commit/9857dcdcf9d1e5221eb3fc62f4919a8af2b885fc))
|
|
11
|
+
* refactor: enhance cli ([8909ab2](https://github.com/semrel-extra/zx-bulk-release/commit/8909ab2496402102b33fa134275ac415b6d8297a))
|
|
12
|
+
|
|
1
13
|
## [3.1.1](https://github.com/semrel-extra/zx-bulk-release/compare/v3.1.0...v3.1.1) (2026-04-12)
|
|
2
14
|
|
|
3
15
|
### Fixes & improvements
|
package/README.md
CHANGED
|
@@ -44,10 +44,10 @@ GH_TOKEN=ghtoken GH_USER=username NPM_TOKEN=npmtoken npx zx-bulk-release [opts]
|
|
|
44
44
|
```
|
|
45
45
|
| Flag | Description | Default |
|
|
46
46
|
|------------------------------|---------------------------------------------------------------------------------------------------|------------------|
|
|
47
|
-
| `--receive` | Consume rebuild signal, analyze, preflight. Writes
|
|
47
|
+
| `--receive` | Consume rebuild signal, analyze, preflight. Writes `zbr-context.json`. Run before deps install. | |
|
|
48
48
|
| `--pack [dir]` | Pack only: build, test, and write delivery tars to `dir`. No credentials needed. | `parcels` |
|
|
49
49
|
| `--verify [dir]` | Verify untrusted parcels against context, copy valid ones to `parcels/`. Use `--context` for path. | `parcels` |
|
|
50
|
-
| `--context <path>` | Path to trusted
|
|
50
|
+
| `--context <path>` | Path to trusted `zbr-context.json` (used with `--verify`). | `zbr-context.json` |
|
|
51
51
|
| `--deliver [dir]` | Deliver only: read tars from `dir` and run delivery channels. No source code needed. | `parcels` |
|
|
52
52
|
| `--ignore` | Packages to ignore: `a, b` | |
|
|
53
53
|
| `--include-private` | Include `private` packages | `false` |
|
|
@@ -152,7 +152,7 @@ jobs:
|
|
|
152
152
|
- uses: actions/upload-artifact@v4
|
|
153
153
|
with:
|
|
154
154
|
name: context-${{ github.run_id }}
|
|
155
|
-
path:
|
|
155
|
+
path: zbr-context.json
|
|
156
156
|
|
|
157
157
|
# pack — deps installed, hostile code may run, zero credentials
|
|
158
158
|
- if: steps.receive.outputs.status == 'proceed'
|
package/package.json
CHANGED
package/src/main/js/cli.js
CHANGED
|
@@ -1,7 +1,51 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import {argv} from 'zx-extra'
|
|
4
|
-
import {run} from './index.js'
|
|
4
|
+
import {run, version} from './index.js'
|
|
5
5
|
import {normalizeFlags} from './config.js'
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
const flags = normalizeFlags(argv)
|
|
8
|
+
|
|
9
|
+
if (flags.h || flags.help) {
|
|
10
|
+
console.log(`zx-bulk-release v${version}
|
|
11
|
+
|
|
12
|
+
Usage: npx zx-bulk-release [options]
|
|
13
|
+
|
|
14
|
+
Modes:
|
|
15
|
+
(no flags) All-in-one: analyze, build, test, pack, deliver
|
|
16
|
+
--receive Analyze & preflight, write zbr-context.json. Run BEFORE deps install
|
|
17
|
+
--pack [dir] Build, test, pack tars to dir [default: parcels]
|
|
18
|
+
--verify [input-dir] Validate parcels against context, copy valid to parcels/ [default: parcels]
|
|
19
|
+
--deliver [dir] Deliver parcels through channels [default: parcels]
|
|
20
|
+
|
|
21
|
+
Options:
|
|
22
|
+
--context <path> Trusted context path (with --verify) [default: zbr-context.json]
|
|
23
|
+
--dry-run, --no-publish Disable publish and any remote-mutating operations
|
|
24
|
+
--no-build Skip buildCmd
|
|
25
|
+
--no-test Skip testCmd
|
|
26
|
+
--snapshot Publish snapshot versions to npm only
|
|
27
|
+
--ignore <a,b> Packages to ignore
|
|
28
|
+
--include-private Include private packages
|
|
29
|
+
--concurrency <n> Build/publish thread limit [default: os.cpus().length]
|
|
30
|
+
--only-workspace-deps Recognize only workspace: deps as graph edges
|
|
31
|
+
--no-npm-fetch Disable npm artifact fetching
|
|
32
|
+
--report <path> Persist release state to file
|
|
33
|
+
--debug Enable verbose mode
|
|
34
|
+
-v, --version Print version
|
|
35
|
+
-h, --help Show this help`)
|
|
36
|
+
process.exit(0)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (flags.v || flags.version) {
|
|
40
|
+
console.log(version)
|
|
41
|
+
process.exit(0)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
await run({flags})
|
|
46
|
+
process.exit(0)
|
|
47
|
+
} catch (e) {
|
|
48
|
+
if (e?.exitCode !== undefined) process.exit(e.exitCode)
|
|
49
|
+
console.error(e)
|
|
50
|
+
process.exit(1)
|
|
51
|
+
}
|
package/src/main/js/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {run} from './post/release.js'
|
|
1
|
+
export {run, version} from './post/release.js'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Meta generator: builds pkg.meta payload and resolves latest-release meta from git tags / gh assets / meta branch.
|
|
2
2
|
|
|
3
3
|
import {semver, $, fs, path} from 'zx-extra'
|
|
4
|
-
import {fetchRepo, getTags as getGitTags, getRepo} from '../../api/git.js'
|
|
4
|
+
import {fetchRepo, getTags as getGitTags, getRepo, getSha} from '../../api/git.js'
|
|
5
5
|
import {fetchManifest} from '../../api/npm.js'
|
|
6
6
|
import {ghGetAsset} from '../../api/gh.js'
|
|
7
7
|
import {parseTag} from './tag.js'
|
|
@@ -16,7 +16,7 @@ export const prepareMeta = async (pkg) => {
|
|
|
16
16
|
if (type === null) return
|
|
17
17
|
|
|
18
18
|
const {absPath: cwd} = pkg
|
|
19
|
-
const hash =
|
|
19
|
+
const hash = await getSha(cwd)
|
|
20
20
|
pkg.meta = {
|
|
21
21
|
META_VERSION: '1',
|
|
22
22
|
hash,
|
|
@@ -42,9 +42,9 @@ export const contextify = async (pkg, ctx) => {
|
|
|
42
42
|
pkg.ctx = {
|
|
43
43
|
...ctx,
|
|
44
44
|
git: {
|
|
45
|
-
sha: await getSha(
|
|
46
|
-
root: await getRoot(
|
|
47
|
-
timestamp: await getCommitTimestamp(
|
|
45
|
+
sha: await getSha(ctx.cwd),
|
|
46
|
+
root: await getRoot(ctx.cwd),
|
|
47
|
+
timestamp: await getCommitTimestamp(ctx.cwd),
|
|
48
48
|
},
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import crypto from 'node:crypto'
|
|
1
2
|
import {$, tempy, fs, path} from 'zx-extra'
|
|
2
3
|
import {memoizeBy, asTuple} from '../../../util.js'
|
|
3
4
|
import {prepare, getActiveChannels} from '../../courier/index.js'
|
|
@@ -41,7 +42,7 @@ export const pack = memoizeBy(async (pkg, ctx = pkg.ctx) => {
|
|
|
41
42
|
const tars = []
|
|
42
43
|
for (const {channel, manifest, files} of parcels) {
|
|
43
44
|
// Two-pass: pack to temp, hash, rename to final name.
|
|
44
|
-
const tmpPath = path.join(stageDir, `_tmp.${
|
|
45
|
+
const tmpPath = path.join(stageDir, `_tmp.${crypto.randomUUID()}.tar`)
|
|
45
46
|
await packTar(tmpPath, manifest, files)
|
|
46
47
|
const hash = await hashFile(tmpPath)
|
|
47
48
|
const sha7 = ctx.git.sha.slice(0, 7)
|
|
@@ -14,46 +14,21 @@ import {runPack} from './modes/pack.js'
|
|
|
14
14
|
|
|
15
15
|
const ZBR_VERSION = createRequire(import.meta.url)('../../../../package.json').version
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
zx-bulk-release v${ZBR_VERSION}
|
|
19
|
-
|
|
20
|
-
Usage: npx zx-bulk-release [options]
|
|
21
|
-
|
|
22
|
-
Modes:
|
|
23
|
-
(no flags) All-in-one: analyze, build, test, pack, deliver
|
|
24
|
-
--receive Analyze & preflight. Writes .zbr-context.json. Run BEFORE deps install.
|
|
25
|
-
--pack [dir] Build, test, pack tars to dir. [default: parcels]
|
|
26
|
-
--verify [dir] Validate parcels against context, copy to parcels/. [default: parcels]
|
|
27
|
-
--deliver [dir] Deliver parcels through channels. [default: parcels]
|
|
28
|
-
|
|
29
|
-
Options:
|
|
30
|
-
--context <path> Path to .zbr-context.json (with --verify). [default: .zbr-context.json]
|
|
31
|
-
--dry-run, --no-publish Disable any publish / remote-mutating logic.
|
|
32
|
-
--no-build Skip buildCmd.
|
|
33
|
-
--no-test Skip testCmd.
|
|
34
|
-
--snapshot Publish snapshot versions to npm only.
|
|
35
|
-
--ignore <a,b> Packages to ignore.
|
|
36
|
-
--include-private Include private packages.
|
|
37
|
-
--concurrency <n> Build/publish thread limit. [default: os.cpus().length]
|
|
38
|
-
--only-workspace-deps Recognize only workspace: deps as graph edges.
|
|
39
|
-
--no-npm-fetch Disable npm artifact fetching.
|
|
40
|
-
--report <path> Persist release state to file.
|
|
41
|
-
--debug Enable verbose mode.
|
|
42
|
-
-v, --version Print version.
|
|
43
|
-
-h, --help Show this help.
|
|
44
|
-
`.trim()
|
|
17
|
+
export {ZBR_VERSION as version}
|
|
45
18
|
|
|
46
19
|
export const run = async ({cwd = process.cwd(), env: _env, flags = {}} = {}) => within(async () => {
|
|
47
|
-
if (flags.h || flags.help)
|
|
48
|
-
return console.log(HELP)
|
|
49
|
-
|
|
50
|
-
if (flags.v || flags.version)
|
|
51
|
-
return console.log(ZBR_VERSION)
|
|
52
|
-
|
|
53
20
|
const env = {...process.env, ..._env}
|
|
54
21
|
log.secret(env.GH_TOKEN, env.GITHUB_TOKEN, env.NPM_TOKEN)
|
|
55
22
|
log.info(`zx-bulk-release@${ZBR_VERSION}`)
|
|
56
23
|
|
|
24
|
+
const _log = $.log
|
|
25
|
+
$.log = (entry) => {
|
|
26
|
+
if (entry.kind === 'cmd' && $.scope) {
|
|
27
|
+
entry = {...entry, cmd: `[${$.scope}] ${entry.cmd}`}
|
|
28
|
+
}
|
|
29
|
+
_log(entry)
|
|
30
|
+
}
|
|
31
|
+
|
|
57
32
|
if (flags.verify) return runVerify({cwd, flags})
|
|
58
33
|
if (flags.deliver) return runDeliver({env, flags})
|
|
59
34
|
|
package/src/main/js/post/tar.js
CHANGED
|
@@ -5,6 +5,7 @@ import {pipeline} from 'node:stream/promises'
|
|
|
5
5
|
import {createWriteStream, createReadStream} from 'node:fs'
|
|
6
6
|
|
|
7
7
|
export const packTar = async (tarPath, manifest, files = []) => {
|
|
8
|
+
await fs.ensureDir(path.dirname(tarPath))
|
|
8
9
|
const pack = tar.pack()
|
|
9
10
|
const json = JSON.stringify(manifest, null, 2)
|
|
10
11
|
pack.entry({name: 'manifest.json', size: Buffer.byteLength(json)}, json)
|