Skip to content

Commit 88c28db

Browse files
committed
build: move ts_project(transpiler) setup to defs.bzl
1 parent 00064f3 commit 88c28db

File tree

4 files changed

+22
-21
lines changed

4 files changed

+22
-21
lines changed

pnpm-workspaces/apps/alpha/BUILD.bazel

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
1-
load("@aspect_rules_swc//swc:defs.bzl", "swc")
2-
load("@aspect_rules_ts//ts:defs.bzl", "ts_project")
31
load("@aspect_rules_js//js:defs.bzl", "js_binary")
4-
load("@bazel_skylib//lib:partial.bzl", "partial")
52
load("@npm//:defs.bzl", "npm_link_all_packages")
3+
load("//:defs.bzl", "ts_project")
64

75
npm_link_all_packages(name = "node_modules")
86

97
ts_project(
108
name = "pkg",
119
srcs = ["src/main.ts"],
1210
declaration = True,
13-
transpiler = partial.make(
14-
swc,
15-
swcrc = "//:.swcrc",
16-
),
1711
tsconfig = "//:tsconfig",
1812
deps = [
1913
":node_modules/inspirational-quotes", # this uses the version defined in the local package.json

pnpm-workspaces/defs.bzl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""
2+
@aspect_rules_ts macros to enable custom config, transpiler.
3+
"""
4+
5+
load("@aspect_rules_ts//ts:defs.bzl", _ts_project = "ts_project")
6+
load("@aspect_rules_swc//swc:defs.bzl", "swc")
7+
load("@bazel_skylib//lib:partial.bzl", "partial")
8+
9+
def ts_project(name, **kwargs):
10+
_ts_project(
11+
name = name,
12+
declaration = kwargs.pop("declaration", True),
13+
transpiler = partial.make(
14+
swc,
15+
swcrc = "//:.swcrc",
16+
),
17+
tsconfig = kwargs.pop("tsconfig", "//:tsconfig"),
18+
**kwargs
19+
)

pnpm-workspaces/packages/one/BUILD.bazel

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
load("@aspect_rules_swc//swc:defs.bzl", "swc")
2-
load("@aspect_rules_ts//ts:defs.bzl", "ts_project")
31
load("@aspect_rules_js//npm:defs.bzl", "npm_package")
4-
load("@bazel_skylib//lib:partial.bzl", "partial")
2+
load("//:defs.bzl", "ts_project")
53

64
ts_project(
75
name = "one_lib",
86
srcs = ["src/main.ts"],
97
declaration = True,
10-
transpiler = partial.make(
11-
swc,
12-
swcrc = "//:.swcrc",
13-
),
148
tsconfig = "//:tsconfig",
159
deps = [
1610
"//:node_modules/@types/node",

pnpm-workspaces/packages/shared/BUILD.bazel

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
load("@aspect_rules_swc//swc:defs.bzl", "swc")
2-
load("@aspect_rules_ts//ts:defs.bzl", "ts_project")
31
load("@aspect_rules_js//npm:defs.bzl", "npm_package")
4-
load("@bazel_skylib//lib:partial.bzl", "partial")
2+
load("//:defs.bzl", "ts_project")
53

64
ts_project(
75
name = "shared_lib",
86
srcs = ["src/main.ts"],
97
declaration = True,
10-
transpiler = partial.make(
11-
swc,
12-
swcrc = "//:.swcrc",
13-
),
148
tsconfig = "//:tsconfig",
159
deps = [
1610
"//:node_modules/@types/node",

0 commit comments

Comments
 (0)