forked from aspect-build/rules_js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUILD.bazel
45 lines (39 loc) · 1.48 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
load("@acorn__8.4.0__links//:defs.bzl", npm_link_acorn = "npm_link_imported_package")
load("@bazel_gazelle//:def.bzl", "gazelle", "gazelle_binary")
load("@npm//:defs.bzl", "npm_link_all_packages")
load("@pnpm__links//:defs.bzl", npm_link_pnpm = "npm_link_imported_package")
load("//npm:defs.bzl", "npm_link_package")
# Link all packages from the /WORKSPACE npm_translate_lock(name = "npm") and also packages from
# manual /WORKSPACE npm_import rules to bazel-bin/node_modules as well as the virtual store
# bazel-bin/node_modules/.aspect_rules_js since /pnpm-lock.yaml is the root of the pnpm workspace
npm_link_all_packages(
name = "node_modules",
imported_links = [
npm_link_acorn,
npm_link_pnpm,
],
)
# Example of manually linking a first-party dependency. Its transitive npm dependencies
# are picked up automatically via 'npm_package_store_deps' in the js_library targets that
# the `npm_package` target depends on.
npm_link_package(
name = "node_modules/@mycorp/pkg-b",
src = "//examples/npm_package/packages/pkg_b",
)
# Manually linked pkg-c with additional use cases.
npm_link_package(
name = "node_modules/@mycorp/pkg-c1",
src = "//examples/npm_package/packages/pkg_c:pkg_c1",
)
npm_link_package(
name = "node_modules/@mycorp/pkg-c2",
src = "//examples/npm_package/packages/pkg_c:pkg_c2",
)
gazelle_binary(
name = "gazelle_bin",
languages = ["@bazel_skylib//gazelle/bzl"],
)
gazelle(
name = "gazelle",
gazelle = "gazelle_bin",
)