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-03-29 17:32:43 +02:00
|
|
|
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,
|
|
|
|
)
|
|
|
|
|
2021-03-29 17:32:43 +02:00
|
|
|
sass_binary(
|
|
|
|
name = "color_css",
|
|
|
|
src = "color.scss",
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
2021-03-25 21:11:40 +01:00
|
|
|
ts_library(
|
|
|
|
name = "index",
|
|
|
|
srcs = ["index.ts"],
|
|
|
|
deps = [
|
|
|
|
"EditorToolbar",
|
|
|
|
"lib",
|
|
|
|
"//ts/lib",
|
|
|
|
"@npm//svelte",
|
|
|
|
"@npm//svelte2tsx",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
ts_library(
|
|
|
|
name = "lib",
|
|
|
|
srcs = glob(
|
|
|
|
["*.ts"],
|
|
|
|
exclude = ["index.ts"],
|
|
|
|
),
|
|
|
|
deps = [
|
|
|
|
"//ts/lib",
|
|
|
|
"//ts/lib:backend_proto",
|
2021-03-29 17:32:43 +02:00
|
|
|
"//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",
|
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-03-25 21:11:40 +01:00
|
|
|
"--inject: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",
|
2021-03-29 17:32:43 +02:00
|
|
|
":color_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",
|
|
|
|
]),
|
|
|
|
)
|
|
|
|
|