Skip to content

Commit

Permalink
fix(pnpm): npm: aliases to packages with peer deps (#1824)
Browse files Browse the repository at this point in the history
Fix #1814
  • Loading branch information
jbedard authored Jun 27, 2024
1 parent eff595b commit ae87a9b
Show file tree
Hide file tree
Showing 20 changed files with 969 additions and 408 deletions.
10 changes: 8 additions & 2 deletions e2e/pnpm_lockfiles/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ npm = use_extension(
"lock-%s" % version,

# Dep with bin entries etc
"lock-%s__rollup__3.2.5" % version,
"lock-%s__rollup__3.2.5__links" % version,
"lock-%s__rollup__2.14.0" % version,
"lock-%s__rollup__2.14.0__links" % version,

# Dep only referenced via npm: should have the real package name in the repo name
"lock-%s__at_types_sizzle__2.3.8" % version,
Expand All @@ -76,6 +76,12 @@ npm = use_extension(
"lock-%s__at_aspect-test_d__2.0.0__at_aspect-test_c_2.0.2" % version,
"lock-%s__at_aspect-test_d__2.0.0__at_aspect-test_c_2.0.2__links" % version,

# Deep with many peers
"lock-%s__at_rollup_plugin-typescript__8.2.1__%s" % (
version,
"ommloj5qql5ba6x5wuiluawhoi" if version == "v54" else "-1662662592" if version == "v90" else "-1662692290",
),

# Dep with patch
"lock-%s__meaning-of-life__1.0.0__o3deharooos255qt5xdujc3cuq" % version,
)
Expand Down
8 changes: 6 additions & 2 deletions e2e/pnpm_lockfiles/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
"debug": "ngokevin/debug#9742c5f383a6f8046241920156236ade8ec30d53",
"hello": "https://gitpkg.vercel.app/EqualMa/gitpkg-hello/packages/hello",
"jsonify": "https://github.com/aspect-build/test-packages/releases/download/0.0.0/@foo-jsonify-0.0.0.tgz",
"rollup": "3.2.5",
"rollup": "2.14.0",
"rollup-plugin-with-peers": "npm:@rollup/[email protected]",
"tslib": "^2.6.3",
"typescript": "^5.4.5",
"meaning-of-life": "1.0.0",
"is-odd": "3.0.1",
"is-odd-alt-version": "npm:is-odd@^2.0.0",
Expand Down Expand Up @@ -40,7 +43,8 @@
],
"overrides": {
"is-number": "file:../vendored/is-number",
"diff": "https://github.com/kpdecker/jsdiff/archive/refs/tags/v5.2.0.tar.gz"
"diff": "https://github.com/kpdecker/jsdiff/archive/refs/tags/v5.2.0.tar.gz",
"fsevents": "^2.3"
}
}
}
9 changes: 7 additions & 2 deletions e2e/pnpm_lockfiles/lockfile-test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ BZL_FILES = {
"defs.bzl": "@REPO_NAME//:defs.bzl",

# hasBin, optional deps, deps
"rollup_links_defs.bzl": "@REPO_NAME__rollup__3.2.5__links//:defs.bzl",
"rollup_package_json.bzl": "@REPO_NAME__rollup__3.2.5//VERSION:package_json.bzl",
"rollup_links_defs.bzl": "@REPO_NAME__rollup__2.14.0__links//:defs.bzl",
"rollup_package_json.bzl": "@REPO_NAME__rollup__2.14.0//VERSION:package_json.bzl",
}

def lockfile_test(name = None):
Expand Down Expand Up @@ -85,6 +85,11 @@ def lockfile_test(name = None):
# rollup has a 'optionalDependency' (fsevents)
":node_modules/rollup",

# npm: alias to a package that has many peers
":node_modules/rollup-plugin-with-peers",
# underlying repo for the many-peers package
"@%s__at_rollup_plugin-typescript__8.2.1__%s//:pkg" % (lock_repo, "ommloj5qql5ba6x5wuiluawhoi" if lock_version == "v54" else "-1662662592" if lock_version == "v90" else "-1662692290"),

# uuv 'hasBin'
":node_modules/uvu",

Expand Down
105 changes: 100 additions & 5 deletions e2e/pnpm_lockfiles/v54/pnpm-lock.yaml

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

Loading

0 comments on commit ae87a9b

Please sign in to comment.