Module

x/dax/mod.ts>build$

Cross-platform shell tools for Deno and Node.js inspired by zx.
Very Popular
Latest
function build$
import { build$ } from "https://dotland.deno.dev/x/dax@0.39.2/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]