3 ms·
>If you only need a small amount of relatively simple code and the license allows it, then just copy that code into your project. I disagree with this. With a
by Klathmon 10y ago
>If you only need a small amount of relatively simple code and the license allows it, then just copy that code into your project.
I disagree with this. With a good dependency management system, this should almost never be done, even for the most trivial code. If you find it somewhere else, and it's published as a "dependency" (module, package, etc...), you should install it as such.
Lock the version, vendor your dependencies, keep a copy of the full source, but don't just copy it into your project.
Even trivial code snippets "decay", and being able to look at a piece of code that "decayed" and see that there was an update 6 months ago that fixed the problem will save time over trying to follow code copied into your code base, a possibly out-of-date comment saying where it came from, and the chance that anyone could have modified it from it's original without updating the comment in the meantime.
I think of a dependency is "copy-paste with metadata", and throwing out that metadata seems like a bad idea.
Is there something I'm missing or have completely wrong, as I seem to see this being advocated for more and more, especially in the javascript ecosystem?