zx-bulk-release 3.1.12 → 3.2.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/CHANGELOG.md +10 -0
- package/README.md +13 -0
- package/package.json +3 -2
- package/src/main/js/config.js +10 -1
- package/src/main/js/post/depot/steps/pack.js +34 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## [3.2.0](https://github.com/semrel-extra/zx-bulk-release/compare/v3.1.13...v3.2.0) (2026-04-21)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
* feat: provide configurable packer ([df527f2](https://github.com/semrel-extra/zx-bulk-release/commit/df527f2bf2ae93dc56039fa8abf0ec7be9e9a8c0))
|
|
5
|
+
|
|
6
|
+
## [3.1.13](https://github.com/semrel-extra/zx-bulk-release/compare/v3.1.12...v3.1.13) (2026-04-20)
|
|
7
|
+
|
|
8
|
+
### Fixes & improvements
|
|
9
|
+
* fix(config): force using file urls for dynamic import (win issue) ([78d32e6](https://github.com/semrel-extra/zx-bulk-release/commit/78d32e6b5ac8b8dbbe359e829e1b498ef193c2e6))
|
|
10
|
+
|
|
1
11
|
## [3.1.12](https://github.com/semrel-extra/zx-bulk-release/compare/v3.1.11...v3.1.12) (2026-04-13)
|
|
2
12
|
|
|
3
13
|
### Fixes & improvements
|
package/README.md
CHANGED
|
@@ -219,6 +219,7 @@ await run({
|
|
|
219
219
|
"buildCmd": "yarn && yarn build",
|
|
220
220
|
"testCmd": "yarn test",
|
|
221
221
|
"npmFetch": true,
|
|
222
|
+
"npmPacker": "npm",
|
|
222
223
|
"changelog": "changelog",
|
|
223
224
|
"ghPages": "gh-pages",
|
|
224
225
|
"diffTagUrl": "${repoPublicUrl}/compare/${prevTag}...${newTag}",
|
|
@@ -237,6 +238,18 @@ await run({
|
|
|
237
238
|
```
|
|
238
239
|
Available variables include: `name`, `version`, `absPath`, `relPath`, and anything from `pkg.ctx` (e.g. `git.sha`, `git.root`, `flags.*`).
|
|
239
240
|
|
|
241
|
+
#### npm packer
|
|
242
|
+
|
|
243
|
+
Controls the tool used to build the npm tarball. Defaults to `npm`, which covers bin/man normalization, `.npmignore` handling, and `prepack`/`prepare` lifecycle hooks. Override when the repo is yarn- or pnpm-native:
|
|
244
|
+
|
|
245
|
+
```json
|
|
246
|
+
{ "npmPacker": "yarn" } // yarn berry: `yarn pack -o <...>.tgz`
|
|
247
|
+
{ "npmPacker": "pnpm" } // pnpm: `pnpm pack --pack-destination <dir>`
|
|
248
|
+
{ "npmPacker": "npm" } // default: `npm pack --pack-destination <dir>`
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
zbr invokes the packer with a clean env (strips inherited `npm_*` / `npm_config_*` vars) to avoid npm 11's "Exit prior to config file resolving" when zbr itself runs under `npx`/`npm run`.
|
|
252
|
+
|
|
240
253
|
#### Changelog diff URLs
|
|
241
254
|
By default, changelog entries link to GitHub compare/commit pages. Override `diffTagUrl` and `diffCommitUrl` to customize for other platforms (e.g. Gerrit):
|
|
242
255
|
```json
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zx-bulk-release",
|
|
3
3
|
"alias": "bulk-release",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.2.0",
|
|
5
5
|
"description": "zx-based alternative for multi-semantic-release",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"test": "npm run test:unit",
|
|
22
22
|
"test:unit": "vitest run --dir src/test/js --exclude '**/integration*' --exclude '**/fixtures/**' --exclude '**/utils/**'",
|
|
23
23
|
"test:it": "node ./src/test/js/integration.test.js",
|
|
24
|
+
"test:smoke": "node src/test/smoke/api.test.js && node src/test/smoke/cli.test.js",
|
|
24
25
|
"test:cov": "vitest run --coverage --dir src/test/js --exclude '**/fixtures/**' --exclude '**/utils/**'",
|
|
25
26
|
"docs": "mkdir -p docs && cp ./README.md ./docs/README.md",
|
|
26
27
|
"publish:beta": "npm publish --tag beta --no-git-tag-version",
|
|
@@ -34,7 +35,7 @@
|
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@vitest/coverage-v8": "^4.1.4",
|
|
36
37
|
"esbuild": "^0.28.0",
|
|
37
|
-
"verdaccio": "6.5.
|
|
38
|
+
"verdaccio": "6.5.2",
|
|
38
39
|
"vitest": "^4.1.4"
|
|
39
40
|
},
|
|
40
41
|
"publishConfig": {
|
package/src/main/js/config.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { pathToFileURL } from 'node:url'
|
|
1
2
|
import { fs, path, YAML } from 'zx'
|
|
2
3
|
import { asArray, camelize, memoizeBy } from './util.js'
|
|
3
4
|
import { GH_URL, resolveGhApiUrl } from './post/api/gh.js'
|
|
@@ -32,7 +33,7 @@ export const getPkgConfig = async (cwd, env) =>
|
|
|
32
33
|
export const cosmiconfig = (name, {searchPlaces}) => {
|
|
33
34
|
const load = async (filePath) => {
|
|
34
35
|
if (filePath.endsWith('.js') || filePath.endsWith('.cjs'))
|
|
35
|
-
return (await import(filePath)).default
|
|
36
|
+
return (await import(pathToFileURL(filePath).href)).default
|
|
36
37
|
const raw = await fs.readFile(filePath, 'utf8')
|
|
37
38
|
if (filePath.endsWith('.yaml') || filePath.endsWith('.yml'))
|
|
38
39
|
return YAML.parse(raw)
|
|
@@ -72,6 +73,7 @@ export const normalizePkgConfig = (config, env) => {
|
|
|
72
73
|
...config,
|
|
73
74
|
releaseRules: config.releaseRules || config.semanticRules,
|
|
74
75
|
npmFetch: config.npmFetch || config.fetch || config.fetchPkg,
|
|
76
|
+
npmPacker: normalizeNpmPacker(config.npmPacker),
|
|
75
77
|
buildCmd: config.buildCmd || config.cmd,
|
|
76
78
|
get ghBasicAuth() {
|
|
77
79
|
return this.ghUser && this.ghToken ? `${this.ghUser}:${this.ghToken}` : false
|
|
@@ -80,6 +82,13 @@ export const normalizePkgConfig = (config, env) => {
|
|
|
80
82
|
}
|
|
81
83
|
}
|
|
82
84
|
|
|
85
|
+
const NPM_PACKERS = new Set(['npm', 'yarn', 'pnpm'])
|
|
86
|
+
export const normalizeNpmPacker = (v) => {
|
|
87
|
+
if (!v) return 'npm'
|
|
88
|
+
if (!NPM_PACKERS.has(v)) throw new Error(`unknown npmPacker: ${v} (expected one of: ${[...NPM_PACKERS].join(', ')})`)
|
|
89
|
+
return v
|
|
90
|
+
}
|
|
91
|
+
|
|
83
92
|
export const normalizeMetaConfig = (meta) =>
|
|
84
93
|
meta === false || meta === 'none'
|
|
85
94
|
? { type: null }
|
|
@@ -7,6 +7,39 @@ import {sanitizePkgName} from '../../parcel/build.js'
|
|
|
7
7
|
import {formatReleaseNotes} from '../generators/notes.js'
|
|
8
8
|
import {packTar, hashFile} from '../../tar.js'
|
|
9
9
|
|
|
10
|
+
// Strip inherited `npm_*` / `npm_config_*` env vars. When zbr is invoked via `npx`
|
|
11
|
+
// or `npm run`, the parent npm pollutes the env and the child packer (npm/yarn/pnpm)
|
|
12
|
+
// can misinterpret it — on npm 11+ this surfaces as "Exit prior to config file resolving".
|
|
13
|
+
const cleanPackerEnv = () => Object.fromEntries(
|
|
14
|
+
Object.entries(process.env).filter(([k]) => !/^npm_/i.test(k))
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
// pack via selected package manager. All three produce an npm-compatible tarball,
|
|
18
|
+
// honoring `files`/`.npmignore`, bin/man normalization, and prepack hooks.
|
|
19
|
+
const packers = {
|
|
20
|
+
async npm(pkg, destDir) {
|
|
21
|
+
const out = await $({cwd: pkg.absPath, env: cleanPackerEnv()})`npm pack --pack-destination ${destDir}`
|
|
22
|
+
return path.join(destDir, out.toString().trim().split('\n').pop())
|
|
23
|
+
},
|
|
24
|
+
async pnpm(pkg, destDir) {
|
|
25
|
+
const out = await $({cwd: pkg.absPath, env: cleanPackerEnv()})`pnpm pack --pack-destination ${destDir}`
|
|
26
|
+
return path.join(destDir, out.toString().trim().split('\n').pop())
|
|
27
|
+
},
|
|
28
|
+
async yarn(pkg, destDir) {
|
|
29
|
+
// yarn berry: `yarn pack -o <path>`. Name is under our control — no stdout parsing.
|
|
30
|
+
const target = path.join(destDir, `${sanitizePkgName(pkg.name)}-${pkg.version}.tgz`)
|
|
31
|
+
await $({cwd: pkg.absPath, env: cleanPackerEnv()})`yarn pack -o ${target}`
|
|
32
|
+
return target
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const packNpmTarball = async (pkg, destDir) => {
|
|
37
|
+
const packer = pkg.config.npmPacker || 'npm'
|
|
38
|
+
const fn = packers[packer]
|
|
39
|
+
if (!fn) throw new Error(`unknown npmPacker: ${packer}`)
|
|
40
|
+
return fn(pkg, destDir)
|
|
41
|
+
}
|
|
42
|
+
|
|
10
43
|
export const pack = memoizeBy(async (pkg, ctx = pkg.ctx) => {
|
|
11
44
|
const {channels: channelNames = [], flags} = ctx
|
|
12
45
|
const snapshot = !!flags.snapshot
|
|
@@ -23,8 +56,7 @@ export const pack = memoizeBy(async (pkg, ctx = pkg.ctx) => {
|
|
|
23
56
|
const artifacts = {repoName, repoHost, originUrl}
|
|
24
57
|
|
|
25
58
|
if (active.includes('npm')) {
|
|
26
|
-
|
|
27
|
-
artifacts.npmTarball = path.join(stageDir, out.toString().trim())
|
|
59
|
+
artifacts.npmTarball = await packNpmTarball(pkg, stageDir)
|
|
28
60
|
}
|
|
29
61
|
if (active.includes('gh-release') || active.includes('changelog'))
|
|
30
62
|
artifacts.releaseNotes = await formatReleaseNotes(pkg)
|