2020-11-05 14:53:21 +00:00
|
|
|
#!/usr/bin/env -S deno run --unstable --allow-write --allow-read --allow-run
|
2023-01-02 21:00:42 +00:00
|
|
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
2022-02-21 17:47:08 +00:00
|
|
|
import { getPrebuiltToolPath, join, ROOT_PATH } from "./util.js";
|
2020-11-05 14:53:21 +00:00
|
|
|
|
2023-01-13 18:42:15 +00:00
|
|
|
const subcommand = Deno.args.includes("--check") ? "check" : "fmt";
|
|
|
|
const configFile = join(ROOT_PATH, ".dprint.json");
|
|
|
|
const execPath = getPrebuiltToolPath("dprint");
|
|
|
|
const cmd = new Deno.Command(execPath, {
|
|
|
|
args: [subcommand, "--config=" + configFile],
|
|
|
|
cwd: ROOT_PATH,
|
|
|
|
stdout: "inherit",
|
|
|
|
stderr: "inherit",
|
|
|
|
});
|
|
|
|
|
|
|
|
const { code } = await cmd.output();
|
|
|
|
Deno.exit(code);
|