From bd097107b6a528288e02dabe2a2310412d22c01b Mon Sep 17 00:00:00 2001 From: Jason Bedard Date: Sun, 7 Apr 2024 20:43:29 -0700 Subject: [PATCH] refactor: remove legacy update_pnpm_lock default value (#1624) --- docs/npm_translate_lock.md | 2 +- npm/private/npm_translate_lock.bzl | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/docs/npm_translate_lock.md b/docs/npm_translate_lock.md index b5a41caa7..67126b35a 100644 --- a/docs/npm_translate_lock.md +++ b/docs/npm_translate_lock.md @@ -102,7 +102,7 @@ For more about how to use npm_translate_lock, read [pnpm and rules_js](/docs/pnp | pnpm_lock | The pnpm-lock.yaml file. | None | | npm_package_lock | The package-lock.json file written by npm install.

Only one of npm_package_lock or yarn_lock may be set. | None | | yarn_lock | The yarn.lock file written by yarn install.

Only one of npm_package_lock or yarn_lock may be set. | None | -| update_pnpm_lock | When True, the pnpm lock file will be updated automatically when any of its inputs have changed since the last update.

Defaults to True when one of npm_package_lock or yarn_lock are set. Otherwise it defaults to False.

Read more: [using update_pnpm_lock](/docs/pnpm.md#update_pnpm_lock) | None | +| update_pnpm_lock | When True, the pnpm lock file will be updated automatically when any of its inputs have changed since the last update.

Defaults to True when one of npm_package_lock or yarn_lock are set. Otherwise it defaults to False.

Read more: [using update_pnpm_lock](/docs/pnpm.md#update_pnpm_lock) | False | | node_toolchain_prefix | the prefix of the node toolchain to use when generating the pnpm lockfile. | "nodejs" | | yq_toolchain_prefix | the prefix of the yq toolchain to use for parsing the pnpm lockfile. | "yq" | | preupdate | Node.js scripts to run in this repository rule before auto-updating the pnpm lock file.

Scripts are run sequentially in the order they are listed. The working directory is set to the root of the external repository. Make sure all files required by preupdate scripts are added to the data attribute.

A preupdate script could, for example, transform resolutions in the root package.json file from a format that yarn understands such as @foo/**/bar to the equivalent @foo/*>bar that pnpm understands so that resolutions are compatible with pnpm when running pnpm import to update the pnpm lock file.

Only needed when update_pnpm_lock is True. Read more: [using update_pnpm_lock](/docs/pnpm.md#update_pnpm_lock) | [] | diff --git a/npm/private/npm_translate_lock.bzl b/npm/private/npm_translate_lock.bzl index be112d978..eaf893355 100644 --- a/npm/private/npm_translate_lock.bzl +++ b/npm/private/npm_translate_lock.bzl @@ -162,7 +162,7 @@ def npm_translate_lock( pnpm_lock = None, npm_package_lock = None, yarn_lock = None, - update_pnpm_lock = None, + update_pnpm_lock = False, node_toolchain_prefix = "nodejs", yq_toolchain_prefix = "yq", preupdate = [], @@ -617,11 +617,6 @@ def npm_translate_lock( for value_key, value_value in value.items(): bins_string_list_dict[key].append("{}={}".format(value_key, value_value)) - # Default update_pnpm_lock to True if npm_package_lock or yarn_lock is set to - # preserve pre-update_pnpm_lock `pnpm import` behavior. - if update_pnpm_lock == None and (npm_package_lock or yarn_lock): - update_pnpm_lock = True - if not update_pnpm_lock and preupdate: fail("expected update_pnpm_lock to be True when preupdate are specified")