Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// into the Common folder)?
const matchedRushPackage: RushConfigurationProject = rushConfiguration.getProjectByName(dependency.name);
if (matchedRushPackage) {
const matchedVersion: string = matchedRushPackage.packageJson.version;
// The dependency name matches an Rush project, but are there any other reasons not
// to create a local link?
if (cyclicSubtreeRoot) {
// DO NOT create a local link, because this is part of an existing
// cyclicDependencyProjects subtree
} else if (project.cyclicDependencyProjects.has(dependency.name)) {
// DO NOT create a local link, because we are starting a new
// cyclicDependencyProjects subtree
startingCyclicSubtree = true;
} else if (dependency.kind !== PackageDependencyKind.LocalLink
&& !semver.satisfies(matchedVersion, dependency.versionRange)) {
// DO NOT create a local link, because the local project's version isn't SemVer compatible.
// (Note that in order to make version bumping work as expected, we ignore SemVer for
// immediate dependencies of top-level projects, indicated by PackageDependencyKind.LocalLink.
// Is this wise?)
console.log(colors.yellow(`Rush will not locally link ${dependency.name} for ${localPackage.name}`
+ ` because the requested version "${dependency.versionRange}" is incompatible`
+ ` with the local version ${matchedVersion}`));
} else {
// Yes, it is compatible, so create a symlink to the Rush project.
// If the link is coming from our top-level Rush project, then record a
// build dependency in rush-link.json:
if (localPackage === localProjectPackage) {