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
2324
2425#### :nail_care : Polish
2526
Original file line number Diff line number Diff line change 11#!/usr/bin/env node
2- import fs from "fs" ;
3- import server from "./server" ;
4-
2+ const server = require ( "./server" )
53const args = process . argv . slice ( 2 )
64
75const help = `ReScript Language Server
@@ -23,7 +21,7 @@ Options:
2321 return server ( false ) ;
2422 case '--version' :
2523 case '-v' :
26- console . log ( JSON . parse ( fs . readFileSync ( '. /package.json', { encoding : 'utf8' } ) ) . version ) ;
24+ console . log ( require ( '.. /package.json') . version ) ;
2725 process . exit ( 0 ) ;
2826 case '--help' :
2927 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
2627- 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- @module ( "fs" ) external readFileSync : string => string = "readFileSync "
3+ @val external require : string => Js . Dict . t < string > = "require "
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 readFileSync ("./package.json" )-> Js .Json . parseExn -> Js . Json . decodeObject {
92+ switch require (".. /package.json" )-> Js .Dict . get ( "version" ) {
9393 | 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 )
9595 }
9696| _ => logAndExit (~log = help , ~code = 1 )
9797}
You can’t perform that action at this time.
0 commit comments