Giter Site home page Giter Site logo

zx-snippets's Introduction

zx-snippets 1.03

Finally we can write bash scripts with javascript.

zx on github

Install zx

npm i -g zx
yarn global add zx

Available scripts

upgrade_node_lts.mjs

Keep your node lts version up-to-date! Checks if there is a new version, installs it and sets it as default. After that it reinstalls all global packages from the old version. Maybe I will make this a little bit more flexible.

create_headless_vm.mjs Create a new headless virtualbox virtual machine. Answer all the questions and vm is created. In the last question you can add all the additional parameters that were missing in the questions before.

Planned scripts

  • keep your sdk versions up-to-date
  • some stuff for homebrew
  • ...

Demo

Examples

Documentation

Documentation

Write your scripts in a file with .mjs extension in order to be able to use await on top level. If you prefer the .js extension, wrap your scripts in something like void async function () {...}().

Add the following shebang to the beginning of your zx scripts:

#!/usr/bin/env zx

Now you will be able to run your script like so:

chmod +x ./script.mjs
./script.mjs

Or via the zx executable:

zx ./script.mjs

When using zx via the executable or a shebang, all of the functions ($, cd, fetch, etc) are available straight away without any imports.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.