chore: add react & styled-components to react macro, as most are implied.

This commit is contained in:
41666 2020-10-24 21:46:48 -04:00
parent ba558ecf91
commit e61f827645
42 changed files with 21 additions and 154 deletions

View file

@ -1,6 +1,13 @@
load("@npm//@bazel/typescript:index.bzl", "ts_library") load("@npm//@bazel/typescript:index.bzl", "ts_library")
load("//hack/bazel:utils.bzl", "render_deps") load("//hack/bazel:utils.bzl", "render_deps")
DEFAULT_DEPS = [
"react",
"styled-components",
"@types/react",
"@types/styled-components",
]
def react_library(name, deps = [], **kwargs): def react_library(name, deps = [], **kwargs):
ts_library( ts_library(
name = name, name = name,
@ -15,6 +22,6 @@ def react_library(name, deps = [], **kwargs):
"*.stories.tsx", "*.stories.tsx",
]), ]),
), ),
deps = render_deps(deps), deps = render_deps(deps + DEFAULT_DEPS),
**kwargs **kwargs
) )

View file

@ -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 = []): def render_deps(deps = []):
output_deps = [] output_deps = []
@ -5,18 +13,18 @@ def render_deps(deps = []):
for dep in deps: for dep in deps:
if dep.startswith("//src/rpc"): if dep.startswith("//src/rpc"):
output_deps.append(dep + ":ts") _append_once(output_deps, dep + ":ts")
output_deps.append(dep + ":ts_proto") _append_once(output_deps, dep + ":ts_proto")
if has_added_grpc_deps == False: if has_added_grpc_deps == False:
output_deps.extend([ _extend_once(output_deps, [
"@npm//google-protobuf", "@npm//google-protobuf",
"@npm//@types/google-protobuf", "@npm//@types/google-protobuf",
"@npm//@improbable-eng/grpc-web", "@npm//@improbable-eng/grpc-web",
]) ])
has_added_grpc_deps = True has_added_grpc_deps = True
elif dep.startswith("//") or dep.startswith("@npm//"): elif dep.startswith("//") or dep.startswith("@npm//"):
output_deps.append(dep) _append_once(output_deps, dep)
else: else:
output_deps.append("@npm//" + dep) _append_once(output_deps, "@npm//" + dep)
return output_deps return output_deps

View file

@ -7,12 +7,8 @@ react_library(
name = "utils", name = "utils",
deps = [ deps = [
"chroma-js", "chroma-js",
"react",
"styled-components",
"//src/rpc/shared", "//src/rpc/shared",
"@types/chroma-js", "@types/chroma-js",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -5,7 +5,5 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "withContext", name = "withContext",
deps = [ deps = [
"react",
"@types/react",
], ],
) )

View file

@ -5,10 +5,6 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "avatar", name = "avatar",
deps = [ deps = [
"react",
"styled-components",
"//src/design-system/atoms/colors", "//src/design-system/atoms/colors",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -5,8 +5,6 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "branding", name = "branding",
deps = [ deps = [
"react",
"//src/design-system/atoms/colors", "//src/design-system/atoms/colors",
"@types/react",
], ],
) )

View file

@ -5,10 +5,6 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "breakpoints", name = "breakpoints",
deps = [ deps = [
"react",
"styled-components",
"//src/common/utils/withContext", "//src/common/utils/withContext",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -6,13 +6,9 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "button", name = "button",
deps = [ deps = [
"react",
"styled-components",
"//src/design-system/atoms/colors", "//src/design-system/atoms/colors",
"//src/design-system/atoms/fonts", "//src/design-system/atoms/fonts",
"//src/design-system/atoms/typography", "//src/design-system/atoms/typography",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -6,10 +6,6 @@ react_library(
name = "colors", name = "colors",
deps = [ deps = [
"chroma-js", "chroma-js",
"react",
"styled-components",
"@types/chroma-js", "@types/chroma-js",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -5,9 +5,5 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "dot-overlay", name = "dot-overlay",
deps = [ deps = [
"react",
"styled-components",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -5,9 +5,5 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "fader", name = "fader",
deps = [ deps = [
"react",
"styled-components",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -6,9 +6,5 @@ react_library(
name = "fonts", name = "fonts",
deps = [ deps = [
"next", "next",
"react",
"styled-components",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -5,10 +5,6 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "halfsies", name = "halfsies",
deps = [ deps = [
"react",
"styled-components",
"//src/design-system/atoms/breakpoints", "//src/design-system/atoms/breakpoints",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -5,9 +5,5 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "hero", name = "hero",
deps = [ deps = [
"react",
"styled-components",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -5,7 +5,5 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "key-events", name = "key-events",
deps = [ deps = [
"react",
"@types/react",
], ],
) )

View file

@ -5,14 +5,10 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "popover", name = "popover",
deps = [ deps = [
"react",
"react-icons", "react-icons",
"styled-components",
"//src/design-system/atoms/breakpoints", "//src/design-system/atoms/breakpoints",
"//src/design-system/atoms/colors", "//src/design-system/atoms/colors",
"//src/design-system/atoms/key-events", "//src/design-system/atoms/key-events",
"//src/design-system/atoms/timings", "//src/design-system/atoms/timings",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -7,16 +7,12 @@ react_library(
name = "role", name = "role",
deps = [ deps = [
"chroma-js", "chroma-js",
"react",
"react-icons", "react-icons",
"styled-components",
"//src/design-system/atoms/colors", "//src/design-system/atoms/colors",
"//src/design-system/atoms/timings", "//src/design-system/atoms/timings",
"//src/design-system/shared-types", "//src/design-system/shared-types",
"//src/rpc/shared", "//src/rpc/shared",
"@types/chroma-js", "@types/chroma-js",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -5,7 +5,5 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "space", name = "space",
deps = [ deps = [
"styled-components",
"@types/styled-components",
], ],
) )

View file

@ -5,10 +5,6 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "sparkle", name = "sparkle",
deps = [ deps = [
"react",
"styled-components",
"//src/design-system/atoms/colors", "//src/design-system/atoms/colors",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -6,13 +6,9 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "tab-view", name = "tab-view",
deps = [ deps = [
"react",
"styled-components",
"//src/design-system/atoms/breakpoints", "//src/design-system/atoms/breakpoints",
"//src/design-system/atoms/colors", "//src/design-system/atoms/colors",
"//src/design-system/atoms/timings", "//src/design-system/atoms/timings",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -5,10 +5,6 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "text-input", name = "text-input",
deps = [ deps = [
"react",
"styled-components",
"//src/design-system/atoms/colors", "//src/design-system/atoms/colors",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -6,8 +6,6 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "typist", name = "typist",
deps = [ deps = [
"react",
"@types/react",
], ],
) )

View file

@ -5,9 +5,7 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "typography", name = "typography",
deps = [ deps = [
"styled-components",
"//src/design-system/atoms/colors", "//src/design-system/atoms/colors",
"//src/design-system/atoms/timings", "//src/design-system/atoms/timings",
"@types/styled-components",
], ],
) )

View file

@ -5,12 +5,8 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "demo-discord", name = "demo-discord",
deps = [ deps = [
"react",
"styled-components",
"//src/design-system/atoms/colors", "//src/design-system/atoms/colors",
"//src/design-system/atoms/typist", "//src/design-system/atoms/typist",
"//src/design-system/shared-types", "//src/design-system/shared-types",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -5,11 +5,7 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "demo-picker", name = "demo-picker",
deps = [ deps = [
"react",
"styled-components",
"//src/design-system/atoms/role", "//src/design-system/atoms/role",
"//src/design-system/shared-types", "//src/design-system/shared-types",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -5,12 +5,8 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "error-banner", name = "error-banner",
deps = [ deps = [
"react",
"styled-components",
"//src/design-system/atoms/breakpoints", "//src/design-system/atoms/breakpoints",
"//src/design-system/atoms/colors", "//src/design-system/atoms/colors",
"//src/design-system/atoms/typography", "//src/design-system/atoms/typography",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -5,13 +5,9 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "footer", name = "footer",
deps = [ deps = [
"react",
"react-icons", "react-icons",
"styled-components",
"//src/design-system/atoms/colors", "//src/design-system/atoms/colors",
"//src/design-system/atoms/timings", "//src/design-system/atoms/timings",
"//src/design-system/atoms/typography", "//src/design-system/atoms/typography",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -6,16 +6,12 @@ react_library(
name = "guild-nav", name = "guild-nav",
deps = [ deps = [
"next", "next",
"react",
"react-icons", "react-icons",
"react-tooltip", "react-tooltip",
"styled-components",
"//src/common/utils", "//src/common/utils",
"//src/design-system/atoms/colors", "//src/design-system/atoms/colors",
"//src/design-system/atoms/timings", "//src/design-system/atoms/timings",
"//src/design-system/molecules/nav-slug", "//src/design-system/molecules/nav-slug",
"//src/design-system/shared-types", "//src/design-system/shared-types",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -5,12 +5,8 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "nav-slug", name = "nav-slug",
deps = [ deps = [
"react",
"react-icons", "react-icons",
"styled-components",
"//src/design-system/atoms/avatar", "//src/design-system/atoms/avatar",
"//src/design-system/shared-types", "//src/design-system/shared-types",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -5,13 +5,9 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "picker-category", name = "picker-category",
deps = [ deps = [
"react",
"react-tooltip", "react-tooltip",
"styled-components",
"//src/design-system/atoms/role", "//src/design-system/atoms/role",
"//src/design-system/atoms/typography", "//src/design-system/atoms/typography",
"//src/design-system/shared-types", "//src/design-system/shared-types",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -5,13 +5,9 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "preauth-greeting", name = "preauth-greeting",
deps = [ deps = [
"react",
"styled-components",
"//src/design-system/atoms/avatar", "//src/design-system/atoms/avatar",
"//src/design-system/atoms/space", "//src/design-system/atoms/space",
"//src/design-system/atoms/typography", "//src/design-system/atoms/typography",
"//src/design-system/shared-types", "//src/design-system/shared-types",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -6,16 +6,12 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "preauth-secret-code", name = "preauth-secret-code",
deps = [ deps = [
"react",
"react-icons", "react-icons",
"styled-components",
"//src/design-system/atoms/button", "//src/design-system/atoms/button",
"//src/design-system/atoms/fader", "//src/design-system/atoms/fader",
"//src/design-system/atoms/space", "//src/design-system/atoms/space",
"//src/design-system/atoms/text-input", "//src/design-system/atoms/text-input",
"//src/design-system/shared-types", "//src/design-system/shared-types",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -6,13 +6,9 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "reset-submit", name = "reset-submit",
deps = [ deps = [
"react",
"react-icons", "react-icons",
"styled-components",
"//src/design-system/atoms/breakpoints", "//src/design-system/atoms/breakpoints",
"//src/design-system/atoms/button", "//src/design-system/atoms/button",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -7,16 +7,12 @@ react_library(
name = "server-masthead", name = "server-masthead",
deps = [ deps = [
"next", "next",
"react",
"react-icons", "react-icons",
"styled-components",
"//src/design-system/atoms/avatar", "//src/design-system/atoms/avatar",
"//src/design-system/atoms/colors", "//src/design-system/atoms/colors",
"//src/design-system/atoms/timings", "//src/design-system/atoms/timings",
"//src/design-system/atoms/typography", "//src/design-system/atoms/typography",
"//src/design-system/shared-types", "//src/design-system/shared-types",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -5,13 +5,9 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "user-avatar-group", name = "user-avatar-group",
deps = [ deps = [
"react",
"styled-components",
"//src/design-system/atoms/avatar", "//src/design-system/atoms/avatar",
"//src/design-system/atoms/breakpoints", "//src/design-system/atoms/breakpoints",
"//src/design-system/atoms/colors", "//src/design-system/atoms/colors",
"//src/design-system/shared-types", "//src/design-system/shared-types",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -6,15 +6,11 @@ react_library(
name = "user-popover", name = "user-popover",
deps = [ deps = [
"next", "next",
"react",
"react-icons", "react-icons",
"styled-components",
"//src/design-system/atoms/breakpoints", "//src/design-system/atoms/breakpoints",
"//src/design-system/atoms/colors", "//src/design-system/atoms/colors",
"//src/design-system/atoms/timings", "//src/design-system/atoms/timings",
"//src/design-system/molecules/user-avatar-group", "//src/design-system/molecules/user-avatar-group",
"//src/design-system/shared-types", "//src/design-system/shared-types",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -5,15 +5,11 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "app-shell", name = "app-shell",
deps = [ deps = [
"react",
"react-custom-scrollbars", "react-custom-scrollbars",
"styled-components",
"//src/design-system/atoms/colors", "//src/design-system/atoms/colors",
"//src/design-system/molecules/footer", "//src/design-system/molecules/footer",
"//src/design-system/organisms/masthead", "//src/design-system/organisms/masthead",
"//src/design-system/shared-types", "//src/design-system/shared-types",
"@types/react",
"@types/react-custom-scrollbars", "@types/react-custom-scrollbars",
"@types/styled-components",
], ],
) )

View file

@ -6,15 +6,11 @@ react_library(
name = "help-why-no-roles", name = "help-why-no-roles",
deps = [ deps = [
"chroma-js", "chroma-js",
"react",
"react-icons", "react-icons",
"styled-components",
"//src/design-system/atoms/colors", "//src/design-system/atoms/colors",
"//src/design-system/atoms/halfsies", "//src/design-system/atoms/halfsies",
"//src/design-system/atoms/sparkle", "//src/design-system/atoms/sparkle",
"//src/design-system/shared-types", "//src/design-system/shared-types",
"@types/chroma-js", "@types/chroma-js",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -5,9 +5,7 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "landing", name = "landing",
deps = [ deps = [
"react",
"react-icons", "react-icons",
"styled-components",
"//src/design-system/atoms/breakpoints", "//src/design-system/atoms/breakpoints",
"//src/design-system/atoms/colors", "//src/design-system/atoms/colors",
"//src/design-system/atoms/halfsies", "//src/design-system/atoms/halfsies",
@ -15,7 +13,5 @@ react_library(
"//src/design-system/atoms/typography", "//src/design-system/atoms/typography",
"//src/design-system/molecules/demo-discord", "//src/design-system/molecules/demo-discord",
"//src/design-system/molecules/demo-picker", "//src/design-system/molecules/demo-picker",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -6,9 +6,7 @@ react_library(
name = "masthead", name = "masthead",
deps = [ deps = [
"next", "next",
"react",
"react-icons", "react-icons",
"styled-components",
"//src/design-system/atoms/branding", "//src/design-system/atoms/branding",
"//src/design-system/atoms/breakpoints", "//src/design-system/atoms/breakpoints",
"//src/design-system/atoms/button", "//src/design-system/atoms/button",
@ -20,7 +18,5 @@ react_library(
"//src/design-system/molecules/user-avatar-group", "//src/design-system/molecules/user-avatar-group",
"//src/design-system/molecules/user-popover", "//src/design-system/molecules/user-popover",
"//src/design-system/shared-types", "//src/design-system/shared-types",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -5,15 +5,11 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "role-picker", name = "role-picker",
deps = [ deps = [
"react",
"react-icons", "react-icons",
"styled-components",
"//src/design-system/atoms/button", "//src/design-system/atoms/button",
"//src/design-system/atoms/space", "//src/design-system/atoms/space",
"//src/design-system/molecules/preauth-greeting", "//src/design-system/molecules/preauth-greeting",
"//src/design-system/molecules/preauth-secret-code", "//src/design-system/molecules/preauth-secret-code",
"//src/design-system/shared-types", "//src/design-system/shared-types",
"@types/react",
"@types/styled-components",
], ],
) )

View file

@ -6,9 +6,7 @@ package(default_visibility = ["//visibility:public"])
react_library( react_library(
name = "role-picker", name = "role-picker",
deps = [ deps = [
"react",
"react-icons", "react-icons",
"styled-components",
"//src/common/utils", "//src/common/utils",
"//src/design-system/atoms/colors", "//src/design-system/atoms/colors",
"//src/design-system/atoms/fader", "//src/design-system/atoms/fader",
@ -17,8 +15,6 @@ react_library(
"//src/design-system/molecules/reset-submit", "//src/design-system/molecules/reset-submit",
"//src/design-system/molecules/server-masthead", "//src/design-system/molecules/server-masthead",
"//src/design-system/shared-types", "//src/design-system/shared-types",
"@types/react",
"@types/styled-components",
], ],
) )