-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
BUILD.bazel
127 lines (116 loc) · 3.02 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
load("@build_bazel_rules_nodejs//:index.bzl", "generated_file_test", "js_library", "pkg_npm")
load("@npm//@bazel/esbuild:index.bzl", "esbuild")
load("@npm//@bazel/terser:index.bzl", "terser_minified")
load("@npm//@bazel/typescript:index.bzl", "ts_project")
load("@npm//@microsoft/api-extractor:index.bzl", "api_extractor")
package(default_visibility = ["//visibility:public"])
pkg_npm(
name = "pkg",
srcs = [
":package.json",
],
substitutions = {"//internal/": "//"},
deps = [
":LICENSE",
":README.md",
":core.cjs",
":core.d.ts",
":core.js",
":qwikloader",
":qwikloader.min",
],
)
esbuild(
name = "core_js",
entry_point = "//src/core:index.ts",
format = "esm",
output = "core.js",
target = "es2017",
tool = select({
"@bazel_tools//src/conditions:darwin": "@esbuild_darwin//:bin/esbuild",
"@bazel_tools//src/conditions:linux_x86_64": "@esbuild_linux//:bin/esbuild",
"@bazel_tools//src/conditions:windows": "@esbuild_windows//:esbuild.exe",
}),
deps = [
"//src/core",
],
)
esbuild(
name = "core_cjs",
entry_point = "//src/core:index.ts",
format = "cjs",
output = "core.cjs",
sources_content = True, # Needed so that node debugger can show Source Code.
target = "es2017",
tool = select({
"@bazel_tools//src/conditions:darwin": "@esbuild_darwin//:bin/esbuild",
"@bazel_tools//src/conditions:linux_x86_64": "@esbuild_linux//:bin/esbuild",
"@bazel_tools//src/conditions:windows": "@esbuild_windows//:esbuild.exe",
}),
deps = [
"//src/core",
],
)
js_library(
name = "builder.io_qwik",
package_name = "@builder.io/qwik", # Needed to allow import from `@builder.io/qwik`
srcs = ["package.json"],
deps = [
":core_js",
],
)
api_extractor(
name = "public_api_extractor",
outs = [
"core.d.ts",
":core.api.md",
],
args = [
"run",
"--verbose",
"--local",
"--config",
"src/core-api-extractor-$(TARGET_CPU).json",
],
data = [
"//:package.json",
"//:tsconfig.json",
"//src:core-api-extractor.json",
"//src:core-api-extractor-darwin.json",
"//src:core-api-extractor-k8.json",
"//src/core",
],
)
generated_file_test(
name = "publicAPI.md",
src = ":core.api.gold.md",
generated = ":core.api.md",
tags = ["unit"],
)
ts_project(
name = "qwikloader",
srcs = ["qwikloader.ts"],
declaration = True,
tsconfig = "//:tsconfig",
)
terser_minified(
name = "qwikloader.min",
src = "qwikloader.js",
config_file = "//:terser.config.json",
sourcemap = False,
terser_bin = "@npm//terser/bin:terser",
)
genrule(
name = "LICENSE.copy",
srcs = ["//:LICENSE"],
outs = ["LICENSE"],
cmd = "cp $< $@",
output_to_bindir = 1,
)
genrule(
name = "README.copy",
srcs = ["//:README.md"],
outs = ["README.md"],
cmd = "cp $< $@",
output_to_bindir = 1,
)