npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

Specify destination folder and filter on files (inspired by libman)

A lot of packages contains minified and bundled files and npm is becoming default package manager also for client side libraries instead of bower.

In some scenarios, it is not necessary to download entire package with all it’s dependencies. For example, I might be interested only in jquery/dist/jquery.min.js or jquery/dist/*.*, or bootstrap/scss/**/*.scss.

Additionally,
it might be useful to specify target folder for these files, so that no additional build task to copy the files to my build output will be necessary, e.g:

{
  "name": "my-app",
  "dependencies": {
    "bootstrap": {
         version: "^4.1.3",
         files: ["dist/js/bootstrap.bundle.min.js", "dist/css/bootstrap.min.css"],
         destination: "wwwroot/lib/bootstrap"
     },
  },
}

This would be especially useful in server rendered apps.

These features are inspired by libman.


Any feedback on this? Good or bad idea?