mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00

I mourn the time lost trying to track this down :-( https://github.com/protobufjs/protobuf.js/issues/1014 We can't patch the minified file in dist without essentially duplicating it, so this change also switches from the external file to including the src file as part of the bundle.
106 lines
2 KiB
Text
106 lines
2 KiB
Text
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
|
load("//ts/svelte:svelte.bzl", "compile_svelte", "svelte_check")
|
|
load("//ts:prettier.bzl", "prettier_test")
|
|
load("//ts:eslint.bzl", "eslint_test")
|
|
load("//ts:esbuild.bzl", "esbuild")
|
|
load("//ts:compile_sass.bzl", "compile_sass")
|
|
|
|
compile_sass(
|
|
srcs = ["graphs-base.scss"],
|
|
group = "base_css",
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
"//ts/sass:base_lib",
|
|
"//ts/sass:scrollbar_lib",
|
|
],
|
|
)
|
|
|
|
svelte_files = glob(["*.svelte"])
|
|
|
|
svelte_names = [f.replace(".svelte", "") for f in svelte_files]
|
|
|
|
compile_svelte(
|
|
name = "svelte",
|
|
srcs = svelte_files,
|
|
)
|
|
|
|
ts_library(
|
|
name = "index",
|
|
srcs = ["index.ts"],
|
|
deps = [
|
|
"GraphsPage",
|
|
"lib",
|
|
"//ts/lib",
|
|
"//ts/sveltelib",
|
|
"@npm//svelte",
|
|
"@npm//svelte2tsx",
|
|
],
|
|
)
|
|
|
|
ts_library(
|
|
name = "lib",
|
|
srcs = glob(
|
|
["*.ts"],
|
|
exclude = ["index.ts"],
|
|
),
|
|
deps = [
|
|
"//ts/lib",
|
|
"//ts/lib:backend_proto",
|
|
"//ts/sveltelib",
|
|
"@npm//@types/d3",
|
|
"@npm//@types/lodash",
|
|
"@npm//d3",
|
|
"@npm//lodash-es",
|
|
"@npm//svelte",
|
|
],
|
|
)
|
|
|
|
esbuild(
|
|
name = "graphs",
|
|
args = [
|
|
"--global-name=anki",
|
|
"--resolve-extensions=.mjs,.js",
|
|
"--log-level=warning",
|
|
],
|
|
entry_point = "index.ts",
|
|
output_css = "graphs.css",
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
"//ts/sveltelib",
|
|
"//ts/lib",
|
|
"//ts/lib:backend_proto",
|
|
":index",
|
|
":base_css",
|
|
"@npm//protobufjs",
|
|
] + svelte_names,
|
|
)
|
|
|
|
exports_files(["graphs.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",
|
|
]),
|
|
)
|