|
|
@ -36,9 +36,13 @@ module Local = { |
|
|
|
let getLatestInstalledNameByPrefix = prefix => { |
|
|
|
let getLatestInstalledNameByPrefix = prefix => { |
|
|
|
open Lwt; |
|
|
|
open Lwt; |
|
|
|
let%lwt versions = |
|
|
|
let%lwt versions = |
|
|
|
Fs.readdir(Directories.nodeVersions) |
|
|
|
Lwt.catch( |
|
|
|
>|= List.filter(isVersionFitsPrefix(prefix)) |
|
|
|
() => |
|
|
|
>|= List.sort(flip(compare)); |
|
|
|
Fs.readdir(Directories.nodeVersions) |
|
|
|
|
|
|
|
>|= List.filter(isVersionFitsPrefix(prefix)) |
|
|
|
|
|
|
|
>|= List.sort(flip(compare)), |
|
|
|
|
|
|
|
_ => Lwt.return_nil, |
|
|
|
|
|
|
|
); |
|
|
|
switch (versions) { |
|
|
|
switch (versions) { |
|
|
|
| [version, ...xs] => Lwt.return_some(version) |
|
|
|
| [version, ...xs] => Lwt.return_some(version) |
|
|
|
| [] => Lwt.return_none |
|
|
|
| [] => Lwt.return_none |
|
|
@ -291,8 +295,8 @@ let parse = version => { |
|
|
|
let aliasPath = Aliases.toDirectory(version); |
|
|
|
let aliasPath = Aliases.toDirectory(version); |
|
|
|
let versionPath = Local.toDirectory(formattedVersion); |
|
|
|
let versionPath = Local.toDirectory(formattedVersion); |
|
|
|
|
|
|
|
|
|
|
|
let%lwt aliasExists = Lwt_unix.file_exists(aliasPath) |
|
|
|
let%lwt aliasExists = Fs.exists(aliasPath) |
|
|
|
and versionExists = Lwt_unix.file_exists(versionPath) |
|
|
|
and versionExists = Fs.exists(versionPath) |
|
|
|
and versionByPrefixPath = |
|
|
|
and versionByPrefixPath = |
|
|
|
Local.getLatestInstalledNameByPrefix(formattedVersion); |
|
|
|
Local.getLatestInstalledNameByPrefix(formattedVersion); |
|
|
|
|
|
|
|
|
|
|
|