mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00

This allows for tree shaking, and reduces the congrats page from 150k with the old enum solution to about 80k.
74 lines
1.4 KiB
Text
74 lines
1.4 KiB
Text
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
|
load("//ts:prettier.bzl", "prettier_test")
|
|
load("//ts:eslint.bzl", "eslint_test")
|
|
load("//ts:protobuf.bzl", "protobufjs_library")
|
|
|
|
# Protobuf
|
|
#############
|
|
|
|
protobufjs_library(
|
|
name = "backend_proto",
|
|
proto = "//rslib:backend_proto_lib",
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
# 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",
|
|
outs = ["i18n.ts"],
|
|
cmd = "$(location genfluent) $(location //rslib/i18n:strings.json) $@",
|
|
tools = [
|
|
"genfluent",
|
|
"//rslib/i18n:strings.json",
|
|
],
|
|
)
|
|
|
|
# Anki Library
|
|
################
|
|
|
|
ts_library(
|
|
name = "lib",
|
|
srcs = glob(["**/*.ts"]) + [":i18n.ts"],
|
|
data = [
|
|
"backend_proto",
|
|
],
|
|
module_name = "anki",
|
|
tsconfig = "//:tsconfig.json",
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
"backend_proto",
|
|
"@npm//@fluent/bundle",
|
|
"@npm//@types/long",
|
|
"@npm//intl-pluralrules",
|
|
"@npm//tslib",
|
|
],
|
|
)
|
|
|
|
# Tests
|
|
################
|
|
|
|
prettier_test(
|
|
name = "format_check",
|
|
srcs = glob(["*.ts"]),
|
|
)
|
|
|
|
eslint_test(
|
|
name = "eslint",
|
|
srcs = glob(["*.ts"]),
|
|
)
|