diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2019-09-15 18:36:27 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-15 18:36:27 -0400 |
commit | c9ef182886cc07d35a5b27fb89163d8cf21a6a47 (patch) | |
tree | 6ba1605daa7e9e8cac3f6b926374086906f571b5 /cli | |
parent | 1d305c2ac785af6b28649f2023d5008e390eeca0 (diff) |
Make deno_cli installable via crates.io (#2946)
- Fixes cargo publish on deno_typescript, deno_cli_snapshots, and
deno_cli.
- Combines cli_snapshots and js into one directory.
- Extracts TS version at compile time rather than runtime
- Bumps version awkwardly - it was necessary to test end-to-end
publishing. Sorry.
- Adds git submodule deno_typescript/typescript
Diffstat (limited to 'cli')
-rw-r--r-- | cli/Cargo.toml | 12 | ||||
-rw-r--r-- | cli/assets.rs | 8 | ||||
-rw-r--r-- | cli/main.rs | 7 | ||||
-rw-r--r-- | cli/ops/compiler.rs | 3 | ||||
-rw-r--r-- | cli/ops/os.rs | 2 | ||||
-rw-r--r-- | cli/version.rs | 12 |
6 files changed, 14 insertions, 30 deletions
diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 971f2716a..cf51781fa 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -5,12 +5,18 @@ path = "main.rs" [package] name = "deno_cli" -version = "0.18.0" +version = "0.18.3" +license = "MIT" +authors = ["the Deno authors"] edition = "2018" +description = "Provides the deno executable" +repository = "https://github.com/denoland/deno" default-run = "deno" [dependencies] -deno = { path = "../core" } +deno = { path = "../core", version = "0.18.0" } +deno_cli_snapshots = { path = "../js", version = "0.18.3" } +deno_typescript = { path = "../deno_typescript", version = "0.18.3" } ansi_term = "0.12.1" atty = "0.2.13" @@ -45,8 +51,6 @@ tokio-rustls = "0.10.0" tokio-threadpool = "0.1.15" url = "1.7.2" utime = "0.2.1" -deno_cli_snapshots = { path = "../cli_snapshots" } -deno_typescript = { path = "../deno_typescript" } [target.'cfg(windows)'.dependencies] winapi = "0.3.8" diff --git a/cli/assets.rs b/cli/assets.rs deleted file mode 100644 index a0abca115..000000000 --- a/cli/assets.rs +++ /dev/null @@ -1,8 +0,0 @@ -static DENO_RUNTIME: &str = include_str!("../js/lib.deno_runtime.d.ts"); - -pub fn get_source_code(name: &str) -> Option<&'static str> { - match name { - "lib.deno_runtime.d.ts" => Some(DENO_RUNTIME), - _ => deno_typescript::get_asset(name), - } -} diff --git a/cli/main.rs b/cli/main.rs index 554a36e59..e535b70bd 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -9,7 +9,7 @@ extern crate futures; extern crate serde_json; extern crate clap; extern crate deno; -extern crate deno_typescript; +extern crate deno_cli_snapshots; extern crate indexmap; #[cfg(unix)] extern crate nix; @@ -21,7 +21,6 @@ extern crate url; #[cfg(test)] mod integration_tests; -mod assets; mod colors; pub mod compilers; pub mod deno_dir; @@ -133,7 +132,7 @@ fn create_worker_and_state( } fn types_command() { - let content = assets::get_source_code("lib.deno_runtime.d.ts").unwrap(); + let content = deno_cli_snapshots::get_asset("lib.deno_runtime.d.ts").unwrap(); println!("{}", content); } @@ -405,7 +404,7 @@ fn run_script(flags: DenoFlags, argv: Vec<String>) { fn version_command() { println!("deno: {}", version::DENO); println!("v8: {}", version::v8()); - println!("typescript: {}", version::typescript()); + println!("typescript: {}", version::TYPESCRIPT); } fn main() { diff --git a/cli/ops/compiler.rs b/cli/ops/compiler.rs index 975e01ee1..2dd7422df 100644 --- a/cli/ops/compiler.rs +++ b/cli/ops/compiler.rs @@ -1,6 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. use super::dispatch_json::{Deserialize, JsonOp, Value}; -use crate::assets; use crate::state::ThreadSafeState; use crate::tokio_util; use deno::*; @@ -89,7 +88,7 @@ pub fn op_fetch_asset( _zero_copy: Option<PinnedBuf>, ) -> Result<JsonOp, ErrBox> { let args: FetchAssetArgs = serde_json::from_value(args)?; - if let Some(source_code) = assets::get_source_code(&args.name) { + if let Some(source_code) = deno_cli_snapshots::get_asset(&args.name) { Ok(JsonOp::Sync(json!(source_code))) } else { panic!("op_fetch_asset bad asset {}", args.name) diff --git a/cli/ops/os.rs b/cli/ops/os.rs index e44f0c5f2..d033dc9c3 100644 --- a/cli/ops/os.rs +++ b/cli/ops/os.rs @@ -38,7 +38,7 @@ pub fn op_start( "versionFlag": state.flags.version, "v8Version": version::v8(), "denoVersion": version::DENO, - "tsVersion": version::typescript(), + "tsVersion": version::TYPESCRIPT, "noColor": !colors::use_color(), "xevalDelim": state.flags.xeval_delim.clone(), "os": BUILD_OS, diff --git a/cli/version.rs b/cli/version.rs index 2c98a96d4..44e394d18 100644 --- a/cli/version.rs +++ b/cli/version.rs @@ -1,17 +1,7 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -use serde_json; pub const DENO: &str = env!("CARGO_PKG_VERSION"); +pub const TYPESCRIPT: &str = deno_cli_snapshots::TS_VERSION; pub fn v8() -> &'static str { deno::v8_version() } - -pub fn typescript() -> String { - // TODO: By using include_str! we are including the package.json into - // the deno binary using serde to decode it at runtime. This is suboptimal - // in space and time. We need to extract the TypeScript version at compile - // time instead. This will be easier after #2608. - let data = include_str!("../node_modules/typescript/package.json"); - let pkg: serde_json::Value = serde_json::from_str(data).unwrap(); - pkg["version"].as_str().unwrap().to_string() -} |