Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/dax/mod.ts>build$

Cross platform shell tools for Deno inspired by zx.
Very Popular
Go to Latest
function build$
import { build$ } from "https://deno.land/x/dax@0.31.0/mod.ts";

Builds a new $ which will use the state of the provided builders as the default.

This can be useful if you want different default settings.

Example:

import { build$ } from "https://deno.land/x/dax/mod.ts";

const commandBuilder = new CommandBuilder()
  .cwd("./subDir")
  .env("HTTPS_PROXY", "some_value");
const requestBuilder = new RequestBuilder()
  .header("SOME_VALUE", "value");

const $ = build$({
  commandBuilder,
  requestBuilder,
  // optional additional functions to add to `$`
  extras: {
    add(a: number, b: number) {
      return a + b;
    },
  },
});

// this command will use the env described above, but the main
// process and default `$` won't have its environment changed
await $`deno run my_script.ts`;

// similarly, this will have the headers that were set in the request builder
const data = await $.request("https://plugins.dprint.dev/info.json").json();

// use the extra function we defined
console.log($.add(1, 2));

Type Parameters

optional
TExtras extends ExtrasObject = { }

Parameters

optional
options: Create$Options<TExtras> = [UNSUPPORTED]