-
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(npm): support workspace run_lifecycle_hooks=False
Close #2062
- Loading branch information
Showing
17 changed files
with
410 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../.bazeliskrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Import Aspect bazelrc presets | ||
try-import %workspace%/../../.aspect/bazelrc/bazel7.bazelrc | ||
import %workspace%/../../.aspect/bazelrc/convenience.bazelrc | ||
import %workspace%/../../.aspect/bazelrc/correctness.bazelrc | ||
import %workspace%/../../.aspect/bazelrc/debug.bazelrc | ||
import %workspace%/../../.aspect/bazelrc/javascript.bazelrc | ||
import %workspace%/../../.aspect/bazelrc/performance.bazelrc | ||
|
||
### YOUR PROJECT SPECIFIC OPTIONS GO HERE ### | ||
|
||
# Load any settings & overrides specific to the current user from `.aspect/bazelrc/user.bazelrc`. | ||
# This file should appear in `.gitignore` so that settings are not shared with team members. This | ||
# should be last statement in this config so the user configuration is able to overwrite flags from | ||
# this file. See https://bazel.build/configure/best-practices#bazelrc-file. | ||
try-import %workspace%/../../.aspect/bazelrc/user.bazelrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../.bazelversion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files") | ||
load("@bazel_skylib//rules:build_test.bzl", "build_test") | ||
load("@npm//:defs.bzl", "npm_link_all_packages") | ||
|
||
npm_link_all_packages(name = "node_modules") | ||
|
||
build_test( | ||
name = "test", | ||
targets = [ | ||
":node_modules", | ||
], | ||
) | ||
|
||
genrule( | ||
name = "snapshot-extracted-wksp", | ||
srcs = ["@npm//:repositories.bzl"], | ||
outs = ["snapshot-extracted-wksp.bzl"], | ||
cmd = 'sed "s/system_tar = \\".*\\"/system_tar = \\"<TAR>\\"/" "$<" > "$@"', | ||
# Target names may be different on workspace vs bzlmod | ||
target_compatible_with = select({ | ||
"@aspect_bazel_lib//lib:bzlmod": ["@platforms//:incompatible"], | ||
"//conditions:default": [], | ||
}), | ||
visibility = ["//visibility:private"], | ||
) | ||
|
||
write_source_files( | ||
name = "write_npm_translate_lock_wksp", | ||
files = { | ||
"snapshots/wksp/repositories.bzl": ":snapshot-extracted-wksp.bzl", | ||
}, | ||
# Target names may be different on bazel versions | ||
tags = ["skip-on-bazel6"], | ||
target_compatible_with = select({ | ||
"@aspect_bazel_lib//lib:bzlmod": ["@platforms//:incompatible"], | ||
"//conditions:default": [], | ||
}), | ||
) | ||
|
||
write_source_files( | ||
name = "write_npm_translate_lock_defs", | ||
files = { | ||
"snapshots/defs.bzl": "@npm//:defs.bzl", | ||
"snapshots/aspect_test_c_links_defs.bzl": "@npm__at_aspect-test_c__2.0.0__links//:defs.bzl", | ||
}, | ||
# Target names may be different on bazel versions | ||
tags = ["skip-on-bazel6"], | ||
target_compatible_with = select({ | ||
"@aspect_bazel_lib//lib:bzlmod": [], | ||
"//conditions:default": ["@platforms//:incompatible"], | ||
}), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
bazel_dep(name = "aspect_rules_js", version = "0.0.0", dev_dependency = True) | ||
local_path_override( | ||
module_name = "aspect_rules_js", | ||
path = "../..", | ||
) | ||
|
||
bazel_dep(name = "aspect_bazel_lib", version = "2.7.7", dev_dependency = True) | ||
bazel_dep(name = "bazel_skylib", version = "1.5.0", dev_dependency = True) | ||
bazel_dep(name = "platforms", version = "0.0.9", dev_dependency = True) | ||
|
||
npm = use_extension( | ||
"@aspect_rules_js//npm:extensions.bzl", | ||
"npm", | ||
) | ||
npm.npm_translate_lock( | ||
name = "npm", | ||
data = ["//:package.json"], | ||
pnpm_lock = "//:pnpm-lock.yaml", | ||
run_lifecycle_hooks = False, | ||
) | ||
use_repo(npm, "npm", "npm__at_aspect-test_c__2.0.0__links") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
local_repository( | ||
name = "aspect_rules_js", | ||
path = "../..", | ||
) | ||
|
||
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", | ||
data = ["//:package.json"], | ||
pnpm_lock = "//:pnpm-lock.yaml", | ||
run_lifecycle_hooks = False, | ||
) | ||
|
||
load("@npm//:repositories.bzl", "npm_repositories") | ||
|
||
npm_repositories() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"dependencies": { | ||
"@aspect-test/c": "2.0.0" | ||
}, | ||
"pnpm": { | ||
"onlyBuiltDependencies": [ | ||
"@aspect-test/c" | ||
] | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
packages: | ||
- '.' |
163 changes: 163 additions & 0 deletions
163
e2e/npm_translate_lock_disable_hooks/snapshots/aspect_test_c_links_defs.bzl
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.