4 ms·
I think there's some ambiguity here around LTS for the project itself vs its dependencies, but as one concrete example, I support node 4 for an open source proj
by alangpierce 9y ago
I think there's some ambiguity here around LTS for the project itself vs its dependencies, but as one concrete example, I support node 4 for an open source project I maintain, and I would defend that decision.
In my case, the only additional effort needed for node 4 is to use Array.prototype.indexOf instead of Array.prototype.includes, which is mildly annoying, and sometimes I forget and it causes a failure of the node 4 CI build, but really it's not that big of a deal. TypeScript handles the rest of the JS stuff, and the project doesn't use enough of the node API for those differences to matter. Other projects may different, but I think the right call is to drop support for old node versions when maintaining them is hard or because nobody is using them, not simply because they're old.
I want to use open source projects at work, not just in side projects, and at work we're on node 6 and always lag behind the latest node release by some amount, partly because upgrading node is a real project. We're a startup, not a massive enterprise, but it's still pragmatic to focus on real work instead of upgrading our dependencies all the time. If all of the open source projects out there only supported node 8, I think it would make them much less useful in the real world.
- Zarel 9y agoWhy not just polyfill `Array.prototype.includes`? That's what my project does when the only features we care about missing from an old release are polyfillable. Object.defineProperty(Array.prototype, 'includes', { // eslint-disable-line no-extend-native writable: true, configurable: true, value: function (object) { return this.indexOf(object) !== -1; }, }); Or if you're sure you and your libraries don't use any bad coding practices, you could even do: Array.prototype.includes = function (object) { // eslint-disable-line no-extend-native return this.indexOf(object) !== -1; }
- alangpierce 9y agoThat's what I'd do in an application, but it's bad manners to modify the global Array.prototype from a library, or to expect your parent application to provide such a polyfill, so usually it's best to just avoid polyfills in open source libraries.