From c13d8ad35a7922e7e852a80bfcf58bc5da5e6fa0 Mon Sep 17 00:00:00 2001 From: Tomas Leko Date: Mon, 10 Jun 2024 14:47:52 +0200 Subject: [PATCH] use case insensitive comparison when searching for dependencies between fable packages (#3835) * use case insensitive comparison when searching for dependencies between fable packages * chore: Update changelog --------- Co-authored-by: tom Co-authored-by: Maxime Mangel --- src/Fable.Cli/CHANGELOG.md | 1 + src/Fable.Compiler/ProjectCracker.fs | 6 +++++- src/fable-compiler-js/CHANGELOG.md | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Fable.Cli/CHANGELOG.md b/src/Fable.Cli/CHANGELOG.md index 28b0a3e063..3ad2ed1c4a 100644 --- a/src/Fable.Cli/CHANGELOG.md +++ b/src/Fable.Cli/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed * [TS] Fixed interface indexers (#3830) (by @ncave) +* [GH-3835](https://github.com/fable-compiler/Fable/pull/3835) [All] Use case insensitive comparison when searching for dependencies between fable packages (by @ThisFunctionalTom) ## 4.18.0 - 2024-05-23 diff --git a/src/Fable.Compiler/ProjectCracker.fs b/src/Fable.Compiler/ProjectCracker.fs index 95fe64c2a8..f68318a636 100644 --- a/src/Fable.Compiler/ProjectCracker.fs +++ b/src/Fable.Compiler/ProjectCracker.fs @@ -303,7 +303,11 @@ let tryGetFablePackage (opts: CrackerOptions) (dllPath: string) = let sortFablePackages (pkgs: FablePackage list) = ([], pkgs) ||> List.fold (fun acc pkg -> - match List.tryFindIndexBack (fun (x: FablePackage) -> pkg.Dependencies.Contains(x.Id)) acc with + let isPkgDependency (dependency: FablePackage) = + pkg.Dependencies + |> Set.exists (fun dep -> dep.ToLowerInvariant() = dependency.Id.ToLowerInvariant()) + + match List.tryFindIndexBack isPkgDependency acc with | None -> pkg :: acc | Some targetIdx -> let rec insertAfter x targetIdx i before after = diff --git a/src/fable-compiler-js/CHANGELOG.md b/src/fable-compiler-js/CHANGELOG.md index 65188681dd..31578da5fb 100644 --- a/src/fable-compiler-js/CHANGELOG.md +++ b/src/fable-compiler-js/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Fixed + +* [GH-3835](https://github.com/fable-compiler/Fable/pull/3835) [All] Use case insensitive comparison when searching for dependencies between fable packages (by @ThisFunctionalTom) + ## 1.2.2 - 2024-05-24 ### Fixed