anki/ts/editor-toolbar/BUILD.bazel

143 lines
2.8 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("//ts:compile_sass.bzl", "compile_sass")
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,
)
compile_sass(
group = "local_css",
srcs = [
"color.scss",
"legacy.scss",
2021-04-14 14:37:14 +02:00
"bootstrap.scss",
],
deps = [
2021-04-15 13:30:19 +02:00
"//ts/sass/bootstrap",
"//ts/sass:button_mixins_lib",
],
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",
"@npm//bootstrap",
"@npm//@popperjs/core",
"@npm//@types/bootstrap",
2021-03-25 21:11:40 +01:00
],
)
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)",
"--resolve-extensions=.mjs,.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 = "editor-toolbar.css",
2021-03-25 21:11:40 +01:00
visibility = ["//visibility:public"],
deps = [
"//ts/lib",
"//ts/lib:backend_proto",
2021-03-29 14:54:10 +02:00
"//ts:image_module_support",
"index",
2021-03-29 14:54:10 +02:00
"bootstrap-icons",
2021-03-29 15:27:42 +02:00
"mdi-icons",
"local_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",
]),
)