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")
|
2021-04-16 15:46:31 +02:00
|
|
|
load("//ts:jest.bzl", "jest_test")
|
2021-04-12 06:18:30 +02:00
|
|
|
|
|
|
|
compile_sass(
|
2021-04-25 10:40:02 +02:00
|
|
|
srcs = ["deckoptions-base.scss"],
|
2021-04-16 15:29:21 +02:00
|
|
|
group = "base_css",
|
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,
|
2021-04-16 15:29:21 +02:00
|
|
|
deps = [
|
2021-04-22 11:52:44 +02:00
|
|
|
"//ts/sveltelib",
|
2021-04-16 15:29:21 +02:00
|
|
|
"@npm//@types/bootstrap",
|
|
|
|
],
|
2021-04-12 06:18:30 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
copy_bootstrap_icons(
|
|
|
|
name = "bootstrap-icons",
|
|
|
|
icons = [
|
|
|
|
"arrow-counterclockwise.svg",
|
2021-04-22 07:39:50 +02:00
|
|
|
"info-circle.svg",
|
2021-04-12 06:18:30 +02:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
ts_library(
|
|
|
|
name = "index",
|
|
|
|
srcs = ["index.ts"],
|
|
|
|
deps = [
|
2021-04-25 10:40:02 +02:00
|
|
|
"DeckOptionsPage",
|
2021-04-12 06:18:30 +02:00
|
|
|
"lib",
|
|
|
|
"//ts/lib",
|
2021-04-22 07:39:50 +02:00
|
|
|
"@npm//@popperjs",
|
2021-04-12 06:18:30 +02:00
|
|
|
"@npm//svelte2tsx",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
ts_library(
|
|
|
|
name = "lib",
|
|
|
|
srcs = [
|
|
|
|
"icons.ts",
|
|
|
|
"lib.ts",
|
|
|
|
"steps.ts",
|
2021-04-16 15:29:21 +02:00
|
|
|
"textInputModal.ts",
|
2021-04-12 06:18:30 +02:00
|
|
|
],
|
2021-04-25 10:40:02 +02:00
|
|
|
module_name = "deckoptions",
|
2021-04-12 06:18:30 +02:00
|
|
|
deps = [
|
2021-04-16 15:29:21 +02:00
|
|
|
"TextInputModal",
|
2021-04-12 06:18:30 +02:00
|
|
|
"//ts:image_module_support",
|
|
|
|
"//ts/lib",
|
|
|
|
"//ts/lib:backend_proto",
|
2021-04-24 02:14:54 +02:00
|
|
|
"//ts/sveltelib",
|
2021-04-16 15:29:21 +02:00
|
|
|
"@npm//lodash-es",
|
|
|
|
"@npm//svelte",
|
2021-04-12 06:18:30 +02:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
esbuild(
|
2021-04-25 10:40:02 +02:00
|
|
|
name = "deckoptions",
|
2021-04-12 06:18:30 +02:00
|
|
|
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-25 10:40:02 +02:00
|
|
|
output_css = "deckoptions.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",
|
2021-04-22 11:52:44 +02:00
|
|
|
"//ts/sveltelib",
|
2021-04-12 06:18:30 +02:00
|
|
|
] + svelte_names,
|
|
|
|
)
|
|
|
|
|
2021-04-25 10:40:02 +02:00
|
|
|
exports_files(["deckoptions.html"])
|
2021-04-12 06:18:30 +02:00
|
|
|
|
|
|
|
# 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",
|
2021-04-16 15:29:21 +02:00
|
|
|
]) + [
|
|
|
|
"@npm//@types/bootstrap",
|
2021-04-25 11:05:19 +02:00
|
|
|
"@npm//@types/lodash-es",
|
2021-04-16 15:29:21 +02:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
jest_test(
|
2021-04-17 09:05:48 +02:00
|
|
|
protobuf = True,
|
2021-04-16 15:46:31 +02:00
|
|
|
deps = [
|
|
|
|
":lib",
|
|
|
|
"//ts/lib:backend_proto",
|
2021-04-17 08:38:45 +02:00
|
|
|
"@npm//protobufjs",
|
2021-04-17 13:00:10 +02:00
|
|
|
"@npm//svelte",
|
2021-04-16 15:46:31 +02:00
|
|
|
],
|
2021-04-12 06:18:30 +02:00
|
|
|
)
|