top | item 39324522

(no title)

bandergirl | 2 years ago

It looks like people don’t get it.

This isn’t “better” than your tool of choice. This is a tool for JavaScript developers to write non-trivial scripts in a portable way without getting lost in POSIX hell. Who came up with this stuff?

https://stackoverflow.com/a/13373256

If you can write shell code, Perl, Python, COBOL, suit yourself. This is for JavaScript developers in JavaScript projects.

discuss

order

Vinnl|2 years ago

Here's an example: https://gitlab.com/vincenttunru/penny/-/blob/main/scripts/bu...

That used to be a shell script. But this I can way more easily read (even after not touching it for a long time), I get autocompletion, and I can use the APIs I'm already familiar with. It's a pretty neat QoL improvement for me specifically.

latchkey|2 years ago

Wouldn't the `await fs.move` run sync? Why not just return the Promise from fs.move() so that Promise.all() can run the multiple moves async?

  await Promise.all(
    unneededPages.map(async (page) => {
      await fs.move(page, `scripts/.cache/${page}`, { overwrite: true });
    })
  );
Similar to what you do on line 26.

elygre|2 years ago

What’s with all the await-stuff? Couldn’t it be written just straight forward?

danmur|2 years ago

Maybe it should say that somewhere.

olddustytrail|2 years ago

> It looks like people don’t get it.

They're probably on the spectrum.

(I'll get my coat...)