load(
"@prelude-si//:deno.bzl",
"deno_format",
"deno_run",
"deno_test",
)
load(
"@prelude-si//:macros.bzl",
"alias",
"deno_binary",
"export_file",
"nix_omnibus_pkg",
)
export_file(
name = "deno.json",
)
filegroup(
name = "srcs",
srcs = glob([
"**/*",
]),
visibility = ["PUBLIC"],
)
# this builds bundle.js so it can be used at runtime by function execution
deno_run(
name = "bundle",
main = "src/build.ts",
out = "src/bundle.js",
srcs = glob(["src/**/*.ts"]),
permissions = [
"allow-all",
],
visibility = ["PUBLIC"],
)
deno_binary(
name = "lang-js",
main = "src/index.ts",
srcs = glob([
"src/**/*.ts",
"src/**/*.js",
]),
extra_srcs = {
"bundle.js": ":bundle",
},
permissions = [
"allow-all",
],
unstable_flags = [
"node-globals",
],
visibility = ["PUBLIC"],
)
deno_format(
name = "fix-format",
srcs = glob(["**/*.ts", "**/*.js"]),
ignore = ["node_modules"],
)
deno_format(
name = "check-format",
srcs = glob(["**/*.ts", "**/*.js"]),
check = True,
)
deno_test(
name = "test-unit",
srcs = glob(["**/tests/**/*.ts"]),
extra_srcs = {
"src/bundle.js": ":bundle",
},
ignore = ["node_modules"],
permissions = [
"allow-all",
],
unstable_flags = [
"worker-options",
],
parallel = False,
)
nix_omnibus_pkg(
name = "omnibus",
pkg_name = "lang-js",
build_dep = "//bin/lang-js:lang-js",
srcs = {
"//:flake.nix": ".",
"//:flake.lock": ".",
"//:rust-toolchain": ".",
},
)