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
24
23
25
24
#### :nail_care : Polish
26
25
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env node
2
- const server = require ( "./server" )
2
+ import fs from "fs" ;
3
+ import server from "./server" ;
4
+
3
5
const args = process . argv . slice ( 2 )
4
6
5
7
const help = `ReScript Language Server
@@ -21,7 +23,7 @@ Options:
21
23
return server ( false ) ;
22
24
case '--version' :
23
25
case '-v' :
24
- console . log ( require ( '.. /package.json') . version ) ;
26
+ console . log ( JSON . parse ( fs . readFileSync ( '. /package.json', { encoding : 'utf8' } ) ) . version ) ;
25
27
process . exit ( 0 ) ;
26
28
case '--help' :
27
29
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
27
26
- 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
- @val external require : string => Js . Dict . t < string > = "require "
3
+ @module ( "fs" ) external readFileSync : string => string = "readFileSync "
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 require (".. /package.json" )-> Js .Dict . get ( "version" ) {
92
+ switch readFileSync ("./package.json" )-> Js .Json . parseExn -> Js . Json . decodeObject {
93
93
| 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 )
95
95
}
96
96
| _ => logAndExit (~log = help , ~code = 1 )
97
97
}
You can’t perform that action at this time.
0 commit comments