diff options
Diffstat (limited to 'cli/build.rs')
-rw-r--r-- | cli/build.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/cli/build.rs b/cli/build.rs index 4c87d15e0..df4211d8b 100644 --- a/cli/build.rs +++ b/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() { |