diff --git a/WORKSPACE b/WORKSPACE index 7a1d9b1db..ba16e4ee1 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -126,11 +126,13 @@ npm_translate_lock( }, npmrc = "//:.npmrc", patch_args = { - "@gregmagolan/test-a": ["-p1"], + "*": ["-p1"], + "@gregmagolan/test-a": ["-p4"], }, patches = { "@gregmagolan/test-a": ["//examples/npm_deps:patches/test-a.patch"], "@gregmagolan/test-a@0.0.1": ["//examples/npm_deps:patches/test-a@0.0.1.patch"], + "@gregmagolan/test-b": ["//examples/npm_deps:patches/test-b.patch"], }, pnpm_lock = "//:pnpm-lock.yaml", pnpm_version = "7.17.1", diff --git a/examples/npm_deps/patches/test-a.patch b/examples/npm_deps/patches/test-a.patch index cffca44d0..30a4ebef7 100644 --- a/examples/npm_deps/patches/test-a.patch +++ b/examples/npm_deps/patches/test-a.patch @@ -1,5 +1,5 @@ ---- a/main.js -+++ b/main.js +--- a/node_modules/@gregmagolan/test-a/main.js ++++ b/node_modules/@gregmagolan/test-a/main.js @@ -1 +1,2 @@ module.exports = 'test-a-0.0.1'; +console.log("Hello world!") diff --git a/examples/npm_deps/patches/test-a@0.0.1.patch b/examples/npm_deps/patches/test-a@0.0.1.patch index 35b9af979..4452db44d 100644 --- a/examples/npm_deps/patches/test-a@0.0.1.patch +++ b/examples/npm_deps/patches/test-a@0.0.1.patch @@ -1,5 +1,5 @@ ---- a/main.js -+++ b/main.js +--- a/node_modules/@gregmagolan/test-a/main.js ++++ b/node_modules/@gregmagolan/test-a/main.js @@ -1,2 +1,3 @@ module.exports = 'test-a-0.0.1'; console.log("Hello world!") diff --git a/examples/npm_deps/patches/test-b.patch b/examples/npm_deps/patches/test-b.patch new file mode 100644 index 000000000..dbdab56c3 --- /dev/null +++ b/examples/npm_deps/patches/test-b.patch @@ -0,0 +1,5 @@ +--- a/main.js ++++ b/main.js +@@ -1 +1,2 @@ + module.exports = 'test-b-0.0.1'; ++console.log("Hello world!") diff --git a/npm/private/npm_translate_lock_generate.bzl b/npm/private/npm_translate_lock_generate.bzl index 9b5086ebf..5fc8739e1 100644 --- a/npm/private/npm_translate_lock_generate.bzl +++ b/npm/private/npm_translate_lock_generate.bzl @@ -335,7 +335,7 @@ def _gen_npm_imports(importers, packages, root_package, attr, registries, defaul # gather patches & patch args patches = _gather_values_from_matching_names(True, attr.patches, name, friendly_name, unfriendly_name) - patch_args = _gather_values_from_matching_names(False, attr.patch_args, name, friendly_name, unfriendly_name) + patch_args = _gather_values_from_matching_names(False, attr.patch_args, "*", name, friendly_name, unfriendly_name) # gather custom postinstalls custom_postinstalls = _gather_values_from_matching_names(True, attr.custom_postinstalls, name, friendly_name, unfriendly_name) diff --git a/npm/private/test/repositories_checked.bzl b/npm/private/test/repositories_checked.bzl index d74416c8b..a4fcfff29 100644 --- a/npm/private/test/repositories_checked.bzl +++ b/npm/private/test/repositories_checked.bzl @@ -1216,7 +1216,7 @@ def npm_repositories(): "@gregmagolan/test-a": ["0.0.1"], }, patches = ["//examples/npm_deps:patches/test-a.patch", "//examples/npm_deps:patches/test-a@0.0.1.patch"], - patch_args = ["-p1"], + patch_args = ["-p4"], ) npm_import( @@ -1239,6 +1239,8 @@ def npm_repositories(): "@gregmagolan/test-b": ["0.0.2"], "@gregmagolan/test-a": ["0.0.1"], }, + patches = ["//examples/npm_deps:patches/test-b.patch"], + patch_args = ["-p1"], ) npm_import(