Skip to content

Commit

Permalink
Revert "Simplify the code according to Zaid suggestion"
Browse files Browse the repository at this point in the history
This reverts commit 803b118.
  • Loading branch information
Maxime Mangel committed Jun 27, 2019
1 parent 803b118 commit a1eccfb
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -648,19 +648,21 @@ let executeResolutionActions (cwd: string) (manager: NodeManager) (actions: Reso
ignore()

let private validateProject (library : LibraryWithNpmDeps) =
library.NpmDependencies
|> List.forall (fun (pkg : NpmDependency) ->
(true, library.NpmDependencies)
||> List.fold (fun (state : bool) (pkg : NpmDependency) ->
logger.Information("{Library} requires npm package {Package}", library.Name, pkg.Name)
logger.Information(" | -- Required range {Range}", pkg.RawVersion)
logger.Information(" | -- Resolution strategy '{Strategy}'", if pkg.LowestMatching then "Min" else "Max")
let isCurrentPkgOk =
match getSatisfyingPackageVersion NodeManager.Npm pkg with
| Some version ->
logger.Information(" | -- √ Found version {Version} that satisfies the required range", version)
true
| None ->
logger.Error(" | -- Could not find a version that satisfies the required range {Range}", pkg.RawVersion)
false

match getSatisfyingPackageVersion NodeManager.Npm pkg with
| Some version ->
logger.Information(" | -- √ Found version {Version} that satisfies the required range", version)
true
| None ->
logger.Error(" | -- Could not find a version that satisfies the required range {Range}", pkg.RawVersion)
false
state && isCurrentPkgOk
)


Expand Down Expand Up @@ -710,7 +712,10 @@ let rec private runner (args : FemtoArgs) =
let libraries = findLibraryWithNpmDeps crackedProject

let isValid =
libraries |> List.forall validateProject
(true, libraries)
||> List.fold (fun (state : bool) (library : LibraryWithNpmDeps) ->
validateProject library && state
)

if isValid then
logger.Information("Validation result: Success")
Expand Down

0 comments on commit a1eccfb

Please sign in to comment.