make 'bazel run ts:format' work

We're cheating a bit by having it fix files in qt's data folder
as well, but this makes it easier to share the config file.
This commit is contained in:
Damien Elmes 2020-11-12 20:49:00 +10:00
parent 5bb3d7c114
commit b71f55dcc5
5 changed files with 18 additions and 9 deletions

View file

@ -66,8 +66,9 @@ in the relevant package:
```
bazel run //rslib:format
bazel run //pylib:format
bazel run //pylib/rsbridge:format
bazel run //qt:format
bazel run //ts:format
bazel run //pylib/rsbridge:format
```
If you're in one of those folders, you can use the short form:
@ -76,13 +77,6 @@ If you're in one of those folders, you can use the short form:
bazel run format
```
Currently the typescript code needs to be formatted differently:
```
cd ts
./node_modules/.bin/prettier --write .
```
## Building redistributable wheels
```

View file

@ -1 +1,3 @@
src/backend/proto.d.ts
licenses.json
vendor

View file

@ -1,3 +1,7 @@
load("//ts:prettier.bzl", "prettier")
prettier()
# Exported files
#################

3
ts/format.sh Executable file
View file

@ -0,0 +1,3 @@
# this is a hack to invoke prettier directly from Bazel
ts=${BUILD_WORKSPACE_DIRECTORY}/ts
(cd $ts && ./node_modules/.bin/prettier --config .prettierrc --write . $ts/../qt/aqt/data/web/js)

View file

@ -3,7 +3,7 @@ load(
_prettier_test = "prettier_test",
)
def prettier_test(name = "format", srcs = [], **kwargs):
def prettier_test(name = "format_check", srcs = [], **kwargs):
_prettier_test(
name = name,
args = [
@ -17,3 +17,9 @@ def prettier_test(name = "format", srcs = [], **kwargs):
] + srcs,
**kwargs
)
def prettier(name = "format", **kwargs):
native.sh_binary(
name = name,
srcs = ["format.sh"],
)