telescope icon indicating copy to clipboard operation
telescope copied to clipboard

Prepare to upgrade to node 18

Open humphd opened this issue 2 years ago • 3 comments

On Oct 25th, node 18 is becoming the active LTS version. We should see if we can switch over to use it everywhere.

It brings a bunch of new things, but among them is the global fetch() function, which should let us replace what we do now with got and node-fetch.

We should figure out what all the other features are that we can use, and make sure we update to use them properly.

humphd avatar Oct 18 '22 16:10 humphd

Official NodeJS release notes

They added node:test module to replace additional testing tools like Jest that we use. We might want to consider replacing Jest in some places to see how it goes. We don't have to though, it adds us an opportunity to, but it shouldn't break our existent tests. So, this might add potential issues about replacing jest tests in X place.

XMLHttpRequest reminds me of what Angular has..

With Streams API it's hard to say what we can do exactly, without knowing its limitations. But to throw some ideas - streaming our audio or video podcasts; perhaps generating some files out of blogs. For example, turn a blog post into a PDF.

I have no idea what to do with snapshot stuff.

And this is neat. Probably just for developers - checking what supported identifiers v8 has. Stuff like calendar, unit, timeZone.

sirinoks avatar Oct 18 '22 19:10 sirinoks

The built-in test runner, node:test, isn't as advanced as Jest at this point. I don't think moving away from Jest is necessary until it improves.

But the other stuff is worth checking out. I also think they have a native "watch" mode now, like nodemon, but I don't know what it's called.

humphd avatar Oct 18 '22 20:10 humphd

Just adding some info for people in here that are following: About watch: Running in watch mode using node --watch restarts the process when an imported file is changed.

I'm not sure if it's only for a file, or for a folder too. This could be useful for SSG related stuff? If we make changes to the original file, could just make an SSG reload and display new results. Ooooooh, could make people do a lab that implements this :D


I just realised, we can actually mix this in with Streams API, where we:

  • Make some file through a stream;
  • --watch it;
  • Make changes to the file using... WritableStream?
  • Changes are caught by the watch which would then reload our page and display new stuff.

I don't know why. But we can. ... Waaaaait... Can we make and SSG, where we can edit its contents through the browser? For example, just change text in the page would actually write it to the original file. Which will become a new static original page now.

sirinoks avatar Oct 18 '22 22:10 sirinoks