diff --git a/docs/npm_import.md b/docs/npm_import.md index 178f49c11..acd89c071 100644 --- a/docs/npm_import.md +++ b/docs/npm_import.md @@ -151,7 +151,7 @@ Read more about the downloader config: commit | Specific commit to be checked out if url is a git repository. | `""` | | replace_package | Use the specified npm_package target when linking instead of the fetched sources for this npm package.

The injected npm_package target may optionally contribute transitive npm package dependencies on top of the transitive dependencies specified in the pnpm lock file for the same package, however, these transitive dependencies must not collide with pnpm lock specified transitive dependencies.

Any patches specified for this package will be not applied to the injected npm_package target. They will be applied, however, to the fetches sources so they can still be useful for patching the fetched `package.json` file, which is used to determine the generated bin entries for the package.

NB: lifecycle hooks and custom_postinstall scripts, if implicitly or explicitly enabled, will be run on the injected npm_package. These may be disabled explicitly using the `lifecycle_hooks` attribute. | `None` | | package_visibility | Visibility of generated node_module link targets. | `["//visibility:public"]` | -| patch_tool | The patch tool. | `None` | +| patch_tool | The patch tool to use. If not specified, the `patch` from `PATH` is used. | `None` | | patch_args | Arguments to pass to the patch tool.

`-p1` will usually be needed for patches generated by git. | `["-p0"]` | | patches | Patch files to apply onto the downloaded npm package. | `[]` | | custom_postinstall | Custom string postinstall script to run on the installed npm package.

Runs after any existing lifecycle hooks if any are enabled. | `""` | diff --git a/docs/npm_translate_lock.md b/docs/npm_translate_lock.md index bb928da1c..5d2b733b5 100644 --- a/docs/npm_translate_lock.md +++ b/docs/npm_translate_lock.md @@ -111,7 +111,7 @@ For more about how to use npm_translate_lock, read [pnpm and rules_js](/docs/pnp | use_home_npmrc | Use the `$HOME/.npmrc` file (or `$USERPROFILE/.npmrc` when on Windows) if it exists.

Settings from home `.npmrc` are merged with settings loaded from the `.npmrc` file specified in the `npmrc` attribute, if any. Where there are conflicting settings, the home `.npmrc` values will take precedence.

WARNING: The repository rule will not be invalidated by changes to the home `.npmrc` file since there is no way to specify this file as an input to the repository rule. If changes are made to the home `.npmrc` you can force the repository rule to re-run and pick up the changes by running: `bazel run @{name}//:sync` where `name` is the name of the `npm_translate_lock` you want to re-run.

Because of the repository rule invalidation issue, using the home `.npmrc` is not recommended. `.npmrc` settings should generally go in the `npmrc` in your repository so they are shared by all developers. The home `.npmrc` should be reserved for authentication settings for private npm repositories. | `None` | | data | Data files required by this repository rule when auto-updating the pnpm lock file.

Only needed when `update_pnpm_lock` is True. Read more: [using update_pnpm_lock](/docs/pnpm.md#update_pnpm_lock) | `[]` | | patches | A map of package names or package names with their version (e.g., "my-package" or "my-package@v1.2.3") to a label list of patches to apply to the downloaded npm package. Multiple matches are additive.

These patches are applied after any patches in [pnpm.patchedDependencies](https://pnpm.io/next/package_json#pnpmpatcheddependencies).

Read more: [patching](/docs/pnpm.md#patching) | `{}` | -| patch_tool | The patch tool. | `None` | +| patch_tool | The patch tool to use. If not specified, the `patch` from `PATH` is used. | `None` | | patch_args | A map of package names or package names with their version (e.g., "my-package" or "my-package@v1.2.3") to a label list arguments to pass to the patch tool. The most specific match wins.

Read more: [patching](/docs/pnpm.md#patching) | `{"*": ["-p0"]}` | | custom_postinstalls | A map of package names or package names with their version (e.g., "my-package" or "my-package@v1.2.3") to a custom postinstall script to apply to the downloaded npm package after its lifecycle scripts runs. If the version is left out of the package name, the script will run on every version of the npm package. If a custom postinstall scripts exists for a package as well as for a specific version, the script for the versioned package will be appended with `&&` to the non-versioned package script.

For example,

custom_postinstalls = {
    "@foo/bar": "echo something > somewhere.txt",
    "fum@0.0.1": "echo something_else > somewhere_else.txt",
},


Custom postinstalls are additive and joined with ` && ` when there are multiple matches for a package. More specific matches are appended to previous matches. | `{}` | | package_visibility | A map of package names or package names with their version (e.g., "my-package" or "my-package@v1.2.3") to a visibility list to use for the package's generated node_modules link targets. Multiple matches are additive. If there are no matches then the package's generated node_modules link targets default to public visibility (`["//visibility:public"]`). | `{}` | diff --git a/npm/private/npm_import.bzl b/npm/private/npm_import.bzl index 6e47212b4..9ee88e881 100644 --- a/npm/private/npm_import.bzl +++ b/npm/private/npm_import.bzl @@ -1102,7 +1102,7 @@ def npm_import( package_visibility: Visibility of generated node_module link targets. - patch_tool: The patch tool. + patch_tool: The patch tool to use. If not specified, the `patch` from `PATH` is used. patch_args: Arguments to pass to the patch tool. diff --git a/npm/private/npm_translate_lock.bzl b/npm/private/npm_translate_lock.bzl index 6bfed9870..a8af07f8a 100644 --- a/npm/private/npm_translate_lock.bzl +++ b/npm/private/npm_translate_lock.bzl @@ -279,7 +279,7 @@ def npm_translate_lock( Read more: [patching](/docs/pnpm.md#patching) - patch_tool: The patch tool. + patch_tool: The patch tool to use. If not specified, the `patch` from `PATH` is used. patch_args: A map of package names or package names with their version (e.g., "my-package" or "my-package@v1.2.3") to a label list arguments to pass to the patch tool. The most specific match wins.