File tree Expand file tree Collapse file tree 4 files changed +7
-7
lines changed Expand file tree Collapse file tree 4 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 2020
2121- Proper default for ` "uncurried" ` in V11 projects. https://github.com/rescript-lang/rescript-vscode/pull/867
2222- Treat ` result ` type as a proper built in type. https://github.com/rescript-lang/rescript-vscode/pull/860
23- - Fix ` rescript-language-server --version ` command. https://github.com/rescript-lang/rescript-vscode/pull/853
2423
2524#### :nail_care : Polish
2625
Original file line number Diff line number Diff line change 11#!/usr/bin/env node
2- const server = require ( "./server" )
2+ import fs from "fs" ;
3+ import server from "./server" ;
4+
35const args = process . argv . slice ( 2 )
46
57const help = `ReScript Language Server
@@ -21,7 +23,7 @@ Options:
2123 return server ( false ) ;
2224 case '--version' :
2325 case '-v' :
24- console . log ( require ( '.. /package.json') . version ) ;
26+ console . log ( JSON . parse ( fs . readFileSync ( '. /package.json', { encoding : 'utf8' } ) ) . version ) ;
2527 process . exit ( 0 ) ;
2628 case '--help' :
2729 case '-h' :
Original file line number Diff line number Diff line change 2323#### :bug : Bug Fix
2424
2525- Fix tagged variant for ` Module ` and add attr to interface files. https://github.com/rescript-lang/rescript-vscode/pull/866
26- - Fix ` rescript-tools --version ` command. https://github.com/rescript-lang/rescript-vscode/pull/853
2726- Fix output truncate when run ` rescript-tools doc path/to/file.res ` in a separate process. https://github.com/rescript-lang/rescript-vscode/pull/868
Original file line number Diff line number Diff line change 11@@directive ("#!/usr/bin/env node" )
22
3- @val external require : string => Js . Dict . t < string > = "require "
3+ @module ( "fs" ) external readFileSync : string => string = "readFileSync "
44@variadic @module ("path" ) external join : array <string > => string = "join"
55@module ("path" ) external dirname : string => string = "dirname"
66@val external __dirname : string = "__dirname"
@@ -89,9 +89,9 @@ switch args->Belt.List.fromArray {
8989 }
9090| list {"-h" | "--help" } => logAndExit (~log = help , ~code = 0 )
9191| list {"-v" | "--version" } =>
92- switch require (".. /package.json" )-> Js .Dict . get ( "version" ) {
92+ switch readFileSync ("./package.json" )-> Js .Json . parseExn -> Js . Json . decodeObject {
9393 | None => logAndExit (~log = "error: failed to find version in package.json" , ~code = 1 )
94- | Some (version ) => logAndExit (~log = version , ~code = 0 )
94+ | Some (dict ) => logAndExit (~log = dict -> Js . Dict . unsafeGet ( " version" ) , ~code = 0 )
9595 }
9696| _ => logAndExit (~log = help , ~code = 1 )
9797}
You can’t perform that action at this time.
0 commit comments