2020-11-01 05:26:58 +01:00
|
|
|
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
|
|
|
load("//ts:prettier.bzl", "prettier_test")
|
|
|
|
load("//ts:eslint.bzl", "eslint_test")
|
2021-03-20 01:22:06 +01:00
|
|
|
load("//ts:protobuf.bzl", "protobufjs_library")
|
2021-04-16 15:46:31 +02:00
|
|
|
load("//ts:jest.bzl", "jest_test")
|
2020-11-01 05:26:58 +01:00
|
|
|
|
|
|
|
# Protobuf
|
|
|
|
#############
|
|
|
|
|
2021-03-20 01:22:06 +01:00
|
|
|
protobufjs_library(
|
2020-11-01 05:26:58 +01:00
|
|
|
name = "backend_proto",
|
2021-07-09 12:48:33 +02:00
|
|
|
proto = "//proto:backend_proto_lib",
|
2020-11-01 05:26:58 +01:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
2021-03-26 00:40:41 +01:00
|
|
|
# Translations
|
|
|
|
################
|
|
|
|
|
|
|
|
load("@rules_python//python:defs.bzl", "py_binary")
|
|
|
|
load("@py_deps//:requirements.bzl", "requirement")
|
|
|
|
|
|
|
|
py_binary(
|
|
|
|
name = "genfluent",
|
|
|
|
srcs = [
|
|
|
|
"genfluent.py",
|
|
|
|
],
|
|
|
|
deps = [
|
|
|
|
requirement("black"),
|
|
|
|
requirement("stringcase"),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
genrule(
|
|
|
|
name = "fluent_gen",
|
2021-03-26 11:23:43 +01:00
|
|
|
outs = ["i18n.ts"],
|
2021-03-26 00:40:41 +01:00
|
|
|
cmd = "$(location genfluent) $(location //rslib/i18n:strings.json) $@",
|
|
|
|
tools = [
|
|
|
|
"genfluent",
|
|
|
|
"//rslib/i18n:strings.json",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2020-11-01 05:26:58 +01:00
|
|
|
# Anki Library
|
|
|
|
################
|
|
|
|
|
|
|
|
ts_library(
|
|
|
|
name = "lib",
|
2021-04-12 06:40:05 +02:00
|
|
|
srcs = glob(
|
|
|
|
["**/*.ts"],
|
|
|
|
exclude = ["*.test.ts"],
|
|
|
|
) + [":i18n.ts"],
|
2020-11-01 05:26:58 +01:00
|
|
|
data = [
|
|
|
|
"backend_proto",
|
|
|
|
],
|
2021-04-22 19:55:26 +02:00
|
|
|
module_name = "lib",
|
2020-11-01 05:26:58 +01:00
|
|
|
tsconfig = "//:tsconfig.json",
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
"backend_proto",
|
|
|
|
"@npm//@fluent/bundle",
|
|
|
|
"@npm//@types/long",
|
|
|
|
"@npm//intl-pluralrules",
|
|
|
|
"@npm//tslib",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
# Tests
|
|
|
|
################
|
|
|
|
|
|
|
|
prettier_test(
|
2020-11-12 11:11:40 +01:00
|
|
|
name = "format_check",
|
2020-11-01 05:26:58 +01:00
|
|
|
srcs = glob(["*.ts"]),
|
|
|
|
)
|
|
|
|
|
|
|
|
eslint_test(
|
|
|
|
name = "eslint",
|
|
|
|
srcs = glob(["*.ts"]),
|
|
|
|
)
|
2021-04-12 06:40:05 +02:00
|
|
|
|
|
|
|
jest_test(
|
2021-04-16 15:46:31 +02:00
|
|
|
deps = [
|
|
|
|
":lib",
|
|
|
|
],
|
2021-04-12 06:40:05 +02:00
|
|
|
)
|