mirror of
https://github.com/ankitects/anki.git
synced 2025-11-29 16:07:13 -05:00
- try out bootstrap modals - they're not perfect, but let's see how they go for now. Won't be hard to switch to bridge commands if required. - handle adding/renaming/removing - add a class to manage the state
159 lines
3.1 KiB
Text
159 lines
3.1 KiB
Text
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")
|
|
load("@npm//jest-cli:index.bzl", "jest_test")
|
|
|
|
compile_sass(
|
|
srcs = ["deckconfig-base.scss"],
|
|
group = "base_css",
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
"//ts/sass:base_lib",
|
|
"//ts/sass:scrollbar_lib",
|
|
"//ts/sass/bootstrap",
|
|
],
|
|
)
|
|
|
|
svelte_files = glob(["*.svelte"])
|
|
|
|
svelte_names = [f.replace(".svelte", "") for f in svelte_files]
|
|
|
|
compile_svelte(
|
|
name = "svelte",
|
|
srcs = svelte_files,
|
|
deps = [
|
|
"@npm//@types/bootstrap",
|
|
],
|
|
)
|
|
|
|
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",
|
|
"textInputModal.ts",
|
|
],
|
|
module_name = "deckconfig",
|
|
deps = [
|
|
"TextInputModal",
|
|
"//ts:image_module_support",
|
|
"//ts/lib",
|
|
"//ts/lib:backend_proto",
|
|
"@npm//lodash-es",
|
|
"@npm//svelte",
|
|
],
|
|
)
|
|
|
|
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",
|
|
],
|
|
output_css = "deckconfig.css",
|
|
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",
|
|
]) + [
|
|
"@npm//@types/bootstrap",
|
|
],
|
|
)
|
|
|
|
ts_library(
|
|
name = "test_lib",
|
|
srcs = glob(["*.test.ts"]),
|
|
tsconfig = "//ts:tsconfig.json",
|
|
deps = [
|
|
":lib",
|
|
"//ts/lib:backend_proto",
|
|
"@npm//@types/jest",
|
|
],
|
|
)
|
|
|
|
jest_test(
|
|
name = "test",
|
|
args = [
|
|
"--no-cache",
|
|
"--no-watchman",
|
|
"--ci",
|
|
"--colors",
|
|
"--config",
|
|
"$(location //ts:jest.config.js)",
|
|
],
|
|
data = [
|
|
":test_lib",
|
|
"//ts:jest.config.js",
|
|
"@npm//protobufjs",
|
|
],
|
|
target_compatible_with = select({
|
|
"@platforms//os:osx": [],
|
|
"@platforms//os:linux": [],
|
|
"//conditions:default": ["@platforms//os:linux"],
|
|
}),
|
|
)
|