Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/build/Fable.Package.SDK.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<ItemGroup>
<_PackageFiles Include="@(Compile)">
<Pack>true</Pack>
<PackagePath>fable/%(RecursiveDir)%(Filename)%(Extension)</PackagePath>
<PackagePath>fable/%(RelativeDir)%(Filename)%(Extension)</PackagePath>
<BuildAction>None</BuildAction>
</_PackageFiles>

Expand Down
28 changes: 28 additions & 0 deletions tests/Main.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}

[<Test>]
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"))
}
4 changes: 4 additions & 0 deletions tests/Workspace.fs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@ fixtures/
bin/
Release/
MyLibraryMultiTFM.1.0.0.nupkg
library-with-files-and-folder/
bin/
Release/
MyLibrary.1.0.0.nupkg
""">
3 changes: 3 additions & 0 deletions tests/fixtures/valid/library-with-files-and-folder/Entry.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module MyLibrary

let answer = 42
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Global

let version = "1.0.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<FablePackageType>library</FablePackageType>
<PackageTags>fable-javascript</PackageTags>
</PropertyGroup>
<ItemGroup>
<Compile Include="Global/Version.fs" />
<Compile Include="Entry.fs" />
</ItemGroup>
<Import Project="./../../Fable.Package.SDK.Imports.props" />
</Project>
Loading