load(
"@prelude-si//:macros.bzl",
"docker_image",
"eslint",
"e2e_test",
"export_file",
"package_node_modules",
"shellcheck",
"shfmt_check",
"test_suite",
"typescript_check",
"vite_app",
)
load(
"@prelude-si//:pnpm.bzl",
"pnpm_task_library",
"pnpm_task_binary",
"pnpm_task_test",
)
export_file(
name = "package.json",
)
export_file(
name = "editor_typescript.txt",
src = "src/assets/static/editor_typescript.txt",
visibility = ["PUBLIC"],
)
package_node_modules(
name = "node_modules",
)
filegroup(
name = "src",
srcs = glob([
".env",
"build-src/**/*",
"index.html",
"postcss.config.js",
"public/**/*",
"src/**/*",
"tailwind.config.cjs",
"tsconfig.json",
"tsconfig.node.json",
"vite.config.ts",
]),
)
export_file(
name = "docker-entrypoint.sh",
)
shfmt_check(
name = "check-format-shell",
srcs = [":docker-entrypoint.sh"],
)
shellcheck(
name = "check-lint-shell",
srcs = [":docker-entrypoint.sh"],
)
filegroup(
name = "nginx_src",
srcs = glob([
"nginx.conf",
])
)
prod_deps_srcs = {
"lib/ts-lib": "//lib/ts-lib:src",
"lib/vue-lib": "//lib/vue-lib:src",
"lib/yjs-codemirror-plugin": "//lib/yjs-codemirror-plugin:src",
}
dev_deps_srcs = {
"lib/eslint-config": "//lib/eslint-config:src",
"lib/tsconfig": "//lib/tsconfig:src",
}
vite_app(
name = "web",
srcs = [":src"],
prod_deps_srcs = prod_deps_srcs,
dev_deps_srcs = dev_deps_srcs,
)
eslint(
name = "check-lint-typescript",
srcs = [":src"] + glob([".eslint*"]),
prod_deps_srcs = prod_deps_srcs,
dev_deps_srcs = dev_deps_srcs,
)
typescript_check(
name = "check-type",
srcs = [":src"],
tsc_bin = "vue-tsc",
prod_deps_srcs = prod_deps_srcs,
dev_deps_srcs = dev_deps_srcs,
)
docker_image(
name = "image",
image_name = "web",
flake_lock = "//:flake.lock",
build_deps = [
"//app/web:web",
"//app/web:docker-entrypoint.sh",
"//app/web:nginx_src",
]
)
test_suite(
name = "check-format",
tests = [
":check-format-shell",
],
)
test_suite(
name = "check-lint",
tests = [
":check-lint-typescript",
":check-lint-shell",
],
)
#
#
#
# TODO(fnichol): DEAL
#
#
#
pnpm_task_binary(
name = "fix-lint",
command = "lint:fix",
srcs = glob(["src/**/*"]),
path = "app/web",
deps = [
"//:node_modules",
],
visibility = ["PUBLIC"],
)
pnpm_task_binary(
name = "dev",
command = "dev",
srcs = glob(["src/**/*"]),
path = "app/web",
deps = [
"//:node_modules",
],
visibility = ["PUBLIC"],
)
pnpm_task_binary(
name = "clean",
command = "clean",
path = "app/web",
visibility = ["PUBLIC"],
)
pnpm_task_test(
name = "test-unit",
command = "test",
deps = [
"//:node_modules",
],
path = "app/web",
visibility = ["PUBLIC"],
)
e2e_test(
name = "e2e-test",
)