Skip to content
File

Blob: build/wd_ts_project.bzl

906 bytes
1load("@aspect_rules_ts//ts:defs.bzl", "ts_config", "ts_project")
2load("@workerd//:build/lint_test.bzl", "lint_test")
3 
4def wd_ts_project(name, srcs, deps, tsconfig_json, eslintrc_json = None, source_map = True, testonly = False, composite = False):
5 """Bazel rule for a workerd TypeScript project, setting common options"""
6 
7 ts_config(
8 name = name + "@tsconfig",
9 src = tsconfig_json,
10 deps = ["@workerd//tools:base-tsconfig"],
11 )
12 
13 ts_project(
14 name = name,
15 srcs = srcs,
16 deps = deps,
17 tsconfig = ":" + name + "@tsconfig",
18 allow_js = True,
19 source_map = source_map,
20 testonly = testonly,
21 composite = composite,
22 )
23 
24 if eslintrc_json:
25 lint_test(
26 name = name,
27 eslintrc_json = eslintrc_json,
28 tsconfig_json = tsconfig_json,
29 srcs = srcs + deps,
30 )