Company
Date Published
Author
Oliver Falvai
Word count
870
Language
English
Hacker News points
None

Summary

zx is a Javascript library open-sourced by Google that makes it easier to write simple Bash-like scripts in Javascript, providing functions like executing external commands and working with the output in Javascript.` Bitrise provides a Script step that can be used to write custom CI scripts in Bash or other languages like Javascript using the `zx` library. The `zx` library is a wrapper around Node.js's process handling, allowing users to easily call external commands from their code and work with the output in Javascript. With `zx`, users can write custom scripts in Javascript without having to learn Bash. Bitrise has hundreds of workflow steps for common operations, but users may need to do something custom, which is where the Script step comes in. Users can install `zx` globally using npm or a script step and use it in their workflows. The Script step allows users to set up Node.js version 14, which is the minimum required version for `zx`. The main part of setting up a workflow involves writing Javascript code in the Bitrise editor, with inputs like Script content, Execute with /runner binary, and Script file path. When running the workflow, the script is executed instantly, providing faster iteration and making it easier to write scripts. The `zx` library provides functions like `$` which executes an external command, cd() changes the current working directory, fetch() makes HTTP requests easy, and more.