-
-
Notifications
You must be signed in to change notification settings - Fork 519
/
Copy pathBUILD.bazel
60 lines (53 loc) · 1.37 KB
/
BUILD.bazel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# TODO: add unit tests instead of only testing building
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@npm//:defs.bzl", "npm_link_all_packages")
load("@npm//vue:vite/package_json.bzl", vite_bin = "bin")
load("@npm//vue:vue-tsc/package_json.bzl", vue_tsc_bin = "bin")
# This macro expands to a link_npm_package for each third-party package in package.json
npm_link_all_packages(name = "node_modules")
SRCS = [
"env.d.ts",
"index.html",
"package.json",
"vite.config.ts",
"tsconfig.json",
"tsconfig.config.json",
"//vue/src",
]
BUILD_DEPS = [":node_modules/" + d for d in [
"@bazel-example/vue-library",
"@vitejs/plugin-vue",
"@vitejs/plugin-vue-jsx",
"@vue/tsconfig",
"vite",
"vue",
"vue-router",
]]
vite_bin.vite(
name = "build",
srcs = SRCS + BUILD_DEPS,
args = ["build"],
chdir = package_name(),
out_dirs = ["dist"],
)
vue_tsc_bin.vue_tsc_test(
name = "type-check",
args = ["--noEmit"],
chdir = package_name(),
data = SRCS + BUILD_DEPS,
include_types = True,
)
vite_bin.vite_binary(
name = "vite",
chdir = package_name(),
data = SRCS + BUILD_DEPS,
# Under ibazel, let vite hot-reload changed files rather than restart it
tags = ["ibazel_notify_changes"],
)
build_test(
name = "build_test",
targets = [
":build",
":type-check",
],
)