anki/ts/editor-toolbar/BUILD.bazel

139 lines
2.6 KiB
Python
Raw Normal View History

2021-03-25 21:11:40 +01:00
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("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
2021-03-29 15:27:42 +02:00
load("//ts:vendor.bzl", "copy_bootstrap_icons", "copy_mdi_icons")
2021-03-25 21:11:40 +01:00
svelte_files = glob(["*.svelte"])
svelte_names = [f.replace(".svelte", "") for f in svelte_files]
compile_svelte(
name = "svelte",
srcs = svelte_files,
)
sass_binary(
name = "color_css",
src = "color.scss",
visibility = ["//visibility:public"],
)
sass_binary(
name = "legacy_css",
src = "legacy.scss",
visibility = ["//visibility:public"],
)
2021-03-25 21:11:40 +01:00
ts_library(
name = "index",
srcs = ["index.ts"],
deps = [
"EditorToolbar",
"lib",
"//ts/lib",
"//ts/sveltelib",
2021-03-25 21:11:40 +01:00
"@npm//svelte",
"@npm//svelte2tsx",
],
)
ts_library(
name = "lib",
srcs = glob(
["*.ts"],
exclude = ["index.ts"],
),
deps = [
"//ts/lib",
"//ts/lib:backend_proto",
"//ts/sveltelib",
"//ts:image_module_support",
2021-03-25 21:11:40 +01:00
"@npm//svelte",
],
)
2021-03-29 14:54:10 +02:00
copy_bootstrap_icons(
name = "bootstrap-icons",
icons = [
"type-bold.svg",
"type-italic.svg",
"type-underline.svg",
2021-03-29 15:27:42 +02:00
"eraser.svg",
"square-fill.svg",
"paperclip.svg",
"mic.svg",
],
)
copy_mdi_icons(
name = "mdi-icons",
icons = [
"format-superscript.svg",
"format-subscript.svg",
"function-variant.svg",
2021-03-29 15:27:42 +02:00
"code-brackets.svg",
"xml.svg",
2021-03-29 14:54:10 +02:00
],
)
2021-03-25 21:11:40 +01:00
esbuild(
name = "editor-toolbar",
srcs = [
"//ts:protobuf-shim.js",
],
args = [
"--global-name=editorToolbar",
2021-04-03 03:19:30 +02:00
"--inject:$(location //ts:protobuf-shim.js)",
2021-03-29 14:54:10 +02:00
"--loader:.svg=text",
2021-03-25 21:11:40 +01:00
],
entry_point = "index.ts",
external = [
"protobufjs/light",
],
output_css = True,
visibility = ["//visibility:public"],
deps = [
"//ts/lib",
"//ts/lib:backend_proto",
":index",
"//ts/sass:core_css",
2021-03-29 14:54:10 +02:00
"//ts:image_module_support",
"bootstrap-icons",
2021-03-29 15:27:42 +02:00
"mdi-icons",
":color_css",
":legacy_css",
2021-03-25 21:11:40 +01:00
] + svelte_names,
)
# 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",
]),
)