feat: improve rules_js parity
This commit is contained in:
28
npm/extensions.bzl
Normal file
28
npm/extensions.bzl
Normal file
@@ -0,0 +1,28 @@
|
||||
load("//internal:bun_install.bzl", "bun_install_repository")
|
||||
|
||||
_translate = tag_class(
|
||||
attrs = {
|
||||
"name": attr.string(mandatory = True),
|
||||
"package_json": attr.label(mandatory = True),
|
||||
"lockfile": attr.label(mandatory = True),
|
||||
"install_inputs": attr.label_list(allow_files = True),
|
||||
"isolated_home": attr.bool(default = True),
|
||||
},
|
||||
)
|
||||
|
||||
def _npm_translate_lock_impl(ctx):
|
||||
for mod in ctx.modules:
|
||||
for install in mod.tags.translate:
|
||||
bun_install_repository(
|
||||
name = install.name,
|
||||
package_json = install.package_json,
|
||||
bun_lockfile = install.lockfile,
|
||||
install_inputs = install.install_inputs,
|
||||
isolated_home = install.isolated_home,
|
||||
visible_repo_name = install.name,
|
||||
)
|
||||
|
||||
npm_translate_lock = module_extension(
|
||||
implementation = _npm_translate_lock_impl,
|
||||
tag_classes = {"translate": _translate},
|
||||
)
|
||||
Reference in New Issue
Block a user