fix(release): ensure updateDependents only works for independent projects (#28283)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
This commit is contained in:
parent
d5c452194f
commit
7c0e34400e
@ -94,7 +94,8 @@ Valid values are: ${validReleaseVersionPrefixes
|
|||||||
// Sort the projects topologically if update dependents is enabled
|
// Sort the projects topologically if update dependents is enabled
|
||||||
// TODO: maybe move this sorting to the command level?
|
// TODO: maybe move this sorting to the command level?
|
||||||
const projects =
|
const projects =
|
||||||
updateDependents === 'never'
|
updateDependents === 'never' ||
|
||||||
|
options.releaseGroup.projectsRelationship !== 'independent'
|
||||||
? options.projects
|
? options.projects
|
||||||
: sortProjectsTopologically(options.projectGraph, options.projects);
|
: sortProjectsTopologically(options.projectGraph, options.projects);
|
||||||
const projectToDependencyBumps = new Map<string, any>();
|
const projectToDependencyBumps = new Map<string, any>();
|
||||||
@ -417,6 +418,7 @@ To fix this you will either need to add a package.json file at that location, or
|
|||||||
if (!specifier) {
|
if (!specifier) {
|
||||||
if (
|
if (
|
||||||
updateDependents !== 'never' &&
|
updateDependents !== 'never' &&
|
||||||
|
options.releaseGroup.projectsRelationship === 'independent' &&
|
||||||
projectToDependencyBumps.has(projectName)
|
projectToDependencyBumps.has(projectName)
|
||||||
) {
|
) {
|
||||||
// No applicable changes to the project directly by the user, but one or more dependencies have been bumped and updateDependents is enabled
|
// No applicable changes to the project directly by the user, but one or more dependencies have been bumped and updateDependents is enabled
|
||||||
@ -541,6 +543,7 @@ To fix this you will either need to add a package.json file at that location, or
|
|||||||
if (!specifier) {
|
if (!specifier) {
|
||||||
if (
|
if (
|
||||||
updateDependents !== 'never' &&
|
updateDependents !== 'never' &&
|
||||||
|
options.releaseGroup.projectsRelationship === 'independent' &&
|
||||||
projectToDependencyBumps.has(projectName)
|
projectToDependencyBumps.has(projectName)
|
||||||
) {
|
) {
|
||||||
// No applicable changes to the project directly by the user, but one or more dependencies have been bumped and updateDependents is enabled
|
// No applicable changes to the project directly by the user, but one or more dependencies have been bumped and updateDependents is enabled
|
||||||
@ -601,7 +604,9 @@ To fix this you will either need to add a package.json file at that location, or
|
|||||||
return localPackageDependency.target === project.name;
|
return localPackageDependency.target === project.name;
|
||||||
});
|
});
|
||||||
|
|
||||||
const includeTransitiveDependents = updateDependents !== 'never';
|
const includeTransitiveDependents =
|
||||||
|
updateDependents !== 'never' &&
|
||||||
|
options.releaseGroup.projectsRelationship === 'independent';
|
||||||
const transitiveLocalPackageDependents: LocalPackageDependency[] = [];
|
const transitiveLocalPackageDependents: LocalPackageDependency[] = [];
|
||||||
if (includeTransitiveDependents) {
|
if (includeTransitiveDependents) {
|
||||||
for (const directDependent of allDependentProjects) {
|
for (const directDependent of allDependentProjects) {
|
||||||
@ -656,7 +661,10 @@ To fix this you will either need to add a package.json file at that location, or
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If not always updating dependents (when they don't already appear in the batch itself), print a warning to the user about what is being skipped and how to change it
|
// If not always updating dependents (when they don't already appear in the batch itself), print a warning to the user about what is being skipped and how to change it
|
||||||
if (updateDependents === 'never') {
|
if (
|
||||||
|
updateDependents === 'never' ||
|
||||||
|
options.releaseGroup.projectsRelationship !== 'independent'
|
||||||
|
) {
|
||||||
if (dependentProjectsOutsideCurrentBatch.length > 0) {
|
if (dependentProjectsOutsideCurrentBatch.length > 0) {
|
||||||
let logMsg = `⚠️ Warning, the following packages depend on "${project.name}"`;
|
let logMsg = `⚠️ Warning, the following packages depend on "${project.name}"`;
|
||||||
const reason =
|
const reason =
|
||||||
@ -689,7 +697,8 @@ To fix this you will either need to add a package.json file at that location, or
|
|||||||
currentVersion,
|
currentVersion,
|
||||||
newVersion: null, // will stay as null in the final result in the case that no changes are detected
|
newVersion: null, // will stay as null in the final result in the case that no changes are detected
|
||||||
dependentProjects:
|
dependentProjects:
|
||||||
updateDependents === 'auto'
|
updateDependents === 'auto' &&
|
||||||
|
options.releaseGroup.projectsRelationship === 'independent'
|
||||||
? allDependentProjects
|
? allDependentProjects
|
||||||
: dependentProjectsInCurrentBatch,
|
: dependentProjectsInCurrentBatch,
|
||||||
};
|
};
|
||||||
@ -723,7 +732,8 @@ To fix this you will either need to add a package.json file at that location, or
|
|||||||
|
|
||||||
if (allDependentProjects.length > 0) {
|
if (allDependentProjects.length > 0) {
|
||||||
const totalProjectsToUpdate =
|
const totalProjectsToUpdate =
|
||||||
updateDependents === 'auto'
|
updateDependents === 'auto' &&
|
||||||
|
options.releaseGroup.projectsRelationship === 'independent'
|
||||||
? allDependentProjects.length +
|
? allDependentProjects.length +
|
||||||
transitiveLocalPackageDependents.length -
|
transitiveLocalPackageDependents.length -
|
||||||
// There are two entries per circular dep
|
// There are two entries per circular dep
|
||||||
@ -855,7 +865,10 @@ To fix this you will either need to add a package.json file at that location, or
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updateDependents === 'auto') {
|
if (
|
||||||
|
updateDependents === 'auto' &&
|
||||||
|
options.releaseGroup.projectsRelationship === 'independent'
|
||||||
|
) {
|
||||||
for (const dependentProject of dependentProjectsOutsideCurrentBatch) {
|
for (const dependentProject of dependentProjectsOutsideCurrentBatch) {
|
||||||
if (
|
if (
|
||||||
options.specifierSource === 'version-plans' &&
|
options.specifierSource === 'version-plans' &&
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user