mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 09:31:22 -05:00
refactor(cli/build.rs): extract ts version (#7127)
This commit is contained in:
parent
2600d5ac09
commit
111a2fbe3e
2 changed files with 11 additions and 4 deletions
13
cli/build.rs
13
cli/build.rs
|
@ -71,8 +71,17 @@ fn create_compiler_snapshot(
|
|||
}
|
||||
|
||||
fn ts_version() -> String {
|
||||
// TODO(ry) This should be automatically extracted from typescript.js
|
||||
"3.9.7".to_string()
|
||||
std::fs::read_to_string("tsc/00_typescript.js")
|
||||
.unwrap()
|
||||
.lines()
|
||||
.find(|l| l.contains("ts.version = "))
|
||||
.expect(
|
||||
"Failed to find the pattern `ts.version = ` in typescript source code",
|
||||
)
|
||||
.chars()
|
||||
.skip_while(|c| !char::is_numeric(*c))
|
||||
.take_while(|c| *c != '"')
|
||||
.collect::<String>()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
2
cli/dts/README.md
vendored
2
cli/dts/README.md
vendored
|
@ -7,8 +7,6 @@ It works like this currently:
|
|||
1. Checkout typescript repo in a seperate directory.
|
||||
2. Copy typescript.js into Deno repo
|
||||
3. Copy d.ts files into dts directory
|
||||
4. Update `ts_version()` in `cli/build.rs`
|
||||
https://github.com/denoland/deno/blob/452693256ce7b607fa0b9454b22c57748f616742/cli/build.rs#L73-L76
|
||||
|
||||
So that might look something like this:
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue