anki/qt/aqt/data/web/js/BUILD.bazel
2021-01-31 13:34:37 +01:00

77 lines
1.5 KiB
Python

load("@npm//@bazel/typescript:index.bzl", "ts_library")
load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
load("//ts:prettier.bzl", "prettier_test")
load("//ts:eslint.bzl", "eslint_test")
ts_library(
name = "pycmd",
srcs = ["pycmd.d.ts"],
visibility = ["//qt/aqt/data/web/js:__subpackages__"],
)
ts_library(
name = "aqt",
srcs = glob(
["*.ts"],
exclude = ["*.d.ts"],
),
tsconfig = "tsconfig.json",
deps = [
"pycmd",
"@npm//@types/jquery",
"@npm//@types/jqueryui",
],
)
filegroup(
name = "aqt_es5",
srcs = ["aqt"],
output_group = "es5_sources",
)
###### aqt bundles
rollup_bundle(
name = "editor",
config_file = "rollup.config.js",
entry_point = "//qt/aqt/data/web/js/editor:index.ts",
format = "iife",
link_workspace_root = True,
silent = True,
sourcemap = "false",
deps = [
"//qt/aqt/data/web/js/editor",
"@npm//@rollup/plugin-commonjs",
"@npm//@rollup/plugin-node-resolve",
"@npm//rollup-plugin-terser",
],
)
filegroup(
name = "js",
srcs = [
"aqt_es5",
"editor",
"mathjax.js",
"//qt/aqt/data/web/js/vendor",
],
visibility = ["//qt:__subpackages__"],
)
prettier_test(
name = "format_check",
srcs = glob(["*.ts", "*.js"]),
)
# source files need fixing first
# eslint_test(
# name = "eslint",
# srcs = glob(["*.ts"]),
# )
exports_files([
"mathjax.js",
"tsconfig.json",
])