@@ -11,6 +11,22 @@ let makePathsForModule ~projectFilesAndPaths ~dependenciesFilesAndPaths =
11
11
Hashtbl. replace pathsForModule modName paths);
12
12
pathsForModule
13
13
14
+ let getReScriptVersion () =
15
+ (* TODO: Include patch stuff when needed *)
16
+ let defaultVersion = (10 , 1 ) in
17
+ try
18
+ let value = Sys. getenv " RESCRIPT_VERSION" in
19
+ let version =
20
+ match value |> String. split_on_char '.' with
21
+ | major :: minor :: _rest -> (
22
+ match (int_of_string_opt major, int_of_string_opt minor) with
23
+ | Some major , Some minor -> (major, minor)
24
+ | _ -> defaultVersion)
25
+ | _ -> defaultVersion
26
+ in
27
+ version
28
+ with Not_found -> defaultVersion
29
+
14
30
let newBsPackage ~rootPath =
15
31
let rescriptJson = Filename. concat rootPath " rescript.json" in
16
32
let bsconfigJson = Filename. concat rootPath " bsconfig.json" in
@@ -27,9 +43,12 @@ let newBsPackage ~rootPath =
27
43
| Some libBs ->
28
44
Some
29
45
(let namespace = FindFiles. getNamespace config in
46
+ let rescriptVersion = getReScriptVersion () in
30
47
let uncurried =
31
48
let ns = config |> Json. get " uncurried" in
32
- Option. bind ns Json. bool
49
+ match (rescriptVersion, ns) with
50
+ | (major , _ ), None when major > = 11 -> Some true
51
+ | _ , ns -> Option. bind ns Json. bool
33
52
in
34
53
let uncurried = uncurried = Some true in
35
54
let sourceDirectories =
@@ -93,6 +112,7 @@ let newBsPackage ~rootPath =
93
112
(" Opens from ReScript config file: "
94
113
^ (opens |> List. map pathToString |> String. concat " " ));
95
114
{
115
+ rescriptVersion;
96
116
rootPath;
97
117
projectFiles =
98
118
projectFilesAndPaths |> List. map fst |> FileSet. of_list;
0 commit comments