I think it's reasonable to err on the side of rolling your own for simple stuff instead of `npm install is-even` or whatever. But using other people's software is a net positive for both productivity and security for sufficiently complex applications. And the range from "simple" to "complex" is a continuum and it's not trivial to decide where on that continuum to draw the line.
As an added benefit it also collapses all contained dependencies license files into a single licenses.txt file too!
every time the external code gets updated
I do not keep my fork in sync afterwards. dependencies that come with
their own dependencies
Depends on the dependencies. If you give me an example, I can tell you what I would do.I'm assuming it isn't a security flaw, because ideally you would have fixed that already during your refactor.
There are certainly npm authors doing this already, feross[1] is a good example. That means you get packages like is-buffer[2].
[1]: https://www.npmjs.com/~feross [2]: https://github.com/feross/is-buffer/blob/master/index.js
export function isBuffer (obj) {
return obj != null && obj.constructor != null &&
typeof obj.constructor.isBuffer === 'function' &&
obj.constructor.isBuffer(obj)
}
Imho, there is no need to pull 10 files into my project to use one function. # Fork by TekMol of https://github.com/feross/is-buffer
# Which is MIT licensed by Feross Aboukhadijeh
I am actually never completely sure how to properly do this. Would the next forker write the following then? # Fork by Joe of https://github.com/tekmol/isBuffer
# Which is a fork by TekMol of https://github.com/feross/is-buffer
# Which is MIT licensed by Feross AboukhadijehOf course it's only appropriate to credit the author anyway, and one way to do that nicely is by following the license requirements. I just think "violation of the license" is a bit of an unnecessarily strong statement, given the triviality and the likely non-copyrightability of the code.
Your lawyer's opinion may vary.
And if the package is not "small enough", I guess it means it needs to be re-implemented from scratch? If a company is happy to pay you for that (and is aware of it), why not, it's fun actually, but not very productive.
uh, no. what would be even better if TC39 did something beyond window dressing and JS gets a sane standard API so these idiotic requirements for API fill in are no longer required.
These packages are required solely because JS has a crappy API and a vacuum was filled. This increases the surface for supply chain attacks, a la ua-parser-js in Oct.
Other languages have their own issues. But they also have saner stdlibs so the attack vectors are different.
Even ecosystems that do have developer kits with massive API surface area like you want (such as the ecosystem associated with the other TC39 initiative) had the good sense to define collections of common classes separately, speccing out their implementation as being optional. Then again, there's nothing stopping anyone from doing exactly that and just maintaining it outside the scope of the technical committee, a la Boost or Qt in the world of C++. The fact that people try doing this and fail to retain long-term interest from their short attention span colleagues gives you all the evidence you need for why the irreversible step of transmuting that work into a part of JS's core is a bad idea.
That would remove the most used libraries. You could make babel, express, lodash/underscore, moment and stuff like that core, sure. But then you still have people using lots of libraries, especially in the frontend world for components.
> Other languages have their own issues. But they also have saner stdlibs so the attack vectors are different.
There's also more of a culture of just writing things yourself.
This of course excludes the majority of packages out there. But apart from security, it has another benefit: These dependency very rarely break and need updates. So compared to projects with a more complex stack, projects with a lean stack are easier to maintain.
It would be great if there was a "single small file packages" movement so that more lean open source software will be created.