2019-08-13 20:03:29 -04:00
|
|
|
#!/usr/bin/env -S deno run --allow-run --allow-write --allow-read --allow-env
|
2019-01-02 09:56:17 -05:00
|
|
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
2019-03-08 12:41:47 -05:00
|
|
|
const { exit, args, execPath } = Deno;
|
2019-01-26 23:19:56 -05:00
|
|
|
import { parse } from "./flags/mod.ts";
|
2019-03-08 12:41:47 -05:00
|
|
|
import { xrun } from "./prettier/util.ts";
|
2019-01-26 23:19:56 -05:00
|
|
|
|
2019-03-12 01:51:51 -04:00
|
|
|
async function main(opts): Promise<void> {
|
2019-02-01 10:16:39 -05:00
|
|
|
const args = [
|
2019-08-13 20:03:29 -04:00
|
|
|
execPath(),
|
2019-05-04 11:33:50 -04:00
|
|
|
"run",
|
2019-02-01 10:16:39 -05:00
|
|
|
"--allow-write",
|
2019-02-09 15:41:05 -05:00
|
|
|
"--allow-read",
|
2019-02-01 10:16:39 -05:00
|
|
|
"prettier/main.ts",
|
|
|
|
"--ignore",
|
2019-03-08 02:01:40 -05:00
|
|
|
"node_modules",
|
|
|
|
"--ignore",
|
2019-10-02 13:59:27 -04:00
|
|
|
"**/testdata",
|
2019-02-01 10:16:39 -05:00
|
|
|
"--ignore",
|
2019-10-02 13:59:27 -04:00
|
|
|
"**/vendor",
|
2019-05-21 08:23:23 -04:00
|
|
|
"--write"
|
2019-02-01 10:16:39 -05:00
|
|
|
];
|
|
|
|
|
|
|
|
if (opts.check) {
|
|
|
|
args.push("--check");
|
2019-01-26 23:19:56 -05:00
|
|
|
}
|
2019-02-01 10:16:39 -05:00
|
|
|
|
2019-08-13 20:03:29 -04:00
|
|
|
args.push(".");
|
|
|
|
|
2019-02-01 10:16:39 -05:00
|
|
|
exit((await xrun({ args }).status()).code);
|
2018-12-18 18:56:12 -05:00
|
|
|
}
|
|
|
|
|
2019-01-26 23:19:56 -05:00
|
|
|
main(parse(args));
|