Skip to content

Commit 76d7d34

Browse files
authored
fix: yarn is not pasing yarn config to getEngines (#1445)
1 parent ed0767b commit 76d7d34

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

src/package-managers/yarn.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { NpmOptions } from '../types/NpmOptions'
1717
import { Options } from '../types/Options'
1818
import { SpawnOptions } from '../types/SpawnOptions'
1919
import { SpawnPleaseOptions } from '../types/SpawnPleaseOptions'
20+
import { Version } from '../types/Version'
2021
import { VersionSpec } from '../types/VersionSpec'
2122
import * as npm from './npm'
2223

@@ -293,6 +294,37 @@ export const newest = withNpmConfigFromYarn(npm.newest)
293294
export const patch = withNpmConfigFromYarn(npm.patch)
294295
export const semver = withNpmConfigFromYarn(npm.semver)
295296

296-
export { getEngines, getPeerDependencies, packageAuthorChanged } from './npm'
297+
export { getPeerDependencies } from './npm'
298+
299+
/**
300+
* Fetches the engines list from the registry for a specific package version.
301+
*
302+
* @param packageName
303+
* @param version
304+
* @returns Promised engines collection
305+
*/
306+
export const getEngines = async (
307+
packageName: string,
308+
version: Version,
309+
options: Options = {},
310+
): Promise<Index<VersionSpec | undefined>> =>
311+
npm.getEngines(packageName, version, options, await npmConfigFromYarn(options))
312+
313+
/**
314+
* Check if package author changed between current and upgraded version.
315+
*
316+
* @param packageName Name of the package
317+
* @param currentVersion Current version declaration (may be range)
318+
* @param upgradedVersion Upgraded version declaration (may be range)
319+
* @param npmConfigLocal Additional npm config variables that are merged into the system npm config
320+
* @returns A promise that fulfills with boolean value.
321+
*/
322+
export const packageAuthorChanged = async (
323+
packageName: string,
324+
currentVersion: VersionSpec,
325+
upgradedVersion: VersionSpec,
326+
options: Options = {},
327+
): Promise<boolean> =>
328+
npm.packageAuthorChanged(packageName, currentVersion, upgradedVersion, options, await npmConfigFromYarn(options))
297329

298330
export default spawnYarn

0 commit comments

Comments
 (0)