From 614f220e7b6ed8d28548e6fc87b1dd51a37208d8 Mon Sep 17 00:00:00 2001 From: jchassaing Date: Thu, 19 Jun 2025 00:30:36 +0200 Subject: [PATCH 1/2] fix: fix .fs file package directory --- src/build/Fable.Package.SDK.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/build/Fable.Package.SDK.targets b/src/build/Fable.Package.SDK.targets index aef5dcf..27ea019 100644 --- a/src/build/Fable.Package.SDK.targets +++ b/src/build/Fable.Package.SDK.targets @@ -10,7 +10,7 @@ <_PackageFiles Include="@(Compile)"> true - fable/%(RecursiveDir)%(Filename)%(Extension) + fable/%(RelativeDir)%(Filename)%(Extension) None From b08d928f6b9835a910ec473aeabdc2ec83a53d38 Mon Sep 17 00:00:00 2001 From: Maxime Mangel Date: Fri, 20 Jun 2025 22:26:34 +0200 Subject: [PATCH 2/2] test: add test case to verify we respect folders --- tests/Main.fs | 28 +++++++++++++++++++ tests/Workspace.fs | 4 +++ .../library-with-files-and-folder/Entry.fs | 3 ++ .../Global/Version.fs | 3 ++ .../MyLibrary.fsproj | 13 +++++++++ 5 files changed, 51 insertions(+) create mode 100644 tests/fixtures/valid/library-with-files-and-folder/Entry.fs create mode 100644 tests/fixtures/valid/library-with-files-and-folder/Global/Version.fs create mode 100644 tests/fixtures/valid/library-with-files-and-folder/MyLibrary.fsproj diff --git a/tests/Main.fs b/tests/Main.fs index 19faa8b..bd743a4 100644 --- a/tests/Main.fs +++ b/tests/Main.fs @@ -321,3 +321,31 @@ let ``should include the source file and the project file under 'fable' folder - Assert.That(entries, Contains.Item("fable/MyLibraryMultiTFM.fsproj")) } + +[] +let ``should include the sources files by respecting the folder structure and the project file under 'fable' folder`` () = + task { + // Make sure we work with a fresh nupkg file + let fileInfo = + VirtualWorkspace.fixtures.valid.``library-with-files-and-folder``.bin.Release.``MyLibrary.1.0.0.nupkg`` + |> FileInfo + + if fileInfo.Exists then + fileInfo.Delete() + + Command.Run( + "dotnet", + $"pack %s{Workspace.fixtures.valid.``library-with-files-and-folder``.``MyLibrary.fsproj``}" + ) + + let archive = + ZipFile.OpenRead( + VirtualWorkspace.fixtures.valid.``library-with-files-and-folder``.bin.Release.``MyLibrary.1.0.0.nupkg`` + ) + + let entries = archive.Entries |> Seq.map (fun entry -> entry.FullName) |> Seq.toList + + Assert.That(entries, Contains.Item("fable/Entry.fs")) + Assert.That(entries, Contains.Item("fable/Global/Version.fs")) + Assert.That(entries, Contains.Item("fable/MyLibrary.fsproj")) + } diff --git a/tests/Workspace.fs b/tests/Workspace.fs index 75c2ccb..5e0d9ca 100644 --- a/tests/Workspace.fs +++ b/tests/Workspace.fs @@ -18,4 +18,8 @@ fixtures/ bin/ Release/ MyLibraryMultiTFM.1.0.0.nupkg + library-with-files-and-folder/ + bin/ + Release/ + MyLibrary.1.0.0.nupkg """> diff --git a/tests/fixtures/valid/library-with-files-and-folder/Entry.fs b/tests/fixtures/valid/library-with-files-and-folder/Entry.fs new file mode 100644 index 0000000..633676c --- /dev/null +++ b/tests/fixtures/valid/library-with-files-and-folder/Entry.fs @@ -0,0 +1,3 @@ +module MyLibrary + +let answer = 42 diff --git a/tests/fixtures/valid/library-with-files-and-folder/Global/Version.fs b/tests/fixtures/valid/library-with-files-and-folder/Global/Version.fs new file mode 100644 index 0000000..b167f72 --- /dev/null +++ b/tests/fixtures/valid/library-with-files-and-folder/Global/Version.fs @@ -0,0 +1,3 @@ +module Global + +let version = "1.0.0" diff --git a/tests/fixtures/valid/library-with-files-and-folder/MyLibrary.fsproj b/tests/fixtures/valid/library-with-files-and-folder/MyLibrary.fsproj new file mode 100644 index 0000000..ab981fd --- /dev/null +++ b/tests/fixtures/valid/library-with-files-and-folder/MyLibrary.fsproj @@ -0,0 +1,13 @@ + + + + netstandard2.0 + library + fable-javascript + + + + + + +