A Rush plugin that generates a JSON file recording the version numbers of all published packages in a Rush monorepo.
-
Add the plugin package to an autoinstaller (e.g.
common/autoinstallers/rush-plugins/package.json):rush init-autoinstaller --name rush-pluginscd common/autoinstallers/rush-plugins pnpm add @rushstack/rush-published-versions-json-plugin rush update-autoinstaller --name rush-plugins -
Register the plugin in
common/config/rush/rush-plugins.json:{ "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush-plugins.schema.json", "plugins": [ { "packageName": "@rushstack/rush-published-versions-json-plugin", "pluginName": "rush-published-versions-json-plugin", "autoinstallerName": "rush-plugins" } ] } -
Run
rush updateto install the plugin.
rush record-published-versions --output-path <FILE_PATH>| Parameter | Short | Required | Description |
|---|---|---|---|
--output-path |
-o |
Yes | The path to the output JSON file. Relative paths are resolved from the repo root. |
rush record-published-versions --output-path common/config/published-versions.jsonThe output is a JSON object mapping published package names to their current versions:
{
"@my-scope/my-library": "1.2.3",
"@my-scope/my-app": "0.5.0"
}A package is included if it has shouldPublish set to true or has a versionPolicy assigned in
rush.json.