2020-11-01 05:26:58 +01:00
|
|
|
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
2021-03-20 05:56:08 +01:00
|
|
|
load("//ts/svelte:svelte.bzl", "compile_svelte", "svelte_check")
|
2020-11-01 05:26:58 +01:00
|
|
|
load("//ts:prettier.bzl", "prettier_test")
|
|
|
|
load("//ts:eslint.bzl", "eslint_test")
|
2021-03-20 05:02:19 +01:00
|
|
|
load("//ts:esbuild.bzl", "esbuild")
|
2020-11-01 05:26:58 +01:00
|
|
|
|
|
|
|
svelte_files = glob(["*.svelte"])
|
|
|
|
|
|
|
|
svelte_names = [f.replace(".svelte", "") for f in svelte_files]
|
|
|
|
|
|
|
|
compile_svelte(
|
|
|
|
name = "svelte",
|
|
|
|
srcs = svelte_files,
|
|
|
|
)
|
|
|
|
|
|
|
|
ts_library(
|
2021-03-21 13:47:52 +01:00
|
|
|
name = "index",
|
|
|
|
srcs = ["index.ts"],
|
2020-11-01 05:26:58 +01:00
|
|
|
deps = [
|
|
|
|
"GraphsPage",
|
|
|
|
"lib",
|
|
|
|
"//ts/lib",
|
2021-03-22 03:06:53 +01:00
|
|
|
"//ts/sveltelib",
|
2020-12-26 15:17:30 +01:00
|
|
|
"@npm//svelte",
|
2020-11-01 05:26:58 +01:00
|
|
|
"@npm//svelte2tsx",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
ts_library(
|
|
|
|
name = "lib",
|
|
|
|
srcs = glob(
|
|
|
|
["*.ts"],
|
2021-03-21 13:47:52 +01:00
|
|
|
exclude = ["index.ts"],
|
2020-11-01 05:26:58 +01:00
|
|
|
),
|
|
|
|
deps = [
|
|
|
|
"//ts/lib",
|
|
|
|
"//ts/lib:backend_proto",
|
2021-03-26 00:40:41 +01:00
|
|
|
"//ts/sveltelib",
|
2021-01-30 00:04:44 +01:00
|
|
|
"@npm//@types/d3",
|
2020-11-01 05:26:58 +01:00
|
|
|
"@npm//@types/lodash",
|
2021-01-30 00:04:44 +01:00
|
|
|
"@npm//d3",
|
2020-11-01 05:26:58 +01:00
|
|
|
"@npm//lodash.debounce",
|
|
|
|
"@npm//lodash.throttle",
|
2021-01-21 01:51:00 +01:00
|
|
|
"@npm//svelte",
|
2020-11-01 05:26:58 +01:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2021-03-20 05:02:19 +01:00
|
|
|
esbuild(
|
2020-11-01 05:26:58 +01:00
|
|
|
name = "graphs",
|
2021-03-20 05:02:19 +01:00
|
|
|
srcs = [
|
|
|
|
"//ts:protobuf-shim.js",
|
|
|
|
],
|
|
|
|
args = [
|
|
|
|
"--global-name=anki",
|
2021-03-28 00:35:46 +01:00
|
|
|
"--inject:$(location //ts:protobuf-shim.js)",
|
2021-04-07 06:53:53 +02:00
|
|
|
"--resolve-extensions=.mjs,.js",
|
|
|
|
"--log-level=warning",
|
2021-03-20 05:02:19 +01:00
|
|
|
],
|
2021-03-21 13:47:52 +01:00
|
|
|
entry_point = "index.ts",
|
2021-03-20 05:02:19 +01:00
|
|
|
external = [
|
|
|
|
"protobufjs/light",
|
|
|
|
],
|
2021-03-21 06:45:15 +01:00
|
|
|
output_css = True,
|
2020-11-01 05:26:58 +01:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
2021-03-22 03:06:53 +01:00
|
|
|
"//ts/sveltelib",
|
2021-01-02 12:18:10 +01:00
|
|
|
"//ts/lib",
|
2021-03-20 01:22:06 +01:00
|
|
|
"//ts/lib:backend_proto",
|
2021-03-21 13:47:52 +01:00
|
|
|
":index",
|
|
|
|
"//ts/sass:core_css",
|
2020-11-01 05:26:58 +01:00
|
|
|
] + svelte_names,
|
|
|
|
)
|
|
|
|
|
|
|
|
exports_files(["graphs.html"])
|
|
|
|
|
|
|
|
# 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",
|
|
|
|
"*.svelte",
|
|
|
|
]),
|
|
|
|
)
|
|
|
|
|
|
|
|
eslint_test(
|
|
|
|
name = "eslint",
|
|
|
|
srcs = glob(
|
|
|
|
[
|
|
|
|
"*.ts",
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
|
|
|
|
svelte_check(
|
2020-11-12 11:11:40 +01:00
|
|
|
name = "svelte_check",
|
2020-11-01 05:26:58 +01:00
|
|
|
srcs = glob([
|
|
|
|
"*.ts",
|
|
|
|
"*.svelte",
|
|
|
|
]),
|
|
|
|
)
|