Skip to content

Commit

Permalink
Yarn Berry: remove unused code
Browse files Browse the repository at this point in the history
There's no need for Cachi2 to directly access the contents of the
"npmRegistryServer" yarn_rc variable, since Yarn itself will read it
when we execute "yarn install". The code refering to it is a leftover of
the development phase.

In a similar way, there's no use in setting "unsafeHttpWhitelist" as an
empty list by default, since Cachi2 will purposefully set it to an empty
list as a way to overwrite any unwanted user configuration.

Signed-off-by: Bruno Pimentel <[email protected]>
  • Loading branch information
brunoapimentel committed Jan 8, 2025
1 parent 7375b3d commit ecbab2a
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions cachi2/core/package_managers/yarn/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,9 @@ class YarnRc(ConfigurationFile):
_defaults = {
"cacheFolder": "./.yarn/cache",
"lockfileFilename": "yarn.lock",
"unsafeHttpWhitelist": [],
"plugins": [],
"npmRegistryServer": "https://registry.yarnpkg.com",
}

def registry_server_for_scope(self, scope: str) -> str:
"""Get the configured registry server for a scoped package.
Fallback to the global defined registry server if there's no configuration for this specific
scope.
See: https://v3.yarnpkg.com/configuration/yarnrc#npmScopes
"""
registry = self.data.get("npmScopes", {}).get(scope, {}).get("npmRegistryServer")
return registry or self["npmRegistryServer"]

def write(self) -> None:
"""Write the data to the yarnrc file."""
with self._path.path.open("w") as f:
Expand Down

0 comments on commit ecbab2a

Please sign in to comment.