1d4b58419e
I mourn the time lost trying to track this down :-( https://github.com/protobufjs/protobuf.js/issues/1014 We can't patch the minified file in dist without essentially duplicating it, so this change also switches from the external file to including the src file as part of the bundle.
131 lines
2.6 KiB
Python
131 lines
2.6 KiB
Python
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
|
load("//ts:prettier.bzl", "prettier_test")
|
|
load("//ts:eslint.bzl", "eslint_test")
|
|
load("//ts/svelte:svelte.bzl", "compile_svelte", "svelte_check")
|
|
load("//ts:esbuild.bzl", "esbuild")
|
|
load("//ts:compile_sass.bzl", "compile_sass")
|
|
load("//ts:jest.bzl", "jest_test")
|
|
|
|
compile_sass(
|
|
srcs = ["change-notetype-base.scss"],
|
|
group = "base_css",
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
"//ts/sass:base_lib",
|
|
"//ts/sass:scrollbar_lib",
|
|
"//ts/sass/bootstrap",
|
|
],
|
|
)
|
|
|
|
svelte_files = glob(["*.svelte"])
|
|
|
|
svelte_names = [f.replace(".svelte", "") for f in svelte_files]
|
|
|
|
compile_svelte(
|
|
name = "svelte",
|
|
srcs = svelte_files,
|
|
deps = [
|
|
"//ts/components",
|
|
"//ts/sveltelib",
|
|
"@npm//@types/bootstrap",
|
|
],
|
|
)
|
|
|
|
ts_library(
|
|
name = "index",
|
|
srcs = ["index.ts"],
|
|
deps = [
|
|
"ChangeNotetypePage",
|
|
"lib",
|
|
"//ts/components",
|
|
"//ts/lib",
|
|
"@npm//svelte2tsx",
|
|
],
|
|
)
|
|
|
|
ts_library(
|
|
name = "lib",
|
|
srcs = [
|
|
"lib.ts",
|
|
],
|
|
module_name = "change-notetype",
|
|
deps = [
|
|
"//ts/components",
|
|
"//ts/lib",
|
|
"//ts/lib:backend_proto",
|
|
"//ts/sveltelib",
|
|
"@npm//lodash-es",
|
|
"@npm//svelte",
|
|
],
|
|
)
|
|
|
|
esbuild(
|
|
name = "change-notetype",
|
|
args = [
|
|
"--global-name=anki",
|
|
"--resolve-extensions=.mjs,.js",
|
|
"--log-level=warning",
|
|
"--loader:.svg=text",
|
|
],
|
|
entry_point = "index.ts",
|
|
output_css = "change-notetype.css",
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
"index",
|
|
":base_css",
|
|
"@npm//bootstrap",
|
|
"@npm//marked",
|
|
"//ts/lib",
|
|
"//ts/lib:backend_proto",
|
|
"//ts/sveltelib",
|
|
"//ts/components",
|
|
"//ts/components:svelte_components",
|
|
"@npm//protobufjs",
|
|
] + svelte_names,
|
|
)
|
|
|
|
exports_files(["change-notetype.html"])
|
|
|
|
# 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",
|
|
]) + [
|
|
"//ts/sass:button_mixins_lib",
|
|
"//ts/sass/bootstrap",
|
|
"@npm//@types/bootstrap",
|
|
"@npm//@types/lodash-es",
|
|
"@npm//@types/marked",
|
|
"//ts/components",
|
|
],
|
|
)
|
|
|
|
jest_test(
|
|
protobuf = True,
|
|
deps = [
|
|
":lib",
|
|
"//ts/lib:backend_proto",
|
|
"@npm//protobufjs",
|
|
"@npm//svelte",
|
|
],
|
|
)
|