summaryrefslogtreecommitdiff
path: root/tools/format.js
blob: b2296ede6e568fc748d2e61111d4292730c866c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env -S deno run --unstable --allow-write --allow-read --allow-run --allow-net
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { getPrebuilt, join, ROOT_PATH } from "./util.js";

const subcommand = Deno.args.includes("--check") ? "check" : "fmt";
const configFile = join(ROOT_PATH, ".dprint.json");
const execPath = await getPrebuilt("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);