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")
|
2021-04-14 13:48:12 +02:00
|
|
|
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,
|
|
|
|
)
|
|
|
|
|
2021-04-14 13:48:12 +02:00
|
|
|
compile_sass(
|
|
|
|
group = "local_css",
|
|
|
|
srcs = [
|
|
|
|
"color.scss",
|
|
|
|
"legacy.scss",
|
2021-04-14 14:37:14 +02:00
|
|
|
"bootstrap.scss",
|
2021-04-14 13:48:12 +02:00
|
|
|
],
|
2021-04-14 21:58:58 +02:00
|
|
|
deps = [
|
|
|
|
"//ts/sass:button_mixins_lib",
|
|
|
|
],
|
2021-04-09 20:55:49 +02:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
2021-03-25 21:11:40 +01:00
|
|
|
ts_library(
|
|
|
|
name = "index",
|
|
|
|
srcs = ["index.ts"],
|
|
|
|
deps = [
|
|
|
|
"EditorToolbar",
|
|
|
|
"lib",
|
|
|
|
"//ts/lib",
|
2021-04-08 22:11:50 +02:00
|
|
|
"//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",
|
2021-04-08 22:11:50 +02:00
|
|
|
"//ts/sveltelib",
|
2021-03-29 17:32:43 +02:00
|
|
|
"//ts:image_module_support",
|
2021-03-25 21:11:40 +01:00
|
|
|
"@npm//svelte",
|
2021-04-14 14:29:06 +02:00
|
|
|
"@npm//bootstrap",
|
|
|
|
"@npm//@popperjs/core",
|
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",
|
2021-03-30 02:53:57 +02:00
|
|
|
"function-variant.svg",
|
2021-03-29 15:27:42 +02:00
|
|
|
"code-brackets.svg",
|
2021-03-30 02:53:57 +02:00
|
|
|
"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 = [
|
2021-03-30 06:14:00 +02:00
|
|
|
"--global-name=editorToolbar",
|
2021-04-03 03:19:30 +02:00
|
|
|
"--inject:$(location //ts:protobuf-shim.js)",
|
2021-04-14 13:48:12 +02:00
|
|
|
"--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 = True,
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
"//ts/lib",
|
|
|
|
"//ts/lib:backend_proto",
|
2021-03-29 14:54:10 +02:00
|
|
|
"//ts:image_module_support",
|
2021-04-14 13:48:12 +02:00
|
|
|
"index",
|
2021-03-29 14:54:10 +02:00
|
|
|
"bootstrap-icons",
|
2021-03-29 15:27:42 +02:00
|
|
|
"mdi-icons",
|
2021-04-14 13:48:12 +02:00
|
|
|
"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",
|
|
|
|
]),
|
|
|
|
)
|
|
|
|
|