Releases: dsherret/dax
0.35.0
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
What's Changed
- feat:
CommandChild
-abort()
->kill(signal?: Deno.Signal)
by @dsherret in #168 - feat:
KillSignalController
by @dsherret in #169 - feat:
PathRef
-renameToDir
by @dsherret in #164 - fix: don't require
--allow-net
by @NfNitLoop in #158 - fix: appending to files by @dsherret in #162
- fix: remove debugging console.logs by @dsherret in #163
- fix: improve error message when launching command and cwd does not exist by @dsherret in #165
- fix: pass clearEnv: true when calling child process by @dsherret in #166
- fix: surface command exit code on kill by @dsherret in #170
- fix: upgrade deno_task_shell to 0.13.2 by @dsherret in #167
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
- @NfNitLoop made their first contribution in #158
Full Changelog: 0.33.0...0.34.0
0.33.0
0.32.0
0.31.1
0.31.0
0.30.1
0.30.0
0.29.0
What's Changed
- feat: allow providing
PathRef
andimport.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
andURL
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
- @bartlomieju made their first contribution in #118
Full Changelog: 0.28.0...0.29.0
0.28.0
What's Changed
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