1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-21 04:52:26 -05:00

chore: fix canary version (#27723)

Broken by
57dd66ec3d

Closes https://github.com/denoland/deno/issues/27719
This commit is contained in:
David Sherret 2025-01-19 05:19:47 -05:00 committed by GitHub
parent 57dd66ec3d
commit b962b87cfe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 32 additions and 15 deletions

View file

@ -1,6 +1,15 @@
// Copyright 2018-2025 the Deno authors. MIT license.
fn main() {
// todo(dsherret): remove this after Deno 2.2.0 is published and then
// align the version of this crate with Deno then. We need to wait because
// there was previously a deno_lib 2.2.0 published (https://crates.io/crates/deno_lib/versions)
let version_path = std::path::Path::new(".").join("version.txt");
println!("cargo:rerun-if-changed={}", version_path.display());
#[allow(clippy::disallowed_methods)]
let text = std::fs::read_to_string(version_path).unwrap();
println!("cargo:rustc-env=DENO_VERSION={}", text);
let commit_hash = git_commit_hash();
println!("cargo:rustc-env=GIT_COMMIT_HASH={}", commit_hash);
println!("cargo:rerun-if-env-changed=GIT_COMMIT_HASH");

View file

@ -15,7 +15,7 @@ pub fn otel_runtime_config() -> OtelRuntimeConfig {
const GIT_COMMIT_HASH: &str = env!("GIT_COMMIT_HASH");
const TYPESCRIPT: &str = "5.6.2";
const CARGO_PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
const DENO_VERSION: &str = env!("DENO_VERSION");
// TODO(bartlomieju): ideally we could remove this const.
const IS_CANARY: bool = option_env!("DENO_CANARY").is_some();
// TODO(bartlomieju): this is temporary, to allow Homebrew to cut RC releases as well
@ -38,13 +38,9 @@ pub static DENO_VERSION_INFO: std::sync::LazyLock<DenoVersionInfo> =
DenoVersionInfo {
deno: if release_channel == ReleaseChannel::Canary {
concat!(
env!("CARGO_PKG_VERSION"),
"+",
env!("GIT_COMMIT_HASH_SHORT")
)
concat!(env!("DENO_VERSION"), "+", env!("GIT_COMMIT_HASH_SHORT"))
} else {
env!("CARGO_PKG_VERSION")
env!("DENO_VERSION")
},
release_channel,
@ -55,12 +51,12 @@ pub static DENO_VERSION_INFO: std::sync::LazyLock<DenoVersionInfo> =
user_agent: if release_channel == ReleaseChannel::Canary {
concat!(
"Deno/",
env!("CARGO_PKG_VERSION"),
env!("DENO_VERSION"),
"+",
env!("GIT_COMMIT_HASH_SHORT")
)
} else {
concat!("Deno/", env!("CARGO_PKG_VERSION"))
concat!("Deno/", env!("DENO_VERSION"))
},
typescript: TYPESCRIPT,
@ -92,7 +88,7 @@ impl DenoVersionInfo {
if self.release_channel == ReleaseChannel::Canary {
self.git_hash
} else {
CARGO_PKG_VERSION
DENO_VERSION
}
}
}

1
cli/lib/version.txt Normal file
View file

@ -0,0 +1 @@
2.1.6

View file

@ -9,6 +9,7 @@ use dashmap::DashMap;
use deno_core::serde_json;
use deno_core::url::Url;
use deno_error::JsErrorBox;
use deno_lib::version::DENO_VERSION_INFO;
use deno_npm::npm_rc::ResolvedNpmRc;
use deno_npm::registry::NpmPackageInfo;
use deno_resolver::npm::ByonmNpmResolverCreateOptions;
@ -182,8 +183,8 @@ pub const NPM_CONFIG_USER_AGENT_ENV_VAR: &str = "npm_config_user_agent";
pub fn get_npm_config_user_agent() -> String {
format!(
"deno/{} npm/? deno/{} {} {}",
env!("CARGO_PKG_VERSION"),
env!("CARGO_PKG_VERSION"),
DENO_VERSION_INFO.deno,
DENO_VERSION_INFO.deno,
std::env::consts::OS,
std::env::consts::ARCH
)

View file

@ -255,7 +255,7 @@ impl<'a> DenoCompileBinaryWriter<'a> {
format!("canary/{}/{}", DENO_VERSION_INFO.git_hash, binary_name)
}
_ => {
format!("release/v{}/{}", env!("CARGO_PKG_VERSION"), binary_name)
format!("release/v{}/{}", DENO_VERSION_INFO.deno, binary_name)
}
};

View file

@ -11,6 +11,7 @@ use std::path::PathBuf;
use deno_core::error::AnyError;
use deno_core::url::Url;
use deno_lib::version::DENO_VERSION_INFO;
use super::util;
use super::CoverageReport;
@ -559,7 +560,7 @@ impl HtmlCoverageReporter {
/// Creates footer part of the contents for html report.
pub fn create_html_footer(&self, now: &str) -> String {
let version = env!("CARGO_PKG_VERSION");
let version = DENO_VERSION_INFO.deno;
format!(
"
<div class='footer quiet pad2 space-top1 center small'>

View file

@ -20,6 +20,7 @@ use deno_graph::EsParser;
use deno_graph::GraphKind;
use deno_graph::ModuleAnalyzer;
use deno_graph::ModuleSpecifier;
use deno_lib::version::DENO_VERSION_INFO;
use doc::html::ShortPath;
use doc::DocDiagnostic;
use indexmap::IndexMap;
@ -280,7 +281,7 @@ impl deno_doc::html::HrefResolver for DocResolver {
if self.deno_ns.contains_key(symbol) {
Some(format!(
"https://deno.land/api@v{}?s={}",
env!("CARGO_PKG_VERSION"),
DENO_VERSION_INFO.deno,
symbol.join(".")
))
} else {

View file

@ -129,6 +129,8 @@ impl Default for BootstrapOptions {
.map(|p| p.get())
.unwrap_or(1);
// this version is not correct as its the version of deno_runtime
// and the implementor should supply a user agent that makes sense
let runtime_version = env!("CARGO_PKG_VERSION");
let user_agent = format!("Deno/{runtime_version}");

View file

@ -7,6 +7,7 @@ const workspace = await DenoWorkspace.load();
const repo = workspace.repo;
const cliCrate = workspace.getCliCrate();
const denoRtCrate = workspace.getDenoRtCrate();
const denoLibCrate = workspace.getDenoLibCrate();
const originalCliVersion = cliCrate.version;
await bumpCiCacheVersion();
@ -23,6 +24,7 @@ if (Deno.args.some((a) => a === "--patch")) {
}
denoRtCrate.setVersion(cliCrate.version);
denoLibCrate.folderPath.join("version.txt").writeTextSync(cliCrate.version);
// increment the dependency crate versions
for (const crate of workspace.getCliDependencyCrates()) {

View file

@ -46,6 +46,10 @@ export class DenoWorkspace {
return this.getCrate("denort");
}
getDenoLibCrate() {
return this.getCrate("deno_lib");
}
getCrate(name: string) {
return this.#repo.getCrate(name);
}