Automatically updates the schema file's $id field during the release process.
The JSON schema file (schemas/sonarflowrc.schema.json) contains a $id field that references the specific version of the schema on GitHub. This must be updated every time a new version is released so that the schema URL points to the correct version tag.
- Triggered by standard-version: The script is called via the
postbumphook in.versionrc.json - Runs after version bump: Standard-version has already updated
package.jsonwith the new version - Updates schema $id: Reads the new version from
package.jsonand updates the schema file's$idfield - Included in release commit: Standard-version automatically stages and commits all changes, including the schema update
The script is integrated via .versionrc.json:
{
"scripts": {
"postbump": "node scripts/update-schema-version.js"
}
}- Production releases:
v0.2.4→https://raw.githubusercontent.com/bitrockteam/sonarflow/v0.2.4/schemas/sonarflowrc.schema.json - Beta releases:
v0.2.4-beta.1→https://raw.githubusercontent.com/bitrockteam/sonarflow/v0.2.4-beta.1/schemas/sonarflowrc.schema.json
You can run the script manually to update the schema:
node scripts/update-schema-version.jsThis is useful for testing or if you need to update the schema outside of a release.