Writing JS-based Bash scripts with zx

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • zx

    A tool for writing better scripts

  • This is where the zx project comes in. zx introduced a way to write Bash-like scripts using JavaScript.

  • cheat.sh

    the only cheat sheet you need

  • #!/usr/bin/env zx $.verbose = false let response = await fetch('https://cheat.sh'); if(response.ok) { console.log(await response.text()); }

  • 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.

    SurveyJS logo
  • chalk

    đź–Ť Terminal string styling done right

  • The zx project implements a shell script executor similar to Bash but using JavaScript modules. It provides an inbuilt asynchronous JavaScript API to call other commands similar to Bash. Besides that, it provides wrapper functions for several Node.js-based command-line helpers such as chalk, minimist, fs-extra, OS, and Readline.

  • minimist

    Discontinued parse argument options

  • The zx project implements a shell script executor similar to Bash but using JavaScript modules. It provides an inbuilt asynchronous JavaScript API to call other commands similar to Bash. Besides that, it provides wrapper functions for several Node.js-based command-line helpers such as chalk, minimist, fs-extra, OS, and Readline.

  • fs-extra

    Node.js: extra methods for the fs object like copy(), remove(), mkdirs()

  • The zx project implements a shell script executor similar to Bash but using JavaScript modules. It provides an inbuilt asynchronous JavaScript API to call other commands similar to Bash. Besides that, it provides wrapper functions for several Node.js-based command-line helpers such as chalk, minimist, fs-extra, OS, and Readline.

  • node-fetch

    A light-weight module that brings the Fetch API to Node.js

  • Programmers often use the curl command to make HTTP requests with Bash scripts. zx offers a wrapper for the node-fetch module, and it exposes the specific module’s API as fetch. The advantage is that zx doesn’t spawn multiple processes for each network request like Bash does with curl — because the node-fetch package uses Node’s standard HTTP APIs for sending network requests.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts