Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(npm): replace npm_translate_lock(replace_packages) with replace_package module extension #1886

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jbedard
Copy link
Member

@jbedard jbedard commented Aug 12, 2024

A replacement of the npm_translate_lock(replace_packages) API for bzlmod to ensure labels are passed from the user module instead of strings.


Changes are visible to end-users: no

Test plan

  • Covered by existing test cases
  • New test cases added

@@ -26,13 +26,22 @@ def _npm_extension_impl(module_ctx):
fail("A minimum version of Bazel 6 required to use rules_js")

for mod in module_ctx.modules:
replace_packages = {}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be computed outside the module_ctx.modules loop?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably, since module extensions have a global view over the build, in theory you could have a translate lock from module A and a replacement coming from module B.

@jbedard jbedard force-pushed the replace_package-reverse_map-tag branch from 1ee7f68 to e06bb0a Compare August 13, 2024 08:35
MODULE.bazel Outdated Show resolved Hide resolved
@@ -26,13 +26,22 @@ def _npm_extension_impl(module_ctx):
fail("A minimum version of Bazel 6 required to use rules_js")

for mod in module_ctx.modules:
replace_packages = {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably, since module extensions have a global view over the build, in theory you could have a translate lock from module A and a replacement coming from module B.

Copy link

aspect-workflows bot commented Aug 13, 2024

Test

All tests were cache hits

193 tests (100.0%) were fully cached saving 48s.


Test

e2e/bzlmod

All tests were cache hits

5 tests (100.0%) were fully cached saving 631ms.


Test

e2e/gyp_no_install_script

All tests were cache hits

2 tests (100.0%) were fully cached saving 516ms.


Test

e2e/js_image_oci

All tests were cache hits

1 test (100.0%) was fully cached saving 6s.


Test

e2e/npm_link_package

All tests were cache hits

3 tests (100.0%) were fully cached saving 925ms.


Test

e2e/npm_link_package-esm

All tests were cache hits

3 tests (100.0%) were fully cached saving 925ms.


Test

e2e/npm_translate_lock

All tests were cache hits

1 test (100.0%) was fully cached saving 59ms.


Test

e2e/npm_translate_lock_empty

All tests were cache hits

1 test (100.0%) was fully cached saving 59ms.


Test

e2e/npm_translate_lock_multi

All tests were cache hits

2 tests (100.0%) were fully cached saving 184ms.


Test

e2e/npm_translate_lock_partial_clone

All tests were cache hits

1 test (100.0%) was fully cached saving 55ms.


Test

e2e/npm_translate_lock_replace_packages

⚠️ Buildkite build #5561 failed.


Test

e2e/npm_translate_lock_subdir_patch

All tests were cache hits

1 test (100.0%) was fully cached saving 167ms.


Test

e2e/npm_translate_package_lock

All tests were cache hits

1 test (100.0%) was fully cached saving 59ms.


Test

e2e/npm_translate_yarn_lock

All tests were cache hits

1 test (100.0%) was fully cached saving 59ms.


Test

e2e/package_json_module

All tests were cache hits

1 test (100.0%) was fully cached saving 507ms.


Test

e2e/pnpm_lockfiles

All tests were cache hits

40 tests (100.0%) were fully cached saving 16s.


Test

e2e/pnpm_workspace

All tests were cache hits

10 tests (100.0%) were fully cached saving 7s.


Test

e2e/pnpm_workspace_rerooted

All tests were cache hits

10 tests (100.0%) were fully cached saving 4s.


Test

e2e/repo_mapping

All tests were cache hits

2 tests (100.0%) were fully cached saving 324ms.


Test

e2e/rules_foo

All tests were cache hits

2 tests (100.0%) were fully cached saving 562ms.


Test

e2e/vendored_node

All tests were cache hits

1 test (100.0%) was fully cached saving 251ms.


Buildifier      Format

@jbedard jbedard force-pushed the replace_package-reverse_map-tag branch from e06bb0a to 30fdb9a Compare August 13, 2024 19:01
@jbedard jbedard force-pushed the replace_package-reverse_map-tag branch 2 times, most recently from 8d7ad3d to c7112b5 Compare August 13, 2024 23:02
@jbedard jbedard changed the title fix(npm): use labels for npm_translate_lock(replace_packages) fix(npm): replace npm_translate_lock(replace_packages) with replace_package module extension Aug 13, 2024
@jbedard jbedard force-pushed the replace_package-reverse_map-tag branch 2 times, most recently from 591b1b9 to f847434 Compare August 13, 2024 23:12
@jbedard jbedard force-pushed the replace_package-reverse_map-tag branch 2 times, most recently from 096bdad to 7582f4a Compare August 14, 2024 20:40
@jbedard jbedard force-pushed the replace_package-reverse_map-tag branch from 7582f4a to 9a24802 Compare August 14, 2024 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants