News for hackers. Stuff that matters.
Re:A one-line package broke `npm create-react-app` by Pfhreak on Saturday April 25, 2020 @03:45PM (#22980804)
What's the difference between a utility file and a package? That seems like a distinction without a difference to me.

If you use the same one liners in more than one project and you copy that utility file over, the line gets even fuzzier.

Re:A one-line package broke `npm create-react-app` by Ndymium on Saturday April 25, 2020 @04:39PM (#22981259)
The utility file will never be updated and break your build without you doing it yourself.
Re:A one-line package broke `npm create-react-app` by hombre_fatal on Saturday April 25, 2020 @09:43PM (#22983500)
Also you can just read the code the same way you read any other code. And since it's in your codebase and git diffs, you will read it.

Because the implementation detail of is-promise actually is important. It just checks if an object has a .then() method. So if you use it, it's just as important that you know the limitation.

Not everything needs to be swept under the rug.

Re:A one-line package broke `npm create-react-app` by darekkay on Sunday April 26, 2020 @05:32AM (#22985839)
Also: The utility file will never be updated and fix existing issues within the utility itself (unless you look up the package and diff it yourself). It's a trade-off.
Re:A one-line package broke `npm create-react-app` by jhanschoo on Sunday April 26, 2020 @07:40AM (#22986404)
As the commenter who suggested keeping it in a utilities file, I'd say that the trade-off is heavily weighted to not importing it as a package.

When you cribbed the code you should have completely understood what exactly the package was doing, and why, and known what issues it would have had. Since it's a one-liner, it is transparent. Since it is without dependencies, it is unlikely to fail on old code. So it's unlikely to have existing issues and unlikely to develop new issues.

Of course, if you end up using new features of the language in your code, it may fail on that, but the risk old stuff failing should have already been factored in when you decided to upgrade. In fact, the one-liner solves this better since you decide the pace of adaptation of your one-liner to the new features, not the package maintainer.

Re:A one-line package broke `npm create-react-app` by darekkay on Sunday April 26, 2020 @08:59AM (#22986830)
That's the trade-off I would most likely take in the "isPromise" case. But the opening question was a generic one ("What's the difference between a utility file and a package"), so the answer should reflect both sides.