File tree 4 files changed +7
-7
lines changed
4 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 20
20
21
21
- Proper default for ` "uncurried" ` in V11 projects. https://github.com/rescript-lang/rescript-vscode/pull/867
22
22
- 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
23
24
24
25
#### :nail_care : Polish
25
26
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env node
2
- import fs from "fs" ;
3
- import server from "./server" ;
4
-
2
+ const server = require ( "./server" )
5
3
const args = process . argv . slice ( 2 )
6
4
7
5
const help = `ReScript Language Server
@@ -23,7 +21,7 @@ Options:
23
21
return server ( false ) ;
24
22
case '--version' :
25
23
case '-v' :
26
- console . log ( JSON . parse ( fs . readFileSync ( '. /package.json', { encoding : 'utf8' } ) ) . version ) ;
24
+ console . log ( require ( '.. /package.json') . version ) ;
27
25
process . exit ( 0 ) ;
28
26
case '--help' :
29
27
case '-h' :
Original file line number Diff line number Diff line change 23
23
#### :bug : Bug Fix
24
24
25
25
- 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
26
27
- 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 1
1
@@directive ("#!/usr/bin/env node" )
2
2
3
- @module ( "fs" ) external readFileSync : string => string = "readFileSync "
3
+ @val external require : string => Js . Dict . t < string > = "require "
4
4
@variadic @module ("path" ) external join : array <string > => string = "join"
5
5
@module ("path" ) external dirname : string => string = "dirname"
6
6
@val external __dirname : string = "__dirname"
@@ -89,9 +89,9 @@ switch args->Belt.List.fromArray {
89
89
}
90
90
| list {"-h" | "--help" } => logAndExit (~log = help , ~code = 0 )
91
91
| list {"-v" | "--version" } =>
92
- switch readFileSync ("./package.json" )-> Js .Json . parseExn -> Js . Json . decodeObject {
92
+ switch require (".. /package.json" )-> Js .Dict . get ( "version" ) {
93
93
| None => logAndExit (~log = "error: failed to find version in package.json" , ~code = 1 )
94
- | Some (dict ) => logAndExit (~log = dict -> Js . Dict . unsafeGet ( " version" ) , ~code = 0 )
94
+ | Some (version ) => logAndExit (~log = version , ~code = 0 )
95
95
}
96
96
| _ => logAndExit (~log = help , ~code = 1 )
97
97
}
You can’t perform that action at this time.
0 commit comments