anki/ts/prettier.bzl
Damien Elmes 046c6c55d3 use extra rootDir in tsconfig instead of symlinks
The nice thing about the symlink approach is that it allowed tsc -b
to function without any changes to the tsconfig.json file, but it meant
there were extra links we had to maintain. So instead, we just add an
extra rootDirs entry, and add two commented-out lines that can be
uncommented when wanting to build with tsc directly.
2021-10-01 18:36:52 +10:00

33 lines
764 B
Python

load(
"@npm//prettier:index.bzl",
_prettier_test = "prettier_test",
)
def prettier_test(name = "format_check", srcs = None, exclude = [], **kwargs):
if not srcs:
srcs = native.glob([
"*.ts",
"*.js",
"*.svelte",
], exclude = exclude)
_prettier_test(
name = name,
args = [
"--config",
"$(location //ts:.prettierrc)",
"--check",
] + [native.package_name() + "/" + f for f in srcs],
data = [
"//ts:.prettierrc",
"@npm//prettier-plugin-svelte",
] + srcs,
**kwargs
)
def prettier(name = "format", **kwargs):
native.sh_binary(
name = name,
srcs = ["format.sh"],
)