diff --git a/README.md b/README.md index 27652cd..cb9b8fa 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,8 @@ const identity = resolveBuildIdentity(process.cwd(), 'exadev/build-identity'); // { kind: 'commit', version: 'a1b2c3d', url: 'https://github.com/exadev/build-identity/commit/a1b2c3d4e5f6...', date: '2026-09-08T09:12:03+01:00', commit: 'a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2' } ``` +The same thing is available as a command, for build and deploy steps that cannot import anything -- see [`build-identity` (CLI)](#build-identity-cli). + ## `resolveBuildIdentity(repoRoot, repoSlug, options?)` ```ts @@ -116,10 +118,99 @@ const predictedVersion = await predictNextVersion(process.cwd(), releaseRules, a const identity = resolvePredictedIdentity(build, predictedVersion); ``` +## `build-identity` (CLI) + +The same three functions, wired together, as a command. It exists for build and deploy steps that are a shell invocation rather than a JavaScript config file, so nothing in them can `import` this package at all -- `wrangler deploy --var RELEASE_VERSION:...` being the case it was built for. A step that *is* a JavaScript config file (`next.config.ts`, `vite.config.ts`) should import the functions directly instead; see [Framework-agnosticism](#framework-agnosticism) below. + +```sh +pnpm add -D @exadev/build-identity +pnpm exec build-identity --repo exadev/build-identity +``` + +``` +Usage: build-identity [options] + +Options: + -V, --version output the version number + --repo GitHub slug used to build the release and commit URLs + --root git working tree to inspect (default: the current working directory) + --tag-name