fix(ngcc): allow ngcc configuration to match pre-release versions of packages (#36370)
Ngcc supports providing a project-level configuration to affect how certain dependencies are processed and also has a built-in fallback configuration for some unmaintained packages. Each entry in these configurations could be scoped to specific versions of a package by providing a version range. If no version range is provided for a package, it defaults to `*` (with the intention of matching any version). Previously, the installed version of a package was tested against the version range using the [semver][1] package's `satisfies()` function with the default options. By default, `satisfies()` does not match pre-releases (see [here][2] for more details on reasoning). While this makes sense when determining what version of a dependency to install (trying to avoid unexpected breaking changes), it is not desired in the case of ngcc. This commit fixes it by explicitly specifying that pre-release versions should be matched normally. [1]: https://www.npmjs.com/package/semver [2]: https://github.com/npm/node-semver#prerelease-tags PR Close #36370
This commit is contained in:

committed by
Alex Rickabaugh

parent
14ae3c0a21
commit
cb0a2a055d
@ -304,5 +304,7 @@ function findSatisfactoryVersion(
|
||||
// So just return the first config that matches the package name.
|
||||
return configs[0];
|
||||
}
|
||||
return configs.find(config => satisfies(version, config.versionRange)) || null;
|
||||
return configs.find(
|
||||
config => satisfies(version, config.versionRange, {includePrerelease: true})) ||
|
||||
null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user