forked from aspect-build/rules_js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBUILD.bazel
48 lines (43 loc) · 1.94 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
46
47
48
load("@bazel_gazelle//:def.bzl", "gazelle", "gazelle_binary")
load("@npm//:defs.bzl", "link_js_packages")
load("@acorn__8.4.0__links//:defs.bzl", link_acorn = "link_js_package")
load("//js:defs.bzl", "link_js_package", "link_js_package_dep")
# Link all packages from the /WORKSPACE translate_pnpm_lock in /package.json to
# bazel-bin/node_modules as well as the virtual store bazel-bin/node_modules/.aspect_rules_js
# since /package.json is the root of the pnpm workspace
link_js_packages()
# Link the acorn package, which was fetched separately with npm_import from /WORKSPACE, to the
# virtual store in bazel-bin/node_modules/.aspect_rules_js
link_acorn(
name = "link_acorn",
# `direct` set to False as an example of *not* also linking this 3rd dependency as a
# direct dependency in the package at bazel-bin/node_modules/@mycorp/mylib. Alternately,
# you may specify link_packages in the npm_import of this package and direct is then
# automatically set to True when this is called in the packages listed.
direct = False,
)
# Linking a first-party dependency to the virtual store in bazel-bin/node_modules/.aspect_rules_js
link_js_package(
name = "link_mycorp_mylib",
src = "//examples/lib",
# `direct` set to False as an example of *not* also linking this first-party dependency as a
# direct dependency in the package at bazel-bin/node_modules/@mycorp/mylib.
direct = False,
deps = [
# For a 3rd party deps fetched with an npm_import or via a translate_pnpm_lock repository rule,
# you must specify both the name and version to qualify the dependency. These should match the
# `package` and `version` attributes of the corresponding `npm_import`.
link_js_package_dep(
"acorn",
version = "8.4.0",
),
],
)
gazelle_binary(
name = "gazelle_bin",
languages = ["@bazel_skylib//gazelle/bzl"],
)
gazelle(
name = "gazelle",
gazelle = "gazelle_bin",
)