You are browsing as a guest. Sign up (or log in) to start making projects!

4h 28m 37s logged

when the FUCK did this become 4 hours :hs:

so uhh i spent like all of this time debugging and improving my code.

first thing is, i replaced these “microfunctions”, as i call them, with
an object that had keys whose values were arrow functions. these arrow
functions did the exact same thing and took up less space and was even
more readable!


second, i spent some time on a stupid bug where the main function in
stylize.js would hang. i thought it was an issue with the image
function, but after half an hour or so, when i added console.log(done)
right before the return, i realized it had to do with the main function
that was calling the image function, and sure enough, the second i
looked at it, i realized the problem: it was a while loop and i forgot
to add a line that incremented the index, so it just kept doing the
same thing forever until i killed the process :sk: oh well, more hours for me :shrug3d:


third, i improved (or rather cleaned) my image function. it returns
promises and doesn’t use terminal-image directly. instead, i made it
so that it would return an object with a bunch of keys, one of which is a
function that takes the whole object as an input. this function
actually renders the image, since i plan to write the function to
display it in a way that deals with image rendering after rendering
text, and while the images get rendered, a spinner takes their place
temporarily, but the images replace those spinners once they are
processed


fourth thing is, i made it so that the main function calls the
renderInline function instead of the paragraph function. in fact,
this paragraph function is completely useless, so i went ahead and
removed it too.


lastly, i upgraded a bunch of packages:

  • upgraded typescript from version 5 to 5.9.3
  • upgraded got from version 15.0.7 to 15.1.0
  • upgraded markdown-it from version 14.2.0 to 14.3.0
  • upgraded shiki from version 4.3.0 to 4.3.1

if you wonder what these packages are

  • typescript is, well, the typescript language, not sure why i have
    it, might be a dependency for another package.
  • got is some package that does pretty much the same thing as the
    default fetch() but it can give me a buffer, which i need for images
  • markdown-it is the markdown parser
  • shiki is for coloring code. fancy, right?

Changelog


aight this took me 2 hours to write and i started coding again in the
middle of writing this :sk:

0
10

Comments 0

No comments yet. Be the first!