Skip to content

Commit

Permalink
refactor: remove deprecated run_lifecycle_hooks from npm_import (#1572)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmagolan authored and jbedard committed May 6, 2024
1 parent b9358e9 commit 3328e96
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
5 changes: 2 additions & 3 deletions docs/npm_import.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion npm/extensions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ def _npm_import_bzlmod(i):
patches = i.patches,
replace_package = i.replace_package,
root_package = i.root_package,
run_lifecycle_hooks = i.run_lifecycle_hooks,
transitive_closure = i.transitive_closure,
url = i.url,
version = i.version,
Expand Down
17 changes: 3 additions & 14 deletions npm/private/npm_import.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -920,8 +920,6 @@ def npm_import(
dev = False,
register_copy_directory_toolchains = True,
register_copy_to_directory_toolchains = True,
# TODO(2.0): remove run_lifecycle_hooks from npm_import
run_lifecycle_hooks = None,
# TODO(2.0): remove lifecycle_hooks_no_sandbox from npm_import
lifecycle_hooks_no_sandbox = None,
**kwargs):
Expand Down Expand Up @@ -1130,8 +1128,9 @@ def npm_import(
patches: Patch files to apply onto the downloaded npm package.
custom_postinstall: Custom string postinstall script to run on the installed npm package. Runs after any
existing lifecycle hooks if `run_lifecycle_hooks` is True.
custom_postinstall: Custom string postinstall script to run on the installed npm package.
Runs after any existing lifecycle hooks if any are enabled.
npm_auth: Auth token to authenticate with npm. When using Bearer authentication.
Expand Down Expand Up @@ -1171,11 +1170,6 @@ def npm_import(
register_copy_to_directory_toolchains: if True, `@aspect_bazel_lib//lib:repositories.bzl` `register_copy_to_directory_toolchains()` is called if the toolchain is not already registered
run_lifecycle_hooks: If True, runs `preinstall`, `install`, `postinstall` and 'prepare' lifecycle hooks declared
in this package.
Deprecated. Use `lifecycle_hooks` instead.
lifecycle_hooks_no_sandbox: If True, adds "no-sandbox" to `lifecycle_hooks_execution_requirements`.
Deprecated. Add "no-sandbox" to `lifecycle_hooks_execution_requirements` instead.
Expand All @@ -1195,11 +1189,6 @@ def npm_import(
msg = "Invalid npm_import parameter '{}'".format(kwargs.keys()[0])
fail(msg)

if lifecycle_hooks and run_lifecycle_hooks:
fail("Expected only one of lifecycle_hooks or run_lifecycle_hooks")
if run_lifecycle_hooks:
lifecycle_hooks = ["preinstall", "install", "postinstall"]

# By convention, the `{name}` repository contains the actual npm
# package sources downloaded from the registry and extracted
npm_import_rule(
Expand Down

0 comments on commit 3328e96

Please sign in to comment.