Initial commit
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import { readFileSync, writeFileSync } from "node:fs";
|
||||
import exec from "execa";
|
||||
|
||||
const json = JSON.parse(readFileSync("package.json"));
|
||||
|
||||
const match = json['version'].match(/^[\d.]*(?:-pre\d+|)?/);
|
||||
const version = match ? `${match[0]}-dev` : "dev";
|
||||
const revision = process.argv.length > 2
|
||||
? process.argv[2]
|
||||
: (await exec("git", ["rev-parse", "--short", "HEAD"])).stdout;
|
||||
|
||||
json['version'] = `${version}-${revision}`;
|
||||
console.log(`Package version was updated to ${json['version']}`);
|
||||
writeFileSync("package.json", JSON.stringify(json, null, '\t'));
|
||||
Reference in New Issue
Block a user