zx-based alternative for multi-semantic-release
🚧 Work in progress. Early access preview
- Conventional commits trigger semantic releases.
- Predictable toposort-driven flow.
- No blocking (no release commits).
- Changelogs, docs, bundles go to: release assets and/or meta branch.
- No extra builds. The required deps are fetched from the pkg registry.
- macOS / linux
- Node.js >= 16.0.0
- npm >=7 / yarn >= 3
GH_TOKEN=ghtoken GH_USER=username NPM_TOKEN=npmtoken npx zx-bulk-release [opts]
import { run } from 'zx-bulk-release'
const cwd = '/foo/bar'
const env = {GH_TOKEN: 'foo', NPM_TOKEN: 'bar'}
const flags = {dryRun: true}
await run({
cwd, // Defaults to process.cwd()
flags, // Defaults to process.env
env // Defaults to minimist-parsed `process.argv.slice(2)`
})
Any cosmiconfig compliant format: .releaserc
, .release.json
, .release.yaml
, etc.
buildCmd: 'yarn && yarn build'
testCmd: 'yarn test'
fetch: true
Lerna tags (like @pkg/[email protected]
) are suitable for monorepos, but they don’t follow semver spec. Therefore, we propose another contract:
'2022.6.13-optional-org.pkg-name.v1.0.0-beta.1+sha.1-f0'
// date name version format
Note, npm-package-name charset is wider than semver, so we need a pinch of base64url magic for some cases.
'2022.6.13-examplecom.v1.0.0.ZXhhbXBsZS5jb20-f1'
// date name ver b64 format
export const parseEnv = (env = process.env) => {
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
return {
ghUser: GH_USER || GH_USERNAME || GITHUB_USER || GITHUB_USERNAME,
ghToken: GH_TOKEN || GITHUB_TOKEN,
npmToken: NPM_TOKEN,
// npmConfig suppresses npmToken
npmConfig: NPMRC || NPM_USERCONFIG || NPM_CONFIG_USERCONFIG,
npmRegistry: NPM_REGISTRY || 'https://registry.npmjs.org',
gitCommitterName: GIT_COMMITTER_NAME || 'Semrel Extra Bot',
gitCommitterEmail: GIT_COMMITTER_EMAIL || '[email protected]',
}
}
Each release projects its result into the meta
branch.
2022-6-26-semrel-extra-zxbr-test-c-1-3-1-f0.json
{
"META_VERSION": "1",
"name": "@semrel-extra/zxbr-test-c",
"hash": "07b7df33f0159f674c940bd7bbb2652cdaef5207",
"version": "1.3.1",
"dependencies": {
"@semrel-extra/zxbr-test-a": "^1.4.0",
"@semrel-extra/zxbr-test-d": "~1.2.0"
}
}