chore: import upstream snapshot with attribution
Deploy (to testing) and Test Playground Preview Worker / Deploy Playground Preview Worker (testing) (push) Has been skipped
Deploy Workers Shared Staging / Deploy Workers Shared Staging (push) Failing after 0s
Prerelease / build (push) Has been skipped
Handle Changesets / Handle Changesets (push) Has been cancelled
Semgrep OSS scan / semgrep-oss (push) Has been cancelled
Deploy (to testing) and Test Playground Preview Worker / Deploy Playground Preview Worker (testing) (push) Has been skipped
Deploy Workers Shared Staging / Deploy Workers Shared Staging (push) Failing after 0s
Prerelease / build (push) Has been skipped
Handle Changesets / Handle Changesets (push) Has been cancelled
Semgrep OSS scan / semgrep-oss (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Update the package.json version property for the given package
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* ```
|
||||
* node ./.github/version-script.js <package-name>
|
||||
* ```
|
||||
*
|
||||
* `<package-name>` defaults to `wrangler` if not provided.
|
||||
*/
|
||||
|
||||
const { readFileSync, writeFileSync } = require("fs");
|
||||
const { execSync } = require("child_process");
|
||||
|
||||
try {
|
||||
const packageName = getArgs()[0] ?? "wrangler";
|
||||
const packageJsonPath = `./packages/${packageName}/package.json`;
|
||||
const pkg = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
||||
const stdout = execSync("git rev-parse --short HEAD", { encoding: "utf8" });
|
||||
pkg.version = "0.0.0-" + stdout.trim();
|
||||
writeFileSync(packageJsonPath, JSON.stringify(pkg, null, "\t") + "\n");
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the command line args, stripping `node` and script filename, etc.
|
||||
*/
|
||||
function getArgs() {
|
||||
const args = Array.from(process.argv);
|
||||
while (args.shift() !== module.filename) {}
|
||||
return args;
|
||||
}
|
||||
Reference in New Issue
Block a user