deno.land / std@0.224.0 / _tools / release / 01_bump_version.ts

01_bump_version.ts
View Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env -S deno run --allow-read --allow-write --allow-run=git,deno --no-check// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.import { getReleasesMdFile, loadRepo, VersionFile } from "./repo.ts";
const repo = await loadRepo();const versionFile = new VersionFile();const currentVersion = versionFile.version;const newVersion = versionFile.version.inc(getVersionIncrementKind());
// update version.tsconsole.log(`Bumping version from ${currentVersion} to ${newVersion}...`);versionFile.updateVersion(newVersion);
// update Releases.mdconst releasesMdFile = getReleasesMdFile();const versionGitLog = await getGitLogFromLastVersion();releasesMdFile.updateWithGitLog({ gitLog: versionGitLog, version: newVersion.toString(),});
// run deno fmtawait repo.runCommandWithOutput(["deno", "fmt", "Releases.md"]);
function getVersionIncrementKind() { if (Deno.args.some((a) => a === "--patch")) { return "patch"; } else if (Deno.args.some((a) => a === "--minor")) { return "minor"; } else if (Deno.args.some((a) => a === "--major")) { return "major"; } else { throw new Error("Please provide a --patch, --minor, or --major flag."); }}
async function getGitLogFromLastVersion() { // fetch the upstream tags and history await repo.gitFetchTags("upstream"); await repo.gitFetchHistory("upstream");
// get the git log from the current commit to the last version return await repo.getGitLogFromTags( "upstream", currentVersion.toString(), undefined, );}
std

Version Info

Tagged at
6 months ago