npm shrinkwrap fix
See original GitHub issueWhat is the current behaviour ?
Installing discord.js
from NPM repository works but trying to use npm shrinkwrap
you are required to install packages mentioned in peerDependencies
and they are locked down in your tree.
The result is a series of committed or non-committed packages added to your installation tree if you use npm shrinkwrap
, a more tedious and error-prone process than installing discord.js
with all peers and semantically equivalent.
What is the expected behaviour ?
You should be able to install discord.js
as normal without the extra packages required for voice communication, sockets, etc. Immediately trying to shrinkwrap
would still fail and point you to install the discord.js-extra
(naming suggestions wanted) which contains the extra packages required in optionalDependencies
.
A user requiring to shrinkwrap
would have a dedicated paragraph in the README where the NPM documented default behaviour is given an example:
npm install -S discord.js node-opus
npm install discord.js-extra --no-optional
npm shrinkwrap
A user not requiring to shrinkwrap
would follow current standard procedures since nobody wants breaking changes !
What changes does this issue involve ?
For a successful npm shrinkwrap
to work with a random number of extra packages (as required) I could identify the following changes needed:
- removing
peerDependencies
content in favour ofdiscord.js-extra
- creating and maintaining a
discord.js-extra
NPM package with currentpeerDependencies
listed asoptionalDependencies
- amending the README with information on how to successfully run
npm shrinkwrap
Please check this out @Gawdl3y @hydrabolt
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (6 by maintainers)
NPM has been, currently is, and at this rate, always will be garbage in some way/shape/form. There are various aspects of it that are fundamentally broken, and show no signs of improving any time in the near future. I have no interest in working around its deficiencies, especially when it complicates things that little bit more, for both us (the lib devs) and our users. Using peer dependencies is already “wrong”, and is simply a band-aid fix for NPM’s optional dependency support being absolute trash. “Fixing” shrinkwrap by moving the peer dependencies to a separate package really does very little to help anything. It potentially makes the life of the majority of the user base slightly more difficult, in order to support a feature of NPM that isn’t even commonly used. And best of all, you still won’t be able to use shrinkwrap if you want to use any of the optional packages (unless you manually ensure it is within the correct version range, and don’t install the theoretical
discord.js-extra
package).And to respond to other things you mention:
npm shrinkwrap
that I’ve seen.(The above link is wrong, it should be https://yorkaargh.gitbooks.io/discord-js-bot-guide/)