Skip to content

Commit

Permalink
fix: yarn is not pasing yarn config to getEngines (#1445)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbnayax authored Aug 7, 2024
1 parent ed0767b commit 76d7d34
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion src/package-managers/yarn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { NpmOptions } from '../types/NpmOptions'
import { Options } from '../types/Options'
import { SpawnOptions } from '../types/SpawnOptions'
import { SpawnPleaseOptions } from '../types/SpawnPleaseOptions'
import { Version } from '../types/Version'
import { VersionSpec } from '../types/VersionSpec'
import * as npm from './npm'

Expand Down Expand Up @@ -293,6 +294,37 @@ export const newest = withNpmConfigFromYarn(npm.newest)
export const patch = withNpmConfigFromYarn(npm.patch)
export const semver = withNpmConfigFromYarn(npm.semver)

export { getEngines, getPeerDependencies, packageAuthorChanged } from './npm'
export { getPeerDependencies } from './npm'

/**
* Fetches the engines list from the registry for a specific package version.
*
* @param packageName
* @param version
* @returns Promised engines collection
*/
export const getEngines = async (
packageName: string,
version: Version,
options: Options = {},
): Promise<Index<VersionSpec | undefined>> =>
npm.getEngines(packageName, version, options, await npmConfigFromYarn(options))

/**
* Check if package author changed between current and upgraded version.
*
* @param packageName Name of the package
* @param currentVersion Current version declaration (may be range)
* @param upgradedVersion Upgraded version declaration (may be range)
* @param npmConfigLocal Additional npm config variables that are merged into the system npm config
* @returns A promise that fulfills with boolean value.
*/
export const packageAuthorChanged = async (
packageName: string,
currentVersion: VersionSpec,
upgradedVersion: VersionSpec,
options: Options = {},
): Promise<boolean> =>
npm.packageAuthorChanged(packageName, currentVersion, upgradedVersion, options, await npmConfigFromYarn(options))

export default spawnYarn

0 comments on commit 76d7d34

Please sign in to comment.