Skip to content

Commit ffdf899

Browse files
authored
docs: add bzlmod example for npm_import (#2126)
1 parent 2fec7bc commit ffdf899

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

docs/npm_import.md

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

npm/private/npm_import.bzl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,19 @@ def npm_import(
934934
)
935935
```
936936
937+
In `MODULE.bazel` the same would look like so:
938+
939+
```starlark
940+
npm.npm_import(
941+
name = "npm__at_types_node__15.12.2",
942+
package = "@types/node",
943+
version = "15.12.2",
944+
integrity = "sha512-zjQ69G564OCIWIOHSXyQEEDpdpGl+G348RAKY0XXy9Z5kU9Vzv1GMNnkar/ZJ8dzXB3COzD9Mo9NtRZ4xfgUww==",v
945+
)
946+
use_repo(npm, "npm__at_types_node__15.12.2")
947+
use_repo(npm, "npm__at_types_node__15.12.2__links")
948+
```
949+
937950
> This is similar to Bazel rules in other ecosystems named "_import" like
938951
> `apple_bundle_import`, `scala_import`, `java_import`, and `py_import`.
939952
> `go_repository` is also a model for this rule.

0 commit comments

Comments
 (0)