Skip to content

Commit

Permalink
apply patches to yarn after download
Browse files Browse the repository at this point in the history
  • Loading branch information
christianscott committed Nov 15, 2023
1 parent 9fbdb22 commit 45405cc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/node/node_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ If this list is empty, we won't download yarn at all.
doc = "the specific version of Yarn to install",
default = "1.19.1",
),
"yarn_patches": attr.label_keyed_string_dict(
doc = "patches to apply to yarn after downloading. keys are the patch files, values are the files those patches should be applied to. only supports changing 1 file per patch.",
allow_files = True,
),
}

BUILT_IN_NODE_PLATFORMS = [
Expand Down Expand Up @@ -372,6 +376,10 @@ def _download_yarn(repository_ctx):
sha256 = sha256,
)

for patch, file in repository_ctx.attr.yarn_patches.items():
patch_path = repository_ctx.path(patch)
repository_ctx.execute(["patch", file, patch_path], working_directory = YARN_EXTRACT_DIR)

repository_ctx.file("yarn_info", content = """# filename: {filename}
# strip_prefix: {strip_prefix}
# sha256: {sha256}
Expand Down

0 comments on commit 45405cc

Please sign in to comment.