[yarn] Allow overriding the revision for the regen-version script

This commit is contained in:
Laura Hausmann 2023-11-06 22:52:53 +01:00
parent 57b966d7c0
commit 780cfcaa4d
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -8,7 +8,9 @@ const exec = require("execa");
const match = json['version'].match(/^[\d.]*(?:-pre\d+|)?/);
const version = match ? `${match[0]}-dev` : "dev";
const { stdout: revision } = await exec("git", ["rev-parse", "--short", "HEAD"]);;
const revision = process.argv.length > 2
? process.argv[2]
: (await exec("git", ["rev-parse", "--short", "HEAD"])).stdout;
json['version'] = `${version}-${revision}`;
console.log(json['version']);