107 lines
2.2 KiB
Python
107 lines
2.2 KiB
Python
load("//bun:defs.bzl", "bun_build", "bun_bundle", "bun_compile")
|
|
load("@rules_shell//shell:sh_test.bzl", "sh_test")
|
|
|
|
bun_bundle(
|
|
name = "simple_bundle",
|
|
entry_points = ["main.ts"],
|
|
)
|
|
|
|
bun_bundle(
|
|
name = "minified_bundle",
|
|
entry_points = ["main.ts"],
|
|
minify = True,
|
|
)
|
|
|
|
bun_bundle(
|
|
name = "external_bundle",
|
|
entry_points = ["main.ts"],
|
|
external = ["left-pad"],
|
|
)
|
|
|
|
bun_build(
|
|
name = "site_build",
|
|
entry_points = ["site/index.html"],
|
|
data = [
|
|
"site/main.ts",
|
|
"site/styles.css",
|
|
],
|
|
splitting = True,
|
|
)
|
|
|
|
bun_build(
|
|
name = "site_build_with_meta",
|
|
entry_points = ["site/index.html"],
|
|
data = [
|
|
"site/main.ts",
|
|
"site/styles.css",
|
|
],
|
|
metafile = True,
|
|
metafile_md = True,
|
|
)
|
|
|
|
bun_compile(
|
|
name = "compiled_cli",
|
|
entry_point = "cli.ts",
|
|
)
|
|
|
|
sh_test(
|
|
name = "bundle_output_test",
|
|
srcs = ["verify_bundle.sh"],
|
|
args = ["$(location :simple_bundle)"],
|
|
data = [":simple_bundle"],
|
|
)
|
|
|
|
sh_test(
|
|
name = "bundle_minify_test",
|
|
srcs = ["verify_minify.sh"],
|
|
args = [
|
|
"$(location :simple_bundle)",
|
|
"$(location :minified_bundle)",
|
|
],
|
|
data = [
|
|
":simple_bundle",
|
|
":minified_bundle",
|
|
],
|
|
)
|
|
|
|
sh_test(
|
|
name = "bundle_hermetic_digest_test",
|
|
srcs = ["verify_hermetic_shape.sh"],
|
|
args = ["$(location //internal:bun_bundle.bzl)"],
|
|
data = ["//internal:bun_bundle.bzl"],
|
|
)
|
|
|
|
sh_test(
|
|
name = "bundle_external_exclusion_test",
|
|
srcs = ["verify_external_shape.sh"],
|
|
args = [
|
|
"$(location //internal:bun_bundle.bzl)",
|
|
"$(location //tests/bundle_test:BUILD.bazel)",
|
|
],
|
|
data = [
|
|
"//internal:bun_bundle.bzl",
|
|
"//tests/bundle_test:BUILD.bazel",
|
|
],
|
|
)
|
|
|
|
sh_test(
|
|
name = "bun_build_site_output_test",
|
|
srcs = ["verify_site_build.sh"],
|
|
args = ["$(location :site_build)"],
|
|
data = [":site_build"],
|
|
)
|
|
|
|
sh_test(
|
|
name = "bun_build_site_meta_test",
|
|
srcs = ["verify_site_build_meta.sh"],
|
|
args = ["$(locations :site_build_with_meta)"],
|
|
data = [":site_build_with_meta"],
|
|
)
|
|
|
|
sh_test(
|
|
name = "bun_compile_output_test",
|
|
srcs = ["run_compiled_binary.sh"],
|
|
args = ["$(location :compiled_cli)"],
|
|
data = [":compiled_cli"],
|
|
)
|