News for hackers. Stuff that matters.
Re:Modern Javascript: Everything you missed over the last 10... by neya on Saturday May 15, 2021 @01:31PM (#27167170)
I maintain systems written in Ruby, Elixir and PHP over the years. Every server side code written by me even as old as 5 years ago, works with very little modification required for today.

But the Javascript part is the one that always causes me hours-days worth of work into Rabbit holes. And by JS, I don't necessarily refer to the language alone. It's the entire ecosystem.

Oh, `npm install`? You just found out you got like 1000+ vulnerabilities. Alright, good thing it told me actually, let me update.

BOOM! Babel doesn't support this specification in this file anymore because it's nonsensical so you have to do something else now. Ok, BOOM! Babel deprecated that now, you have to try this workaround. Oh, wait. Actually, there is no workaround. You gotta downgrade your node version.

Ok, let me downgrade. Oops, that package isn't supported anymore on this node version. Oh, you need to replace this because it's no longer maintained.

I literally never had to go though this pain with any of my Elixir backend projects.

Fuck Javascript

Re:Modern Javascript: Everything you missed over the last 10... by midrus on Saturday May 15, 2021 @02:07PM (#27167479)
So npm gives you warnings about vulnerabilities and that's a bad thing?

You notice you have thousands of outdated dependencies and that's a bad thing?

I used to work a lot with python years ago, and the only reasons we didn't have this problems was because the packages management was so terrible that you didn't even notice you had to update dependencies or that they had vulnerabilities.

Re:Modern Javascript: Everything you missed over the last 10... by lanstin on Saturday May 15, 2021 @02:33PM (#27167701)
Diff being you usually have like five python deeps for every hundred npm deps a d you can do the old school thing and subscribe to the security alerts for those deps. The difference in number of deps means you have the cognitive space to understand them. Npm needed to automate because the numbers are too high. One of python’s old selling points was “Batteries included”. And the idea is fewer large library rather than a bunch of tiny libraries.

With a small number of deps where you skim the development DL, you know if there is a security issue or a cool new feature you want. Also it has more of the Unix C philosophy of don’t break stable APIs in new releases. So upgrading mostly just worked. (Stuff like deliberately breaking old SSL protocols aside). (Until python 3 of course.)

Re:Modern Javascript: Everything you missed over the last 10... by jonnycomputer on Saturday May 15, 2021 @04:20PM (#27168627)
I got to pains to limit how many python external libraries I use, for all these reasons. But because Python is so capable on its own, it works.
Re:Modern Javascript: Everything you missed over the last 10... by Draiken on Saturday May 15, 2021 @02:38PM (#27167742)
Most languages I've used don't *need* to have 1000 dependencies like JS does.

They also don't have thousands of projects depending on ridiculous packages like left pad because they actually have a standard library.

The surface of vulnerabilities and the brittleness of the entire ecosystem is the bad thing, not the warnings.

Re:Modern Javascript: Everything you missed over the last 10... by heavyset_go on Saturday May 15, 2021 @06:09PM (#27169466)
> So npm gives you warnings about vulnerabilities and that's a bad thing?

> You notice you have thousands of outdated dependencies and that's a bad thing?

This is a weird reply considering that the OP literally said those were a good thing:

> Oh, `npm install`? You just found out you got like 1000+ vulnerabilities. Alright, good thing it told me actually, let me update.

The bad things are in the lines that follow.

Re:Modern Javascript: Everything you missed over the last 10... by wreath on Sunday May 16, 2021 @12:24AM (#27171223)
Not OP but what I think they struggled with is fixing warnings. JS projects are like a poorly built house, things are constantly deteriorating and need constant maintenance.
Re:Modern Javascript: Everything you missed over the last 10... by iso1210 on Sunday May 16, 2021 @08:20AM (#27173170)
I've got a new nodejs project that a colleague wrote about 6 months ago. It's already completely broken and needed a lot of effort to get working again.

On the other hand his php project from 2011 still works, just as my perl stuff from 2006 still just works.

Re:Modern Javascript: Everything you missed over the last 10... by wreath on Sunday May 16, 2021 @10:21AM (#27173893)
This doesn't sound foreign to me. Node projects rely on a lot of dependencies (and so does their dependencies) so there is a lot of moving parts and it's prone to break.
Re:Modern Javascript: Everything you missed over the last 10... by neya on Sunday May 16, 2021 @02:12PM (#27175742)
> So npm gives you warnings about vulnerabilities and that's a bad thing?

> Alright, good thing it told me actually, let me update.

Re:Modern Javascript: Everything you missed over the last 10... by a1371 on Saturday May 15, 2021 @02:32PM (#27167688)
You're comparing Elixir & Ruby with Babel, not vanilla JavaScript. You are putting your code on non-standard JavaScript, that's on you.
Re:Modern Javascript: Everything you missed over the last 10... by dragonwriter on Saturday May 15, 2021 @02:40PM (#27167756)
> You're comparing Elixir & Ruby with Babel, not vanilla JavaScript. You are putting your code on non-standard JavaScript, that's on you.

Babel is the only way to use modern standard JS without excluding older browsers.

Re:Modern Javascript: Everything you missed over the last 10... by austincheney on Saturday May 15, 2021 @06:31PM (#27169601)
I completely disagree. The TypeScript compiler allows you to specify a compile target against a version of JavaScript. That means you can write modern TypeScript and have it compile to ES3.
Re:Modern Javascript: Everything you missed over the last 10... by dragonwriter on Sunday May 16, 2021 @11:26AM (#27174297)
Well, yeah, but then you’re using modern TypeScript, not modern JavaScript.
Re:Modern Javascript: Everything you missed over the last 10... by Oddskar on Monday May 17, 2021 @05:53AM (#27181673)
Modern Javascript is a subset of TypeScript though.
Re:Modern Javascript: Everything you missed over the last 10... by z3t4 on Sunday May 16, 2021 @06:30AM (#27172655)
JavaScript is backwards compatible. What you wrote in JavaScript 10 years ago will still work today in all JavaScript engines.

Because you mentioned Babel I suspect you actually didn't use JavaScript - but a language that compiled to JavaScript. And this complicate things a lot and is probably the root cause of your wasted hours. The time you save upfront by using some framework you pay back later in maintenance once new versions are released and things get deprecated. In JavaScript itself nothing will ever get deprecated.

Re:Modern Javascript: Everything you missed over the last 10... by adevx on Saturday May 15, 2021 @03:03PM (#27167929)
1: Trying to fix every vulnerability in any nested dependency is probably not what you want to do. In my experience only a tiny fraction has an attack surface and most are duplicates. 2: Webpack is a monster and updating webpack will always result in a lot of work. If possible use a well supported framework that incorporates Webpack, like Next.js or Nuxt.js. Updating will be a breeze. 3: Don't wait years before scanning for issues, update on a set schedule so it won't become a huge task once a critical issue is found.
Re:Modern Javascript: Everything you missed over the last 10... by Master_Odin on Saturday May 15, 2021 @08:04PM (#27170078)
Do elixir libraries just never deprecate stuff? Or just that their package managers never alert you about vulnerabilities so you can pretend like they don't exist and so never upgrade?
Re:Modern Javascript: Everything you missed over the last 10... by machiaweliczny on Monday May 17, 2021 @10:27AM (#27183808)
Actually Elixir Phoenix 1.2 to 1.3 is painful transition.
Re:Modern Javascript: Everything you missed over the last 10... by Rompect on Saturday May 15, 2021 @02:47PM (#27167813)
Sounds a lot like the external packages are the problem.