aspnet / LibraryManager

MIT License
458 stars 83 forks source link

Subdirectories are not copied by the file system provider #350

Open FranklinWhale opened 6 years ago

FranklinWhale commented 6 years ago

Functional impact

If libraries.library is specified without packages.files, it is expected all files and subdirectories are copied to the destination. Currently it is not the case, as only files are copied. As a result, all subdirectories of a library have to be listed as library in libman.json for them to be copied.

Minimal repro steps

Prerequisites: .NET Core SDK, Node.js

  1. Create a ASP.NET Core Razor page project
  2. Install Node.js
  3. Run npm install bootstrap
  4. Run dotnet add package Microsoft.Web.LibraryManager.Build
  5. Create a file named libman.json with the content below:
    {
    "version": "1.0",
    "libraries": [
        {
            "provider": "filesystem",
            "library": "node_modules/bootstrap/dist",
            "destination": "wwwroot/lib/bootstrap"
        }
    ]
    }
  6. Run dotnet build
  7. Check the content inside wwwroot/lib/bootstrap

Expected result

All files and subdirectories under node_modules/bootstrap/dist are copied to wwwroot/lib/bootstrap

Actual result

Only the .DS_Store file, which is under node_modules/bootstrap/dist, is coped

chucker commented 5 years ago

I stumbled upon this as well, but I wonder if this is by design. You can already cherrypick files to copy (though leaving that property out will implicitly copy all).

Possible approaches:

ronnieoverby commented 4 years ago

A year later...

You can't even cherry pick files not in the package root. Pretty useless!

This seems to work for me, though:

    {
      "library": "node_modules/datatables.net-bs4/css/",
      "destination": "wwwroot/lib/datatables.net-bs4/css/"
    },
    {
      "library": "node_modules/datatables.net-bs4/js/",
      "destination": "wwwroot/lib/datatables.net-bs4/js/"
    }
Varorbc commented 2 years ago

@jimmylewis Is there any update?

saravanansomu commented 2 years ago

this issue is blocking. Using LibMan, we are unable to copy over all files (including sub-directories) into the destination. Is it still not fixed?

lawrence6140791 commented 1 year ago

@jimmylewis filesystem provider still doesn't handle recursive cases.