diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2022-04-21 09:51:12 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-21 09:51:12 -0400 |
commit | 0cd61f2260af4eb12c0856d7afe7c19f0df1f3a5 (patch) | |
tree | df9a8595951339ad92785cc5855259dd084687b8 /tools/release/01_bump_crate_versions.ts | |
parent | fa37b6a8db5287a49cf3bea6a3a092cdb9dad3a9 (diff) |
chore(scripts): allow running version_bump workflow without releasing deno_std yet (#14341)
Diffstat (limited to 'tools/release/01_bump_crate_versions.ts')
-rwxr-xr-x | tools/release/01_bump_crate_versions.ts | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/tools/release/01_bump_crate_versions.ts b/tools/release/01_bump_crate_versions.ts index b9f56706d..01aedb166 100755 --- a/tools/release/01_bump_crate_versions.ts +++ b/tools/release/01_bump_crate_versions.ts @@ -97,24 +97,17 @@ async function getGitLog() { } async function updateStdVersion() { - const newStdVersion = await getLatestStdVersion(); const compatFilePath = path.join(cliCrate.folderPath, "compat/mod.rs"); - const text = Deno.readTextFileSync(compatFilePath); - Deno.writeTextFileSync( + const text = await Deno.readTextFile(compatFilePath); + const versionRe = /std@([0-9]+\.[0-9]+\.[0-9]+)/; + const stdVersionText = versionRe.exec(text)?.[1]; + if (stdVersionText == null) { + throw new Error(`Could not find the deno_std version in ${compatFilePath}`); + } + const stdVersion = semver.parse(stdVersionText)!; + const newStdVersion = stdVersion.inc("minor"); + await Deno.writeTextFile( compatFilePath, - text.replace(/std@[0-9]+\.[0-9]+\.[0-9]+/, `std@${newStdVersion}`), + text.replace(versionRe, `std@${newStdVersion}`), ); } - -async function getLatestStdVersion() { - const url = - "https://raw.githubusercontent.com/denoland/deno_std/main/version.ts"; - const result = await fetch(url); - const text = await result.text(); - const version = /"([0-9]+\.[0-9]+\.[0-9]+)"/.exec(text); - if (version == null) { - throw new Error(`Could not find version in text: ${text}`); - } else { - return version[1]; - } -} |