2021-01-31 14:15:03 +01:00
|
|
|
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
2021-04-27 23:08:47 +02:00
|
|
|
load("//ts/svelte:svelte.bzl", "compile_svelte", "svelte_check")
|
2021-01-31 14:15:03 +01:00
|
|
|
load("//ts:prettier.bzl", "prettier_test")
|
|
|
|
load("//ts:eslint.bzl", "eslint_test")
|
2021-03-20 05:02:19 +01:00
|
|
|
load("//ts:esbuild.bzl", "esbuild")
|
2021-04-20 02:07:15 +02:00
|
|
|
load("//ts:vendor.bzl", "copy_bootstrap_icons", "copy_mdi_icons")
|
2021-04-13 18:17:32 +02:00
|
|
|
load("//ts:compile_sass.bzl", "compile_sass")
|
2021-01-31 19:03:40 +01:00
|
|
|
|
2021-04-27 23:08:47 +02:00
|
|
|
svelte_files = glob(["*.svelte"])
|
|
|
|
|
|
|
|
svelte_names = [f.replace(".svelte", "") for f in svelte_files]
|
|
|
|
|
|
|
|
filegroup(
|
|
|
|
name = "svelte_components",
|
|
|
|
srcs = svelte_names,
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
|
|
|
compile_svelte(
|
|
|
|
name = "svelte",
|
|
|
|
srcs = svelte_files,
|
2021-04-28 13:09:25 +02:00
|
|
|
deps = [
|
|
|
|
"//ts/components",
|
|
|
|
],
|
2021-04-27 23:08:47 +02:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
2021-04-13 18:17:32 +02:00
|
|
|
compile_sass(
|
2021-04-12 06:18:30 +02:00
|
|
|
srcs = [
|
|
|
|
"editable.scss",
|
2021-04-19 23:51:09 +02:00
|
|
|
],
|
|
|
|
group = "editable_scss",
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
"//ts/sass:scrollbar_lib",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
compile_sass(
|
|
|
|
srcs = [
|
|
|
|
"fields.scss",
|
2021-04-20 02:07:15 +02:00
|
|
|
"color.scss",
|
2021-04-12 06:18:30 +02:00
|
|
|
],
|
2021-04-13 18:17:32 +02:00
|
|
|
group = "base_css",
|
2021-04-12 06:18:30 +02:00
|
|
|
visibility = ["//visibility:public"],
|
2021-04-13 18:17:32 +02:00
|
|
|
deps = [
|
|
|
|
"//ts/sass:base_lib",
|
|
|
|
"//ts/sass:buttons_lib",
|
|
|
|
"//ts/sass:scrollbar_lib",
|
|
|
|
],
|
2021-01-31 19:03:40 +01:00
|
|
|
)
|
2021-01-31 14:15:03 +01:00
|
|
|
|
2021-04-27 23:08:47 +02:00
|
|
|
compile_sass(
|
|
|
|
srcs = [
|
|
|
|
"bootstrap.scss",
|
|
|
|
"legacy.scss",
|
|
|
|
],
|
|
|
|
group = "local_css",
|
|
|
|
deps = [
|
|
|
|
"//ts/sass:button_mixins_lib",
|
|
|
|
"//ts/sass/bootstrap",
|
|
|
|
],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
2021-01-31 14:15:03 +01:00
|
|
|
ts_library(
|
|
|
|
name = "editor_ts",
|
|
|
|
srcs = glob(["*.ts"]),
|
2021-03-26 04:58:03 +01:00
|
|
|
tsconfig = "//ts:tsconfig.json",
|
2021-01-31 14:15:03 +01:00
|
|
|
deps = [
|
2021-04-20 02:07:15 +02:00
|
|
|
"//ts/lib",
|
|
|
|
"//ts/sveltelib",
|
2021-04-27 23:08:47 +02:00
|
|
|
"//ts/components",
|
2021-03-25 00:43:01 +01:00
|
|
|
"//ts/html-filter",
|
2021-04-28 13:09:25 +02:00
|
|
|
"//ts:image_module_support",
|
2021-04-20 02:07:15 +02:00
|
|
|
"@npm//svelte",
|
2021-05-06 23:04:38 +02:00
|
|
|
] + svelte_names,
|
2021-01-31 14:15:03 +01:00
|
|
|
)
|
|
|
|
|
2021-03-28 18:47:06 +02:00
|
|
|
copy_bootstrap_icons(
|
2021-03-26 04:18:16 +01:00
|
|
|
name = "bootstrap-icons",
|
2021-04-20 02:07:15 +02:00
|
|
|
icons = [
|
|
|
|
"pin-angle.svg",
|
|
|
|
|
|
|
|
# inline formatting
|
|
|
|
"type-bold.svg",
|
|
|
|
"type-italic.svg",
|
|
|
|
"type-underline.svg",
|
|
|
|
"eraser.svg",
|
|
|
|
"square-fill.svg",
|
|
|
|
"paperclip.svg",
|
|
|
|
"mic.svg",
|
|
|
|
|
|
|
|
# block formatting
|
|
|
|
"list-ul.svg",
|
|
|
|
"list-ol.svg",
|
|
|
|
"text-paragraph.svg",
|
|
|
|
"justify.svg",
|
|
|
|
"text-left.svg",
|
|
|
|
"text-right.svg",
|
|
|
|
"text-center.svg",
|
|
|
|
"text-indent-left.svg",
|
|
|
|
"text-indent-right.svg",
|
|
|
|
],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
|
|
|
copy_mdi_icons(
|
|
|
|
name = "mdi-icons",
|
|
|
|
icons = [
|
|
|
|
"format-superscript.svg",
|
|
|
|
"format-subscript.svg",
|
|
|
|
"function-variant.svg",
|
|
|
|
"code-brackets.svg",
|
|
|
|
"xml.svg",
|
|
|
|
],
|
|
|
|
visibility = ["//visibility:public"],
|
2021-03-26 04:18:16 +01:00
|
|
|
)
|
|
|
|
|
2021-03-20 05:02:19 +01:00
|
|
|
esbuild(
|
2021-01-31 14:15:03 +01:00
|
|
|
name = "editor",
|
2021-04-19 23:51:09 +02:00
|
|
|
srcs = [
|
|
|
|
"//ts:protobuf-shim.js",
|
|
|
|
],
|
2021-03-29 09:59:06 +02:00
|
|
|
args = [
|
|
|
|
"--loader:.svg=text",
|
2021-04-19 23:51:09 +02:00
|
|
|
"--inject:$(location //ts:protobuf-shim.js)",
|
2021-04-07 06:53:53 +02:00
|
|
|
"--resolve-extensions=.mjs,.js",
|
|
|
|
"--log-level=warning",
|
2021-03-29 09:59:06 +02:00
|
|
|
],
|
2021-04-19 23:51:09 +02:00
|
|
|
output_css = "editor.css",
|
|
|
|
external = [
|
|
|
|
"protobufjs/light",
|
|
|
|
],
|
2021-03-20 05:02:19 +01:00
|
|
|
entry_point = "index_wrapper.ts",
|
2021-01-31 14:15:03 +01:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
2021-04-12 06:18:30 +02:00
|
|
|
"base_css",
|
2021-04-19 23:51:09 +02:00
|
|
|
"bootstrap-icons",
|
2021-04-20 02:07:15 +02:00
|
|
|
"mdi-icons",
|
2021-04-19 23:51:09 +02:00
|
|
|
"editor_ts",
|
2021-04-27 23:08:47 +02:00
|
|
|
"local_css",
|
|
|
|
"svelte_components",
|
2021-04-28 13:32:25 +02:00
|
|
|
"//ts/components",
|
2021-04-27 23:08:47 +02:00
|
|
|
"//ts/components:svelte_components",
|
2021-01-31 14:15:03 +01:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
# Tests
|
|
|
|
################
|
|
|
|
|
|
|
|
prettier_test(
|
|
|
|
name = "format_check",
|
|
|
|
srcs = glob([
|
|
|
|
"*.ts",
|
|
|
|
]),
|
|
|
|
)
|
|
|
|
|
2021-05-06 23:33:28 +02:00
|
|
|
eslint_test(
|
|
|
|
name = "eslint",
|
|
|
|
srcs = glob(
|
|
|
|
[
|
|
|
|
"*.ts",
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
2021-04-27 23:08:47 +02:00
|
|
|
|
|
|
|
svelte_check(
|
|
|
|
name = "svelte_check",
|
|
|
|
srcs = glob([
|
|
|
|
"*.ts",
|
|
|
|
"*.svelte",
|
|
|
|
]) + [
|
|
|
|
"//ts/sass:button_mixins_lib",
|
|
|
|
"//ts/sass/bootstrap",
|
2021-04-28 02:27:38 +02:00
|
|
|
"//ts/components:svelte_components",
|
2021-05-06 23:04:38 +02:00
|
|
|
"@npm//@types/bootstrap",
|
2021-04-27 23:08:47 +02:00
|
|
|
],
|
2021-05-08 04:15:49 +02:00
|
|
|
target_compatible_with = select({
|
|
|
|
"@platforms//os:osx": [],
|
|
|
|
"@platforms//os:linux": [],
|
|
|
|
"//conditions:default": ["@platforms//os:linux"],
|
|
|
|
}),
|
2021-04-27 23:08:47 +02:00
|
|
|
)
|