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") load("//ts:vendor.bzl", "copy_bootstrap_icons", "copy_mdi_icons") 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"], ) 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/sveltelib", "//ts/lib", "//ts/lib:backend_proto", "//ts:image_module_support", "@npm//svelte", ], ) copy_bootstrap_icons( name = "bootstrap-icons", icons = [ "type-bold.svg", "type-italic.svg", "type-underline.svg", "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", "code-brackets.svg", "xml.svg", ], ) esbuild( name = "editor-toolbar", srcs = [ "//ts:protobuf-shim.js", ], args = [ "--global-name=editorToolbar", "--inject:$(location //ts:protobuf-shim.js)", "--loader:.svg=text", ], 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", "//ts:image_module_support", "bootstrap-icons", "mdi-icons", ":color_css", ] + 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", ]), )