Skip to content

Commit 4ef8dfd

Browse files
authored
Merge pull request #237 from nyannyacha/cli-deno-version
feat: printing out deno version in command line
2 parents bd17322 + 060ae4f commit 4ef8dfd

File tree

5 files changed

+32
-2
lines changed

5 files changed

+32
-2
lines changed

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/cli/.env.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DENO_VERSION="1.37.2"

crates/cli/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ path = "src/main.rs"
1111
anyhow = { workspace = true }
1212
base = { path = "../base" }
1313
deno_core = { workspace = true }
14-
clap = { version = "4.0.29", features = ["cargo"] }
14+
clap = { version = "4.0.29", features = ["cargo", "string"] }
1515
env_logger = "0.10.0"
1616
log = { workspace = true }
1717
sb_graph = { path = "../sb_graph" }
1818
tokio.workspace = true
19+
20+
[build-dependencies]
21+
dotenv-build = { version = "0.1.1" }

crates/cli/build.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
use std::{env, path::Path};
2+
3+
fn main() {
4+
println!("cargo:rustc-env=TARGET={}", env::var("TARGET").unwrap());
5+
println!("cargo:rustc-env=PROFILE={}", env::var("PROFILE").unwrap());
6+
7+
dotenv_build::output(dotenv_build::Config {
8+
filename: Path::new(".env.build"),
9+
recursive_search: false,
10+
fail_if_missing_dotenv: true,
11+
})
12+
.unwrap();
13+
}

crates/cli/src/main.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ use std::sync::Arc;
1717
fn cli() -> Command {
1818
Command::new("edge-runtime")
1919
.about("A server based on Deno runtime, capable of running JavaScript, TypeScript, and WASM services")
20-
.version(crate_version!())
20+
.version(format!(
21+
"{}\ndeno {} ({}, {})",
22+
crate_version!(),
23+
env!("DENO_VERSION"),
24+
env!("PROFILE"),
25+
env!("TARGET")
26+
))
2127
.arg_required_else_help(true)
2228
.arg(
2329
arg!(-v --verbose "Use verbose output")

0 commit comments

Comments
 (0)