cli icon indicating copy to clipboard operation
cli copied to clipboard

[BUG] `bundledDependencies` does not bundle relevant executables

Open thw0rted opened this issue 4 years ago • 8 comments

Current Behavior:

Bundled dependencies do not export executables when packing.

Expected Behavior:

npm pack output should include scripts under .bin to launch any executables provided by the bundled depdency.

Steps To Reproduce:

  1. Install any dependency that exposes an executable, e.g. lws.
  2. Include this dependency in bundledDependencies
  3. npm pack
  4. The resulting artifact includes the bundledDependency under node_modules, but does not create a .bin directory at all, and so the depdency's executable(s) will not be available.

Environment:

  • WIn10 20H2
  • Node: 14.15.4
  • npm: 6.14.10

Notes

I see from https://github.com/npm/cli/issues/1689 that bundledDependencies does not currently do special handling of the dep's package.json, such as looking at the files field. It's probably impractical / undesirable to process the whole bin field from package.json during pack, but at least it would make sense to check the existing node_modules/.bin for scripts that exactly match the package name and include those in the output.

thw0rted avatar Jan 14 '21 13:01 thw0rted