mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-14 16:49:10 +00:00
chore: add react & styled-components to react macro, as most are implied.
This commit is contained in:
parent
ba558ecf91
commit
e61f827645
42 changed files with 21 additions and 154 deletions
|
@ -1,6 +1,13 @@
|
|||
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||
load("//hack/bazel:utils.bzl", "render_deps")
|
||||
|
||||
DEFAULT_DEPS = [
|
||||
"react",
|
||||
"styled-components",
|
||||
"@types/react",
|
||||
"@types/styled-components",
|
||||
]
|
||||
|
||||
def react_library(name, deps = [], **kwargs):
|
||||
ts_library(
|
||||
name = name,
|
||||
|
@ -15,6 +22,6 @@ def react_library(name, deps = [], **kwargs):
|
|||
"*.stories.tsx",
|
||||
]),
|
||||
),
|
||||
deps = render_deps(deps),
|
||||
deps = render_deps(deps + DEFAULT_DEPS),
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
def _append_once(targetList, item):
|
||||
if item not in targetList:
|
||||
targetList.append(item)
|
||||
|
||||
def _extend_once(targetList, items):
|
||||
for item in items:
|
||||
_append_once(targetList, item)
|
||||
|
||||
def render_deps(deps = []):
|
||||
output_deps = []
|
||||
|
||||
|
@ -5,18 +13,18 @@ def render_deps(deps = []):
|
|||
|
||||
for dep in deps:
|
||||
if dep.startswith("//src/rpc"):
|
||||
output_deps.append(dep + ":ts")
|
||||
output_deps.append(dep + ":ts_proto")
|
||||
_append_once(output_deps, dep + ":ts")
|
||||
_append_once(output_deps, dep + ":ts_proto")
|
||||
if has_added_grpc_deps == False:
|
||||
output_deps.extend([
|
||||
_extend_once(output_deps, [
|
||||
"@npm//google-protobuf",
|
||||
"@npm//@types/google-protobuf",
|
||||
"@npm//@improbable-eng/grpc-web",
|
||||
])
|
||||
has_added_grpc_deps = True
|
||||
elif dep.startswith("//") or dep.startswith("@npm//"):
|
||||
output_deps.append(dep)
|
||||
_append_once(output_deps, dep)
|
||||
else:
|
||||
output_deps.append("@npm//" + dep)
|
||||
_append_once(output_deps, "@npm//" + dep)
|
||||
|
||||
return output_deps
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue