Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ deno_bench_util = { version = "0.215.0", path = "./bench_util" }
deno_config = { version = "0.71.0", features = ["workspace"], path = "./libs/config" }
deno_crypto_provider = { version = "0.15.0", path = "./libs/crypto" }
deno_features = { version = "0.18.0", path = "./runtime/features" }
deno_lib = { version = "0.39.0", path = "./cli/lib" }
deno_lib = { version = "=2.5.6", path = "./cli/lib" }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a way, the previous versioning was better because now this needs to be pinned.

deno_maybe_sync = { version = "0.8.0", path = "./libs/maybe_sync" }
deno_npm_cache = { version = "0.40.0", path = "./libs/npm_cache" }
deno_npm_installer = { version = "0.16.0", path = "./libs/npm_installer" }
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[package]
name = "deno_lib"
version = "0.39.0"
version = "2.5.6"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
9 changes: 0 additions & 9 deletions cli/lib/build.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
// Copyright 2018-2025 the Deno authors. MIT license.

fn main() {
// todo(dsherret): remove this after Deno 242.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.4.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");
Expand Down
14 changes: 9 additions & 5 deletions cli/lib/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub fn otel_runtime_config() -> OtelRuntimeConfig {

const GIT_COMMIT_HASH: &str = env!("GIT_COMMIT_HASH");
const TYPESCRIPT: &str = "5.9.2";
pub const DENO_VERSION: &str = env!("DENO_VERSION");
pub const DENO_VERSION: &str = env!("CARGO_PKG_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
Expand All @@ -40,9 +40,13 @@ pub static DENO_VERSION_INFO: std::sync::LazyLock<DenoVersionInfo> =

DenoVersionInfo {
deno: if release_channel == ReleaseChannel::Canary {
concat!(env!("DENO_VERSION"), "+", env!("GIT_COMMIT_HASH_SHORT"))
concat!(
env!("CARGO_PKG_VERSION"),
"+",
env!("GIT_COMMIT_HASH_SHORT")
)
} else {
env!("DENO_VERSION")
DENO_VERSION
},

release_channel,
Expand All @@ -53,12 +57,12 @@ pub static DENO_VERSION_INFO: std::sync::LazyLock<DenoVersionInfo> =
user_agent: if release_channel == ReleaseChannel::Canary {
concat!(
"Deno/",
env!("DENO_VERSION"),
env!("CARGO_PKG_VERSION"),
"+",
env!("GIT_COMMIT_HASH_SHORT")
)
} else {
concat!("Deno/", env!("DENO_VERSION"))
concat!("Deno/", env!("CARGO_PKG_VERSION"))
},

typescript: TYPESCRIPT,
Expand Down
1 change: 0 additions & 1 deletion cli/lib/version.txt

This file was deleted.

22 changes: 22 additions & 0 deletions tools/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ if (js) {
promises.push(dlintPreferPrimordials());
promises.push(ensureCiYmlUpToDate());
promises.push(ensureNoUnusedOutFiles());
promises.push(ensureCliVersionMatchesLibVersion());

if (rs) {
promises.push(checkCopyright());
Expand Down Expand Up @@ -381,3 +382,24 @@ async function ensureNoUnusedOutFiles() {
throw new Error(`${notFoundPaths.length} unreferenced .out files`);
}
}

async function ensureCliVersionMatchesLibVersion() {
function extractVersion(text) {
const match = text.match(/^version\s*=\s*"([^"]+)"/m);
if (!match?.[1]) {
throw new Error("Could not find version in TOML");
}
return match[1];
}

const cliCrateTomlText = await Deno.readTextFile(
join(ROOT_PATH, "cli/Cargo.toml"),
);
const libCrateTomlText = await Deno.readTextFile(
join(ROOT_PATH, "cli/lib/Cargo.toml"),
);

if (extractVersion(cliCrateTomlText) !== extractVersion(libCrateTomlText)) {
throw new Error("deno crate version did not match deno_lib crate version");
}
}
12 changes: 7 additions & 5 deletions tools/release/01_bump_crate_versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if (Deno.args.some((a) => a === "--rc")) {

await cliCrate.setVersion(version);
await denoRtCrate.setVersion(version);
denoLibCrate.folderPath.join("version.txt").writeTextSync(version);
await denoLibCrate.setVersion(version);
// Force lockfile update
await workspace.getCliCrate().cargoUpdate("--workspace");

Expand All @@ -44,14 +44,16 @@ if (Deno.args.some((a) => a === "--patch")) {
await cliCrate.promptAndIncrement();
}

await denoRtCrate.setVersion(cliCrate.version);
denoLibCrate.folderPath.join("version.txt").writeTextSync(cliCrate.version);

// increment the dependency crate versions
for (const crate of workspace.getCliDependencyCrates()) {
await crate.increment("minor");
if (crate.name !== denoLibCrate.name) {
await crate.increment("minor");
}
}

await denoRtCrate.setVersion(cliCrate.version);
await denoLibCrate.setVersion(cliCrate.version);

// update the lock file
await workspace.getCliCrate().cargoUpdate("--workspace");
await assertDenoBinaryVersion(cliCrate.version);
Expand Down
Loading