Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .aspect/workflows/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ workspaces:
e2e/pnpm_workspace_rerooted:
icon: pnpm
tasks: *e2e_tasks
e2e/pnpm_version:
icon: pnpm
tasks: *e2e_tasks
e2e/repo_mapping:
icon: js
tasks: *e2e_tasks
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
e2e/pnpm_workspace
e2e/pnpm_workspace_deps
e2e/pnpm_workspace_rerooted
e2e/pnpm_version
e2e/runfiles
e2e/rules_foo
e2e/stamped_package_json
Expand Down
17 changes: 12 additions & 5 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,9 @@ use_repo(node, "nodejs_linux_ppc64le")
use_repo(node, "nodejs_linux_s390x")
use_repo(node, "nodejs_windows_amd64")

# The default + public version of pnpm used by default.
pnpm = use_extension("@aspect_rules_js//npm:extensions.bzl", "pnpm")
pnpm.pnpm(
name = "pnpm",
pnpm_version = "9.15.9",
pnpm_version_integrity = "sha512-aARhQYk8ZvrQHAeSMRKOmvuJ74fiaR1p5NQO7iKJiClf1GghgbrlW1hBjDolO95lpQXsfF+UA+zlzDzTfc8lMQ==",
)
pnpm.pnpm(name = "pnpm")
use_repo(pnpm, "pnpm", "pnpm__links")

bazel_lib_toolchains = use_extension("@aspect_bazel_lib//lib:extensions.bzl", "toolchains")
Expand All @@ -60,6 +57,15 @@ use_repo(

####### Dev dependencies ########

# Dev-only pnpm used for local testing
pnpm9 = use_extension("@aspect_rules_js//npm:extensions.bzl", "pnpm", dev_dependency = True)
pnpm9.pnpm(
name = "pnpm9",
pnpm_version = "9.15.9",
pnpm_version_integrity = "sha512-aARhQYk8ZvrQHAeSMRKOmvuJ74fiaR1p5NQO7iKJiClf1GghgbrlW1hBjDolO95lpQXsfF+UA+zlzDzTfc8lMQ==",
)
use_repo(pnpm9, "pnpm9")

bazel_dep(name = "bazelrc-preset.bzl", version = "1.3.0", dev_dependency = True)
bazel_dep(name = "aspect_rules_lint", version = "1.1.0", dev_dependency = True)
bazel_dep(name = "buildifier_prebuilt", version = "8.0.1", dev_dependency = True)
Expand Down Expand Up @@ -265,6 +271,7 @@ npm.npm_translate_lock(
"ms@2.1.3": ["examples/npm_deps"],
},
update_pnpm_lock = True,
use_pnpm = "@pnpm9//:package/bin/pnpm.cjs",
verify_node_modules_ignored = "//:.bazelignore",
verify_patches = "//examples/npm_deps/patches:patches",
)
Expand Down
1 change: 0 additions & 1 deletion e2e/npm_translate_lock_auth/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ bazel_dep(name = "bazel_skylib", version = "1.5.0", dev_dependency = True)
pnpm = use_extension("@aspect_rules_js//npm:extensions.bzl", "pnpm")
pnpm.pnpm(
name = "pnpm",
pnpm_version = "8.15.9",
)
use_repo(pnpm, "pnpm", "pnpm__links")

Expand Down
1 change: 0 additions & 1 deletion e2e/npm_translate_lock_auth/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ npm_translate_lock(
data = ["//:package.json"],
npmrc = "//:.npmrc",
pnpm_lock = "//:pnpm-lock.yaml",
pnpm_version = "8.15.9",
update_pnpm_lock = True,
verify_node_modules_ignored = "//:.bazelignore",
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# @generated
# 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.
package.json=675641790
pnpm-lock.yaml=-1076356950
1 change: 1 addition & 0 deletions e2e/pnpm_version/.bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
1 change: 1 addition & 0 deletions e2e/pnpm_version/.bazeliskrc
2 changes: 2 additions & 0 deletions e2e/pnpm_version/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import %workspace%/../../tools/preset.bazelrc

1 change: 1 addition & 0 deletions e2e/pnpm_version/.bazelversion
12 changes: 12 additions & 0 deletions e2e/pnpm_version/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
load("@aspect_rules_js//js:defs.bzl", "js_test")
load("@npm//:defs.bzl", "npm_link_all_packages")

npm_link_all_packages(name = "node_modules")

js_test(
name = "test",
data = [
"pnpm-lock.yaml",
],
entry_point = "test.js",
)
20 changes: 20 additions & 0 deletions e2e/pnpm_version/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
bazel_dep(name = "aspect_rules_js", version = "0.0.0", dev_dependency = True)
local_path_override(
module_name = "aspect_rules_js",
path = "../..",
)

# Use the DEFAULT pnpm_version and do not override

npm = use_extension(
"@aspect_rules_js//npm:extensions.bzl",
"npm",
dev_dependency = True,
)
npm.npm_translate_lock(
name = "npm",
pnpm_lock = "//:pnpm-lock.yaml",
update_pnpm_lock = True,
verify_node_modules_ignored = "//:.bazelignore",
)
use_repo(npm, "npm")
37 changes: 37 additions & 0 deletions e2e/pnpm_version/WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# NOTE: keep in sync with e2e/pnpm_workspace(_rerooted)
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

local_repository(
name = "aspect_rules_js",
path = "../..",
)

http_archive(
name = "rules_shell",
sha256 = "e6b87c89bd0b27039e3af2c5da01147452f240f75d505f5b6880874f31036307",
strip_prefix = "rules_shell-0.6.1",
url = "https://github.com/bazelbuild/rules_shell/releases/download/v0.6.1/rules_shell-v0.6.1.tar.gz",
)

load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")

rules_js_dependencies()

load("@aspect_rules_js//js:toolchains.bzl", "DEFAULT_NODE_VERSION", "rules_js_register_toolchains")

rules_js_register_toolchains(node_version = DEFAULT_NODE_VERSION)

load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")

npm_translate_lock(
name = "npm",
pnpm_lock = "//:pnpm-lock.yaml",
# Use the DEFAULT pnpm_version
# pnpm_version = ...
update_pnpm_lock = True,
verify_node_modules_ignored = "//:.bazelignore",
)

load("@npm//:repositories.bzl", "npm_repositories")

npm_repositories()
2 changes: 2 additions & 0 deletions e2e/pnpm_version/WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# The presence of this file causes WORKSPACE to be ignored when bzlmod is enabled.
# See https://docs.google.com/document/d/1JtXIVnXyFZ4bmbiBCr5gsTH4-opZAFf5DMMb-54kES0/edit#heading=h.y054fjub9max
13 changes: 13 additions & 0 deletions e2e/pnpm_version/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"private": true,
"pnpm": {
"onlyBuiltDependencies": []
},
"dependencies": {
"typescript": "^5.9.2",
"@aspect-test/a": "5.0.2"
},
"devDependencies": {
"@aspect-test/b": "5.0.2"
}
}
56 changes: 56 additions & 0 deletions e2e/pnpm_version/pnpm-lock.yaml

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

2 changes: 2 additions & 0 deletions e2e/pnpm_version/pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
packages:
- '.'
7 changes: 7 additions & 0 deletions e2e/pnpm_version/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const lockfileContent = require('fs').readFileSync('pnpm-lock.yaml', 'utf8')

const lockfileVersion = lockfileContent.match(/lockfileVersion: '([^']+)'/)

if (!lockfileVersion || lockfileVersion[1] !== '6.0') {
throw new Error('Incorrect pnpm version: ' + lockfileVersion[1])
}
Loading