Skip to content

Releases: dsherret/dax

0.35.0

08 Sep 21:27
621c474
Compare
Choose a tag to compare

What's Changed

  • feat: PathRef improvements and drop deno_std fs & path re-exports by @dsherret in #171
  • refactor(BREAKING): rename more synchronous path methods to have Sync suffix by @dsherret in #175
  • fix: update stdout() stderr() error message by @mashizora in #173
  • docs: correct PathRef.prototype.renameSync docs by @heyheyhello in #176
  • feat: upgrade to deno_std 0.201 internally by @dsherret in #178

PathRef improvements

The following methods were added to PathRef:

  • startsWith(path: PathRef | URL | string): boolean
  • endsWith(path: PathRef | URL | string): boolean
  • components(): Generator<string>
  • ensureDir(): Promise<this>
  • ensureDirSync(): this
  • ensureFile(): Promise<this>
  • ensureFileSync(): this

Additionally, the following methods were renamed:

  • isDir -> isDirSync
  • isFile -> isFileSync
  • isSymlink -> isSymlinkSync

Note: No async counterparts were added for these methods and won't be for a long time in order to make this transition easier and less error prone.

Removal of $.fs and $.path deno_std re-exports

The $.fs and $.path re-exports of deno_std were removed. It's recommended to just use const path = $.path("some/path"); to work with the file system.

New Contributors

  • @mashizora made their first contribution in #173
  • @heyheyhello made their first contribution in #176

Full Changelog: 0.34.0...0.35.0

0.34.0

05 Aug 23:01
c347674
Compare
Choose a tag to compare

What's Changed

CommandChild - abort() -> kill(signal?: Deno.Signal)

The abort() method on CommandChild was renamed to kill and now accepts an optional signal parameter.

const child = $`echo 1 && sleep 100 && echo 2`.spawn();

// kill the child after 1s
await $.sleep("1s");
child.kill(); // defaults to "SIGTERM"

await child; // Error: Aborted with exit code: 124

KillSignalController

This release adds a new KillSignalController along with CommandBuilder.prototype.signal method which can be used to send a Deno.Signal to many commands at once.

import $, { KillSignalController } from "...";

const controller = new KillSignalController(); // similar idea to AbortController
const signal = controller.signal;

const promise = Promise.all([
  $`sleep 1000s`.signal(signal),
  $`sleep 2000s`.signal(signal),
  $`sleep 3000s`.signal(signal),
]);

$.sleep("1s").then(() => controller.kill()); // defaults to "SIGTERM"

await promise; // throws after 1 second

This is very useful when using a CommandBuilder and building a $:

import { build$, CommandBuilder, KillSignalController} from "..."

const controller = new KillSignalController();
const commandBuilder = new CommandBuilder().signal(controller.signal);
const $ = build$({ commandBuilder });

const promise = Promise.all([
  $`sleep 1000s`,
  $`sleep 2000s`,
  $`sleep 3000s`,
]);

$.sleep("1s").then(() => controller.kill("SIGKILL"));

await promise; // throws after 1 second

Or an example that sends a SIGTERM to all commands when receiving ctrl+c, then waits 10 seconds, then sends a SIGKILL:

const controller = new KillSignalController();
const commandBuilder = new CommandBuilder().signal(controller.signal);
const $ = build$({ commandBuilder });

Deno.addSignalListener("SIGINT", () => {
  controller.kill("SIGTERM");
  // wait 10 seconds, then send a sigkill
  Deno.unrefTimer(setTimeout(() => {
    controller.kill("SIGKILL");
  }, 10_000));
});

// run a bunch of commands here

New Contributors

Full Changelog: 0.33.0...0.34.0

0.33.0

04 Jul 00:51
68cf1d0
Compare
Choose a tag to compare

What's Changed

  • feat: PathRef.prototype.copyFileToDir (#154, #155)

Full Changelog: 0.32.0...0.33.0

0.32.0

04 Jun 02:31
7b5b33e
Compare
Choose a tag to compare

What's Changed

Full Changelog: 0.31.1...0.32.0

0.31.1

29 Apr 17:31
06c07dd
Compare
Choose a tag to compare

What's Changed

  • fix: use Deno.Command internally instead of Deno.run #138

Full Changelog: 0.31.0...0.31.1

0.31.0

05 Apr 22:41
f0deaab
Compare
Choose a tag to compare

What's Changed

  • feat: add unset command and fix VAR= behaviour #134
  • feat: bump deno_std to 0.182.0 #135
  • feat: upgrade to which 0.3.0 #136

Full Changelog: 0.30.1...0.31.0

0.30.1

15 Mar 23:25
9374eab
Compare
Choose a tag to compare

What's Changed

  • perf: PathRef - set self as "known resolved" when resolving returns back the same path in #130
  • fix: PathRef - walk - resolve path before walking in #131

Full Changelog: 0.30.0...0.30.1

0.30.0

14 Mar 22:32
ceb61f1
Compare
Choose a tag to compare

What's Changed

  • feat: allow passing a PathRef in when creating a PathRef in #123
  • refactor: PathRef - prefix read methods with read for discoverability in #124
  • feat: PathRef - add equals method in #125
  • feat: PathRef - walk and emptyDir in #127

Full Changelog: 0.29.0...0.30.0

0.29.0

14 Mar 03:06
4c18b65
Compare
Choose a tag to compare

What's Changed

  • feat: allow providing PathRef and import.meta to $.cd by @dsherret in #119
  • feat: PathRef - add custom inspect implementation by @dsherret in #120
  • feat: PathRef - simplify symlink creation functions by @bartlomieju in #118
  • feat: upgrade to deno_std 0.179 by @dsherret in #121
  • feat: PathRef - createSymlinkTo - require specifying if absolute or relative for PathRef and URL args by @dsherret in #122

The symlink creation methods on PathRef have been simplified to just $.path("mySymlink").createSymlinkTo("targetPath"). You can also provide a PathRef or URL as the target path, but you must specify if relative of absolute (ex. $.path("mySymlink").createSymlinkTo(otherPath, { kind: "relative" })).

New Contributors

Full Changelog: 0.28.0...0.29.0

0.28.0

22 Feb 17:28
24a7548
Compare
Choose a tag to compare

What's Changed

  • feat: PathRef - support creating via import.meta and file url strings by @dsherret in #113

You can now create path references from import.meta (or import.meta.url). This allows you to more easily reference paths relative the current module instead of relying on the current working directory the script was executed from:

const currentFile = $.path(import.meta);
const parentDir = currentFile.parentOrThrow(); // or currentFile.join("../")

Full Changelog: 0.27.0...0.28.0