2021-04-12 06:18:30 +02:00
|
|
|
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", "compile_svelte", "svelte", "svelte_check")
|
|
|
|
load("//ts:esbuild.bzl", "esbuild")
|
|
|
|
load("//ts:vendor.bzl", "copy_bootstrap_icons")
|
|
|
|
load("//ts:compile_sass.bzl", "compile_sass")
|
|
|
|
|
|
|
|
compile_sass(
|
|
|
|
group = "base_css",
|
2021-04-15 02:32:58 +02:00
|
|
|
srcs = ["deckconfig-base.scss"],
|
2021-04-12 06:18:30 +02:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
"//ts/sass:base_lib",
|
|
|
|
"//ts/sass:scrollbar_lib",
|
2021-04-15 08:10:01 +02:00
|
|
|
"//ts/sass/bootstrap",
|
2021-04-12 06:18:30 +02:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
svelte_files = glob(["*.svelte"])
|
|
|
|
|
|
|
|
svelte_names = [f.replace(".svelte", "") for f in svelte_files]
|
|
|
|
|
|
|
|
compile_svelte(
|
|
|
|
name = "svelte",
|
|
|
|
srcs = svelte_files,
|
|
|
|
)
|
|
|
|
|
|
|
|
copy_bootstrap_icons(
|
|
|
|
name = "bootstrap-icons",
|
|
|
|
icons = [
|
|
|
|
"arrow-counterclockwise.svg",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
ts_library(
|
|
|
|
name = "index",
|
|
|
|
srcs = ["index.ts"],
|
|
|
|
deps = [
|
|
|
|
"DeckConfigPage",
|
|
|
|
"lib",
|
|
|
|
"//ts/lib",
|
|
|
|
"@npm//svelte2tsx",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
ts_library(
|
|
|
|
name = "lib",
|
|
|
|
srcs = [
|
|
|
|
"icons.ts",
|
|
|
|
"lib.ts",
|
|
|
|
"steps.ts",
|
|
|
|
],
|
|
|
|
module_name = "deckconfig",
|
|
|
|
deps = [
|
|
|
|
"//ts:image_module_support",
|
|
|
|
"//ts/lib",
|
|
|
|
"//ts/lib:backend_proto",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
esbuild(
|
|
|
|
name = "deckconfig",
|
|
|
|
srcs = [
|
|
|
|
"//ts:protobuf-shim.js",
|
|
|
|
],
|
|
|
|
args = [
|
|
|
|
"--global-name=anki",
|
|
|
|
"--inject:$(location //ts:protobuf-shim.js)",
|
|
|
|
"--resolve-extensions=.mjs,.js",
|
|
|
|
"--log-level=warning",
|
|
|
|
"--loader:.svg=text",
|
|
|
|
],
|
|
|
|
entry_point = "index.ts",
|
|
|
|
external = [
|
|
|
|
"protobufjs/light",
|
|
|
|
],
|
2021-04-15 02:53:49 +02:00
|
|
|
output_css = "deckconfig.css",
|
2021-04-12 06:18:30 +02:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
"index",
|
|
|
|
"//ts/lib",
|
|
|
|
"//ts/lib:backend_proto",
|
|
|
|
":bootstrap-icons",
|
|
|
|
"@npm//bootstrap",
|
|
|
|
":base_css",
|
|
|
|
] + svelte_names,
|
|
|
|
)
|
|
|
|
|
|
|
|
exports_files(["deckconfig.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",
|
|
|
|
]),
|
|
|
|
)
|