anki/ts/congrats/BUILD.bazel
Damien Elmes 13d415f8e3 move esbuild into separate repo
Most of our changes have been upstreamed, but the toolchain change
probably won't be merged soon, and a separate git repo will make it
easier to track upstream changes.

@hgiesel output_css=True will need to be changed to output_css="foo.css"
instead
2021-04-15 10:53:49 +10:00

97 lines
1.7 KiB
Python

load("@npm//@bazel/typescript:index.bzl", "ts_library")
load("//ts:prettier.bzl", "prettier_test")
load("//ts:eslint.bzl", "eslint_test")
load("//ts/svelte:svelte.bzl", "svelte", "svelte_check")
load("//ts:esbuild.bzl", "esbuild")
load("//ts:compile_sass.bzl", "compile_sass")
compile_sass(
srcs = ["congrats-base.scss"],
group = "base_css",
visibility = ["//visibility:public"],
deps = [
"//ts/sass:base_lib",
"//ts/sass:scrollbar_lib",
],
)
svelte(
name = "CongratsPage",
entry_point = "CongratsPage.svelte",
)
ts_library(
name = "index",
srcs = ["index.ts"],
deps = [
"CongratsPage",
"lib",
"//ts/lib",
"@npm//svelte",
"@npm//svelte2tsx",
],
)
ts_library(
name = "lib",
srcs = ["lib.ts"],
deps = [
"//ts/lib",
"//ts/lib:backend_proto",
],
)
esbuild(
name = "congrats",
srcs = [
"//ts:protobuf-shim.js",
],
args = [
"--global-name=anki",
"--inject:$(location //ts:protobuf-shim.js)",
"--resolve-extensions=.mjs,.js",
"--log-level=warning",
],
entry_point = "index.ts",
external = [
"protobufjs/light",
],
output_css = "congrats.css",
visibility = ["//visibility:public"],
deps = [
"CongratsPage",
":base_css",
":index",
"//ts/lib",
"//ts/lib:backend_proto",
],
)
exports_files(["congrats.html"])
# Tests
################
prettier_test(
name = "format_check",
srcs = glob([
"*.ts",
"*.svelte",
]),
)
eslint_test(
name = "eslint",
srcs = glob([
"*.ts",
]),
)
svelte_check(
name = "svelte_check",
srcs = glob([
"*.ts",
"*.svelte",
]),
)