Our great sponsors
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
-
graaljs
A ECMAScript 2023 compliant JavaScript implementation built on GraalVM. With polyglot language interoperability support. Running Node.js applications!
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
Ansible
Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy and maintain. Automate everything from code deployment to network configuration to cloud management, in a language that approaches plain English, using SSH, with no agents to install on remote systems. https://docs.ansible.com.
Then it should have carried prominent notices to that effect or at least used a different version number. Version 1.0.2 hardly screams ‘pre-alpha’.
https://github.com/google/zx/blob/5ba6b775c4c589ecf81a41dfc9...
Compare to Deno, which also makes JS friendlier for shell scripting! https://deno.land/
I think the single biggest advantage of zx over Deno is the handy tagged template literal function $.
await $`cat package.json | grep name`
I wrote essentially the same thing for [Python](https://github.com/NightMachinary/brish). I have been using it extensively for months, and I’m very happy with it.
I have also used a REST API based on the Python version to implement the same thing easily in other languages, including a nifty [elisp macro](https://github.com/NightMachinary/doom.d/blob/master/night-b...) that lets you do:
(z du -h (split-string (z ls -a) "\n" t))
PS: It does proper quoting, using zsh’s builtin quoting system.
This is good, enabling people with Javascript proficiency write complex scripts IMO.
There is also https://github.com/shelljs/shelljs which is implemented on top of nodejs APIs.
This was kinda explored at the start of April this year: https://github.com/microsoft/TypeScript/pull/43480
GraalVM's JS engine[1] is an implementation of ECMAScript 2021 and as such, it's a drop-in replacements for Node.js and npm.
It also supports some Nashorn features for interop with Java, but for many things to work, you need to enable it explicitly, especially the compatibility mode flag (`-Dpolyglot.js.nashorn-compat=true`).
See https://github.com/oracle/graaljs/blob/master/docs/user/Nash...
[1] https://github.com/oracle/graaljs
I was hoping for an article on how to use Node.js for normal scripting, since it's already pretty close to what it's shown in this library. I've written two libraries to help with scripting in Node.js:
`files`: https://github.com/franciscop/files/
import { read, walk } from 'files';
Python is my absolute favorite language but it's not suitable for the kinds of things you would use bash for.
This is the real code that a Ansible uses to run a shell command correctly and is 350 lines and is still a small subset of the features of a single line of bash. https://github.com/ansible/ansible/blob/a2776443017718f6bbd8...
The Python code to do what a single mv invocation does is 120 lines https://github.com/ansible/ansible/blob/a2776443017718f6bbd8...
People always focus on the footguns that exist in Bash the language but ignore how much systems programming is abstracted away from you.
What if I told you there is a modern programming language for DevOps?
https://ngs-lang.org/
Born out of frustration with bash and Python.
and ... nope, never considered JS for that type of scripting.
Yeah, I saw this yesterday and didn't like it so I made my own cleaner version: https://github.com/tusharsadhwani/zxpy
I wrote essentially the same thing for [Python](https://github.com/NightMachinary/brish). I have been using it extensively for months, and I’m very happy with it.
I have also used a REST API based on the Python version to implement the same thing easily in other languages, including a nifty [elisp macro](https://github.com/NightMachinary/doom.d/blob/master/night-b...) that lets you do:
(z du -h (split-string (z ls -a) "\n" t))
PS: It does proper quoting, using zsh’s builtin quoting system.