# version-batch Versions every library a change between two refs makes due a release, in dependency order, and records the bumps in one commit. It stands down on the base branch itself, so a pre-push hook can run it on every branch. ```json { "version:all": { "executor": "@hyperfrontend/workspace:version-batch", "options": { "base": "origin/main" } } } ``` | Option | What it does | | --------------------- | ------------------------------------------------------------------------------------------------------------------------ | | `--base` | The ref the change is measured from; defaults to `origin/main`. The batch fails when git cannot compare it with `--head` | | `--head` | The ref it is measured to; defaults to the head of the checkout | | `--dryRun` | Prints the libraries and bumps and writes nothing | | `--releaseAs` | Forces this bump on the libraries named with `--libraries`, for a change in the artifact rather than the code | | `--libraries` | The projects to version instead of the affected set; only with `--releaseAs` | | `--maxCommitFallback` | How many commits the flow reads at most; defaults to what the project's version target declares | | `--scopeFiltering` | Which commit scopes count for a project; defaults to the project's version target's | | `--verbose` | Prints each library's decision | The commit subject names every bumped library. A failed run restores the working tree to what it was. ## API Reference ### Functions #### baseBranches ```typescript function baseBranches(base: string, remotes: unknown): string[] ``` The branch names a base revision may be read as: the revision as written, without a `refs/heads/` or `refs/remotes/` prefix, and the branch behind a remote-tracking name such as `origin/main` for each remote the repository knows. **Parameters** | Name | Type | Description | | --- | --- | --- | | `base` | `string` | The base revision, as the batch was given it | | `remotes` | `unknown` | The names of the repository's remotes | **Returns** `string[]`: The branch names, each once **Example: The branch behind a remote-tracking base** ```typescript baseBranches('origin/main', ['origin']) // ['origin/main', 'main'] ``` #### versionBatchExecutor ```typescript function versionBatchExecutor(options: VersionBatchExecutorOptions, context: ExecutorContext): Promise ``` Versions every library a change makes due a release and records the bumps in one commit. This executor: 1. Detects affected libraries programmatically 2. Runs versioning for each affected library 3. Creates a single batch commit It stands down on the base branch itself: the releases of that branch are made from the branches merged into it. **Parameters** | Name | Type | Description | | --- | --- | --- | | `options` | `VersionBatchExecutorOptions` | Executor options from schema | | `context` | `ExecutorContext` | The workspace, the project and the target the task runs on | **Returns** `Promise`: Executor result with success status **Example: A root project's `version-batch` target** ```json { "name": "workspace", "root": ".", "targets": { "version-batch": { "executor": "@hyperfrontend/workspace:version-batch", "options": { "base": "origin/main" } } } } ``` `npx hf run workspace:version-batch` versions every library the change since `origin/main` makes due a release and commits the bumps as `chore: update versions for lib-core, lib-utils`; on `main` itself it stands down. **Example: Forcing a bump the commits would not have made** ```bash npx hf run workspace:version-batch --releaseAs=patch --libraries=lib-core,lib-utils ``` ### Interfaces #### VersionBatchExecutorOptions Options of the version-batch executor. The executor detects affected libraries, versions each one, and creates a single batch commit. **Properties** | Name | Type | Description | | --- | --- | --- | | `base?` | `string` | Base git ref for affected detection. | | `head?` | `string` | Head git ref for affected detection. | | `dryRun?` | `boolean` | Preview changes without making them. | | `verbose?` | `boolean` | Enable verbose logging. | | `scopeFiltering?` | `ScopeFilteringConfig` | Commit scope filtering applied when attributing commits to a project. Defaults to whatever the `version` target declares, so the batch that writes versions attributes commits exactly as the single-project run and `version-check` do. | | `maxCommitFallback?` | `number` | Upper bound on the commit window the flow analyzes for bumps and changelogs. | | `releaseAs?` | `"major" \| "minor" \| "patch"` | Force this bump on the libraries named by `libraries`, calculated from each one's published version, for a release whose change is in the package artifact rather than its code. | | `libraries?` | `string[]` | Project names to version instead of the affected set. Required with `releaseAs`, and only meaningful with it. | | `followUps?` | `unknown` | Called after each bump and before the batch commit, each answering the files the commit must also carry. No configuration sets this; an executor that wraps this one passes it. | #### VersionBatchResult Result of version-batch executor. **Properties** | Name | Type | Description | | --- | --- | --- | | `success` | `boolean` | Whether the batch versioning operation succeeded | | `bumpedLibraries` | `string[]` | Libraries that were actually bumped | | `commitHash?` | `string` | Commit hash if a batch commit was created | | `error?` | `string` | Error message if operation failed | --- Canonical page: https://www.hyperfrontend.dev/docs/libraries/workspace/executors/version-batch/ This file: https://www.hyperfrontend.dev/docs/libraries/workspace/executors/version-batch.md Documentation index: https://www.hyperfrontend.dev/llms.txt