Skip to content

Commit

Permalink
fix: add bzlmod support for custom pnpm extension in npm_translate_lo…
Browse files Browse the repository at this point in the history
…ck (#1491)
  • Loading branch information
jbedard authored Feb 27, 2024
1 parent e3c1323 commit 8d27d8d
Show file tree
Hide file tree
Showing 8 changed files with 316 additions and 965 deletions.
2 changes: 0 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,6 @@ npm.npm_translate_lock(
"meaning-of-life@1.0.0": ["//examples/npm_deps:patches/meaning-of-life@1.0.0-after_pnpm.patch"],
},
pnpm_lock = "//:pnpm-lock.yaml",
# NB: this is a no-op because we already installed a pnpm repo above
pnpm_version = "7.25.0",
public_hoist_packages = {
# Instructs the linker to hoist the ms@2.1.3 npm package to `node_modules/ms` in the `examples/npm_deps` package.
# Similar to adding `public-hoist-pattern[]=ms` in .npmrc but with control over which version to hoist and where
Expand Down
5 changes: 3 additions & 2 deletions docs/npm_translate_lock.md

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

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Input hashes for repository rule npm_translate_lock(name = "npm", pnpm_lock = "//:pnpm-lock.yaml").
# This file should be checked into version control along with the pnpm-lock.yaml file.
.npmrc=664934919
pnpm-lock.yaml=-1747573256
pnpm-lock.yaml=-955788740
yarn.lock=181112961
transform_package_json.js=-487875007
package.json=805760788
8 changes: 8 additions & 0 deletions e2e/npm_translate_yarn_lock/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ local_path_override(
path = "../..",
)

pnpm = use_extension("@aspect_rules_js//npm:extensions.bzl", "pnpm")
pnpm.pnpm(
name = "pnpm-old-version",
pnpm_version = "7.33.3",
)
use_repo(pnpm, "pnpm-old-version")

npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm")
npm.npm_translate_lock(
name = "npm",
Expand All @@ -21,6 +28,7 @@ npm.npm_translate_lock(
preupdate = ["//:transform_package_json.js"],
quiet = False,
update_pnpm_lock = True,
use_pnpm = "@pnpm-old-version//:package/bin/pnpm.cjs",
verify_node_modules_ignored = "//:.bazelignore",
yarn_lock = "//:yarn.lock",
)
Expand Down
Loading

0 comments on commit 8d27d8d

Please sign in to comment.