@storm-software/git-tools 2.131.17 → 2.131.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/git.cjs +788 -70
- package/bin/git.cjs.map +1 -1
- package/bin/git.js +763 -46
- package/bin/git.js.map +1 -1
- package/package.json +6 -6
package/bin/git.cjs
CHANGED
|
@@ -57,7 +57,6 @@ var semver = require('semver');
|
|
|
57
57
|
var release = require('nx/release');
|
|
58
58
|
var versionPlans = require('nx/src/command-line/release/config/version-plans');
|
|
59
59
|
var printChanges_js = require('nx/src/command-line/release/utils/print-changes.js');
|
|
60
|
-
var releaseGraph = require('nx/src/command-line/release/utils/release-graph');
|
|
61
60
|
var versionPlanUtils = require('nx/src/command-line/release/utils/version-plan-utils');
|
|
62
61
|
var tree = require('nx/src/generators/tree');
|
|
63
62
|
var fileMapUtils = require('nx/src/project-graph/file-map-utils');
|
|
@@ -66,6 +65,15 @@ var DefaultChangelogRenderer = require('nx/release/changelog-renderer');
|
|
|
66
65
|
var conventionalCommits = require('nx/src/command-line/release/config/conventional-commits');
|
|
67
66
|
var nxJson = require('nx/src/config/nx-json');
|
|
68
67
|
var findMatchingProjects = require('nx/src/utils/find-matching-projects');
|
|
68
|
+
var config$1 = require('nx/src/command-line/release/config/config');
|
|
69
|
+
var repositoryGitTags = require('nx/src/command-line/release/utils/repository-git-tags');
|
|
70
|
+
var projectLogger = require('nx/src/command-line/release/version/project-logger');
|
|
71
|
+
var resolveCurrentVersion = require('nx/src/command-line/release/version/resolve-current-version');
|
|
72
|
+
var topologicalSort = require('nx/src/command-line/release/version/topological-sort');
|
|
73
|
+
var versionActions = require('nx/src/command-line/release/version/version-actions');
|
|
74
|
+
var affectedProjectGraph = require('nx/src/project-graph/affected/affected-project-graph');
|
|
75
|
+
var fileUtils = require('nx/src/project-graph/file-utils');
|
|
76
|
+
var gte = require('semver/functions/gte');
|
|
69
77
|
var config_js = require('nx/src/command-line/release/config/config.js');
|
|
70
78
|
var deriveSpecifierFromConventionalCommits = require('nx/src/command-line/release/version/derive-specifier-from-conventional-commits');
|
|
71
79
|
var deriverSpecifierFromVersionPlans = require('nx/src/command-line/release/version/deriver-specifier-from-version-plans');
|
|
@@ -95,6 +103,7 @@ var chalk__default = /*#__PURE__*/_interopDefault(chalk);
|
|
|
95
103
|
var semver__default = /*#__PURE__*/_interopDefault(semver);
|
|
96
104
|
var importsPlugin__default = /*#__PURE__*/_interopDefault(importsPlugin);
|
|
97
105
|
var DefaultChangelogRenderer__default = /*#__PURE__*/_interopDefault(DefaultChangelogRenderer);
|
|
106
|
+
var gte__default = /*#__PURE__*/_interopDefault(gte);
|
|
98
107
|
|
|
99
108
|
function parseCargoToml(cargoString) {
|
|
100
109
|
if (!cargoString) {
|
|
@@ -3612,7 +3621,686 @@ function formatConfigLog(config5) {
|
|
|
3612
3621
|
{ sort: true, skip: ["workspaceConfig"] }
|
|
3613
3622
|
);
|
|
3614
3623
|
}
|
|
3615
|
-
var
|
|
3624
|
+
var validReleaseVersionPrefixes = ["auto", "", "~", "^", "="];
|
|
3625
|
+
var ReleaseGraph = class _ReleaseGraph {
|
|
3626
|
+
constructor(releaseGroups, filters) {
|
|
3627
|
+
this.releaseGroups = releaseGroups;
|
|
3628
|
+
this.filters = filters;
|
|
3629
|
+
}
|
|
3630
|
+
projectToReleaseGroup = /* @__PURE__ */ new Map();
|
|
3631
|
+
projectToDependents = /* @__PURE__ */ new Map();
|
|
3632
|
+
projectToDependencies = /* @__PURE__ */ new Map();
|
|
3633
|
+
projectToUpdateDependentsSetting = /* @__PURE__ */ new Map();
|
|
3634
|
+
groupGraph = /* @__PURE__ */ new Map();
|
|
3635
|
+
sortedReleaseGroups = [];
|
|
3636
|
+
sortedProjects = /* @__PURE__ */ new Map();
|
|
3637
|
+
allProjectsConfiguredForNxRelease = /* @__PURE__ */ new Set();
|
|
3638
|
+
allProjectsToProcess = /* @__PURE__ */ new Set();
|
|
3639
|
+
finalConfigsByProject = /* @__PURE__ */ new Map();
|
|
3640
|
+
projectsToVersionActions = /* @__PURE__ */ new Map();
|
|
3641
|
+
uniqueAfterAllProjectsVersioned = /* @__PURE__ */ new Map();
|
|
3642
|
+
projectLoggers = /* @__PURE__ */ new Map();
|
|
3643
|
+
cachedCurrentVersions = /* @__PURE__ */ new Map();
|
|
3644
|
+
cachedLatestMatchingGitTag = /* @__PURE__ */ new Map();
|
|
3645
|
+
currentVersionsPerFixedReleaseGroup = /* @__PURE__ */ new Map();
|
|
3646
|
+
originalDependentProjectsPerProject = /* @__PURE__ */ new Map();
|
|
3647
|
+
releaseGroupToFilteredProjects = /* @__PURE__ */ new Map();
|
|
3648
|
+
originalFilteredProjects = /* @__PURE__ */ new Set();
|
|
3649
|
+
/**
|
|
3650
|
+
* Store the affected graph per commit per project
|
|
3651
|
+
* to avoid recomputation of the graph on workspace
|
|
3652
|
+
* with multiple projects
|
|
3653
|
+
*/
|
|
3654
|
+
affectedGraphPerCommit = /* @__PURE__ */ new Map();
|
|
3655
|
+
repositoryGitTags = repositoryGitTags.RepoGitTags.create();
|
|
3656
|
+
/**
|
|
3657
|
+
* User-friendly log describing what the filter matched.
|
|
3658
|
+
* Null if no filters were applied.
|
|
3659
|
+
*/
|
|
3660
|
+
filterLog = null;
|
|
3661
|
+
/**
|
|
3662
|
+
* Initialize the graph by building all relationships and caches
|
|
3663
|
+
* @internal - Called by createReleaseGraph(), not meant for external use
|
|
3664
|
+
*/
|
|
3665
|
+
async init(options) {
|
|
3666
|
+
this.setupProjectReleaseGroupMapping();
|
|
3667
|
+
this.applyInitialFiltering();
|
|
3668
|
+
await this.setupProjectsToProcess(options);
|
|
3669
|
+
await this.precomputeDependencyRelationships(
|
|
3670
|
+
options.tree,
|
|
3671
|
+
options.projectGraph
|
|
3672
|
+
);
|
|
3673
|
+
this.applyDependencyAwareFiltering();
|
|
3674
|
+
this.buildGroupGraphStructure();
|
|
3675
|
+
if (!options.skipVersionResolution) {
|
|
3676
|
+
await this.resolveCurrentVersionsForProjects(
|
|
3677
|
+
options.tree,
|
|
3678
|
+
options.projectGraph,
|
|
3679
|
+
options.preid ?? ""
|
|
3680
|
+
);
|
|
3681
|
+
}
|
|
3682
|
+
this.buildGroupDependencyGraph();
|
|
3683
|
+
this.sortedReleaseGroups = this.topologicallySortReleaseGroups();
|
|
3684
|
+
for (const group of this.releaseGroups) {
|
|
3685
|
+
this.sortedProjects.set(
|
|
3686
|
+
group.name,
|
|
3687
|
+
this.topologicallySortProjects(group)
|
|
3688
|
+
);
|
|
3689
|
+
}
|
|
3690
|
+
await this.populateDependentProjectsData(
|
|
3691
|
+
options.tree,
|
|
3692
|
+
options.projectGraph
|
|
3693
|
+
);
|
|
3694
|
+
}
|
|
3695
|
+
/**
|
|
3696
|
+
* Setup mapping from project to release group and cache updateDependents settings
|
|
3697
|
+
*/
|
|
3698
|
+
setupProjectReleaseGroupMapping() {
|
|
3699
|
+
for (const group of this.releaseGroups) {
|
|
3700
|
+
for (const project of group.projects) {
|
|
3701
|
+
this.projectToReleaseGroup.set(project, group);
|
|
3702
|
+
const updateDependents = group.version?.updateDependents || "always";
|
|
3703
|
+
this.projectToUpdateDependentsSetting.set(project, updateDependents);
|
|
3704
|
+
}
|
|
3705
|
+
}
|
|
3706
|
+
}
|
|
3707
|
+
/**
|
|
3708
|
+
* Apply initial filtering to construct releaseGroupToFilteredProjects based on filters.
|
|
3709
|
+
* This determines the base set of projects and groups before considering dependencies.
|
|
3710
|
+
*/
|
|
3711
|
+
applyInitialFiltering() {
|
|
3712
|
+
const matchedReleaseGroups = [];
|
|
3713
|
+
for (const releaseGroup of this.releaseGroups) {
|
|
3714
|
+
if (this.filters.groups?.length && !this.filters.groups.includes(releaseGroup.name)) {
|
|
3715
|
+
continue;
|
|
3716
|
+
}
|
|
3717
|
+
if (this.filters.groups?.length && !this.filters.projects?.length) {
|
|
3718
|
+
this.releaseGroupToFilteredProjects.set(
|
|
3719
|
+
releaseGroup,
|
|
3720
|
+
new Set(releaseGroup.projects)
|
|
3721
|
+
);
|
|
3722
|
+
matchedReleaseGroups.push(releaseGroup);
|
|
3723
|
+
continue;
|
|
3724
|
+
}
|
|
3725
|
+
const filteredProjects = /* @__PURE__ */ new Set();
|
|
3726
|
+
for (const project of releaseGroup.projects) {
|
|
3727
|
+
if (this.filters.projects?.length && !this.filters.projects.includes(project)) {
|
|
3728
|
+
continue;
|
|
3729
|
+
}
|
|
3730
|
+
filteredProjects.add(project);
|
|
3731
|
+
}
|
|
3732
|
+
if (filteredProjects.size > 0 || !this.hasAnyFilters()) {
|
|
3733
|
+
const projectsToInclude = filteredProjects.size > 0 ? filteredProjects : new Set(releaseGroup.projects);
|
|
3734
|
+
this.releaseGroupToFilteredProjects.set(
|
|
3735
|
+
releaseGroup,
|
|
3736
|
+
projectsToInclude
|
|
3737
|
+
);
|
|
3738
|
+
matchedReleaseGroups.push(releaseGroup);
|
|
3739
|
+
}
|
|
3740
|
+
}
|
|
3741
|
+
if (this.hasAnyFilters()) {
|
|
3742
|
+
this.releaseGroups = matchedReleaseGroups;
|
|
3743
|
+
}
|
|
3744
|
+
}
|
|
3745
|
+
/**
|
|
3746
|
+
* Check if any filters are applied
|
|
3747
|
+
*/
|
|
3748
|
+
hasAnyFilters() {
|
|
3749
|
+
return !!(this.filters.projects?.length || this.filters.groups?.length);
|
|
3750
|
+
}
|
|
3751
|
+
/**
|
|
3752
|
+
* Setup projects to process and resolve version actions
|
|
3753
|
+
*/
|
|
3754
|
+
async setupProjectsToProcess(options) {
|
|
3755
|
+
const {
|
|
3756
|
+
tree,
|
|
3757
|
+
projectGraph,
|
|
3758
|
+
nxReleaseConfig,
|
|
3759
|
+
filters,
|
|
3760
|
+
firstRelease,
|
|
3761
|
+
versionActionsOptionsOverrides
|
|
3762
|
+
} = options;
|
|
3763
|
+
let projectsToProcess = /* @__PURE__ */ new Set();
|
|
3764
|
+
const resolveVersionActionsForProjectCallbacks = [];
|
|
3765
|
+
for (const [groupName, group] of Object.entries(nxReleaseConfig.groups)) {
|
|
3766
|
+
for (const project of group.projects) {
|
|
3767
|
+
this.allProjectsConfiguredForNxRelease.add(project);
|
|
3768
|
+
this.projectLoggers.set(project, new projectLogger.ProjectLogger(project));
|
|
3769
|
+
if (filters.groups?.includes(groupName)) {
|
|
3770
|
+
projectsToProcess.add(project);
|
|
3771
|
+
} else if (filters.projects?.includes(project)) {
|
|
3772
|
+
projectsToProcess.add(project);
|
|
3773
|
+
}
|
|
3774
|
+
const projectGraphNode = projectGraph.nodes[project];
|
|
3775
|
+
const releaseGroup = this.projectToReleaseGroup.get(project);
|
|
3776
|
+
const finalConfigForProject = _ReleaseGraph.resolveFinalConfigForProject(
|
|
3777
|
+
releaseGroup,
|
|
3778
|
+
projectGraphNode,
|
|
3779
|
+
firstRelease,
|
|
3780
|
+
versionActionsOptionsOverrides
|
|
3781
|
+
);
|
|
3782
|
+
this.finalConfigsByProject.set(project, finalConfigForProject);
|
|
3783
|
+
resolveVersionActionsForProjectCallbacks.push(async () => {
|
|
3784
|
+
const {
|
|
3785
|
+
versionActionsPath,
|
|
3786
|
+
versionActions: versionActions$1,
|
|
3787
|
+
afterAllProjectsVersioned
|
|
3788
|
+
} = await versionActions.resolveVersionActionsForProject(
|
|
3789
|
+
tree,
|
|
3790
|
+
releaseGroup,
|
|
3791
|
+
projectGraphNode,
|
|
3792
|
+
finalConfigForProject
|
|
3793
|
+
);
|
|
3794
|
+
if (!this.uniqueAfterAllProjectsVersioned.has(versionActionsPath)) {
|
|
3795
|
+
this.uniqueAfterAllProjectsVersioned.set(
|
|
3796
|
+
versionActionsPath,
|
|
3797
|
+
afterAllProjectsVersioned
|
|
3798
|
+
);
|
|
3799
|
+
}
|
|
3800
|
+
let versionActionsToUse = versionActions$1;
|
|
3801
|
+
const shouldSkip = shared.shouldSkipVersionActions(
|
|
3802
|
+
finalConfigForProject.dockerOptions,
|
|
3803
|
+
project
|
|
3804
|
+
);
|
|
3805
|
+
if (shouldSkip) {
|
|
3806
|
+
versionActionsToUse = new versionActions.NOOP_VERSION_ACTIONS(
|
|
3807
|
+
releaseGroup,
|
|
3808
|
+
projectGraphNode,
|
|
3809
|
+
finalConfigForProject
|
|
3810
|
+
);
|
|
3811
|
+
}
|
|
3812
|
+
this.projectsToVersionActions.set(project, versionActionsToUse);
|
|
3813
|
+
});
|
|
3814
|
+
}
|
|
3815
|
+
}
|
|
3816
|
+
if (!filters.groups?.length && !filters.projects?.length) {
|
|
3817
|
+
projectsToProcess = this.allProjectsConfiguredForNxRelease;
|
|
3818
|
+
}
|
|
3819
|
+
if (projectsToProcess.size === 0) {
|
|
3820
|
+
throw new Error(
|
|
3821
|
+
"No projects are set to be processed, please report this as a bug on https://github.com/nrwl/nx/issues"
|
|
3822
|
+
);
|
|
3823
|
+
}
|
|
3824
|
+
this.allProjectsToProcess = new Set(projectsToProcess);
|
|
3825
|
+
for (const cb of resolveVersionActionsForProjectCallbacks) {
|
|
3826
|
+
await cb();
|
|
3827
|
+
}
|
|
3828
|
+
}
|
|
3829
|
+
/**
|
|
3830
|
+
* Precompute dependency relationships between all projects
|
|
3831
|
+
*/
|
|
3832
|
+
async precomputeDependencyRelationships(tree, projectGraph) {
|
|
3833
|
+
for (const projectName of this.allProjectsConfiguredForNxRelease) {
|
|
3834
|
+
const versionActions = this.projectsToVersionActions.get(projectName);
|
|
3835
|
+
if (!this.projectToDependencies.has(projectName)) {
|
|
3836
|
+
this.projectToDependencies.set(projectName, /* @__PURE__ */ new Set());
|
|
3837
|
+
}
|
|
3838
|
+
const deps = await versionActions.readDependencies(tree, projectGraph);
|
|
3839
|
+
for (const dep of deps) {
|
|
3840
|
+
if (!this.allProjectsConfiguredForNxRelease.has(dep.target)) {
|
|
3841
|
+
continue;
|
|
3842
|
+
}
|
|
3843
|
+
this.projectToDependencies.get(projectName).add(dep.target);
|
|
3844
|
+
if (!this.projectToDependents.has(dep.target)) {
|
|
3845
|
+
this.projectToDependents.set(dep.target, /* @__PURE__ */ new Set());
|
|
3846
|
+
}
|
|
3847
|
+
this.projectToDependents.get(dep.target).add(projectName);
|
|
3848
|
+
}
|
|
3849
|
+
}
|
|
3850
|
+
}
|
|
3851
|
+
/**
|
|
3852
|
+
* Apply dependency-aware filtering that considers updateDependents configuration.
|
|
3853
|
+
* This includes transitive dependents based on updateDependents setting ('always' by default, or 'auto').
|
|
3854
|
+
*/
|
|
3855
|
+
applyDependencyAwareFiltering() {
|
|
3856
|
+
this.originalFilteredProjects = new Set(this.allProjectsToProcess);
|
|
3857
|
+
if (!this.hasAnyFilters()) {
|
|
3858
|
+
return;
|
|
3859
|
+
}
|
|
3860
|
+
this.validateFilterAgainstFixedGroups();
|
|
3861
|
+
this.findDependentsToProcess();
|
|
3862
|
+
this.generateFilterLog();
|
|
3863
|
+
}
|
|
3864
|
+
/**
|
|
3865
|
+
* Validate that the filter doesn't try to isolate projects in fixed release groups
|
|
3866
|
+
*/
|
|
3867
|
+
validateFilterAgainstFixedGroups() {
|
|
3868
|
+
if (!this.filters.projects?.length) {
|
|
3869
|
+
return;
|
|
3870
|
+
}
|
|
3871
|
+
for (const releaseGroup of this.releaseGroups) {
|
|
3872
|
+
if (releaseGroup.projectsRelationship !== "fixed") {
|
|
3873
|
+
continue;
|
|
3874
|
+
}
|
|
3875
|
+
const filteredProjectsInGroup = releaseGroup.projects.filter(
|
|
3876
|
+
(p) => this.releaseGroupToFilteredProjects.get(releaseGroup)?.has(p)
|
|
3877
|
+
);
|
|
3878
|
+
if (filteredProjectsInGroup.length > 0 && filteredProjectsInGroup.length < releaseGroup.projects.length) {
|
|
3879
|
+
throw new Error(
|
|
3880
|
+
`Cannot filter to a subset of projects within fixed release group "${releaseGroup.name}". Filtered projects: [${filteredProjectsInGroup.join(", ")}], All projects in group: [${releaseGroup.projects.join(", ")}]. Either filter to all projects in the group, use --groups to filter by group, or change the group to "independent".`
|
|
3881
|
+
);
|
|
3882
|
+
}
|
|
3883
|
+
}
|
|
3884
|
+
}
|
|
3885
|
+
/**
|
|
3886
|
+
* Find dependents that should be included in processing based on updateDependents configuration
|
|
3887
|
+
*/
|
|
3888
|
+
findDependentsToProcess() {
|
|
3889
|
+
const projectsToProcess = Array.from(this.allProjectsToProcess);
|
|
3890
|
+
const allTrackedDependents = /* @__PURE__ */ new Set();
|
|
3891
|
+
const dependentsToProcess = /* @__PURE__ */ new Set();
|
|
3892
|
+
const additionalGroups = /* @__PURE__ */ new Map();
|
|
3893
|
+
let currentLevel = [...projectsToProcess];
|
|
3894
|
+
while (currentLevel.length > 0) {
|
|
3895
|
+
const nextLevel = [];
|
|
3896
|
+
const dependents = this.getAllNonImplicitDependents(currentLevel);
|
|
3897
|
+
for (const dep of dependents) {
|
|
3898
|
+
if (allTrackedDependents.has(dep) || this.allProjectsToProcess.has(dep)) {
|
|
3899
|
+
continue;
|
|
3900
|
+
}
|
|
3901
|
+
allTrackedDependents.add(dep);
|
|
3902
|
+
const depUpdateDependentsSetting = this.projectToUpdateDependentsSetting.get(dep);
|
|
3903
|
+
if (depUpdateDependentsSetting !== "never") {
|
|
3904
|
+
const shouldIncludeDependent = currentLevel.some((proj) => {
|
|
3905
|
+
const projUpdateSetting = this.projectToUpdateDependentsSetting.get(proj);
|
|
3906
|
+
const projDependents = this.getProjectDependents(proj);
|
|
3907
|
+
if (!projDependents.has(dep)) {
|
|
3908
|
+
return false;
|
|
3909
|
+
}
|
|
3910
|
+
if (projUpdateSetting === "always") {
|
|
3911
|
+
return true;
|
|
3912
|
+
}
|
|
3913
|
+
if (projUpdateSetting === "auto") {
|
|
3914
|
+
const projGroup = this.getReleaseGroupForProject(proj);
|
|
3915
|
+
const depGroup = this.getReleaseGroupForProject(dep);
|
|
3916
|
+
return projGroup && depGroup && projGroup.name === depGroup.name;
|
|
3917
|
+
}
|
|
3918
|
+
return false;
|
|
3919
|
+
});
|
|
3920
|
+
if (shouldIncludeDependent) {
|
|
3921
|
+
dependentsToProcess.add(dep);
|
|
3922
|
+
const depGroup = this.getReleaseGroupForProject(dep);
|
|
3923
|
+
if (depGroup) {
|
|
3924
|
+
const groupAlreadyExists = this.releaseGroups.some(
|
|
3925
|
+
(g) => g.name === depGroup.name
|
|
3926
|
+
);
|
|
3927
|
+
if (!groupAlreadyExists) {
|
|
3928
|
+
additionalGroups.set(depGroup.name, depGroup);
|
|
3929
|
+
}
|
|
3930
|
+
}
|
|
3931
|
+
}
|
|
3932
|
+
}
|
|
3933
|
+
nextLevel.push(dep);
|
|
3934
|
+
}
|
|
3935
|
+
currentLevel = nextLevel;
|
|
3936
|
+
}
|
|
3937
|
+
dependentsToProcess.forEach((dep) => this.allProjectsToProcess.add(dep));
|
|
3938
|
+
additionalGroups.forEach((group) => {
|
|
3939
|
+
const groupForDependents = {
|
|
3940
|
+
...group,
|
|
3941
|
+
versionPlans: false,
|
|
3942
|
+
resolvedVersionPlans: false
|
|
3943
|
+
};
|
|
3944
|
+
this.releaseGroups.push(groupForDependents);
|
|
3945
|
+
const projectsInGroup = new Set(
|
|
3946
|
+
group.projects.filter((p) => dependentsToProcess.has(p))
|
|
3947
|
+
);
|
|
3948
|
+
this.releaseGroupToFilteredProjects.set(
|
|
3949
|
+
groupForDependents,
|
|
3950
|
+
projectsInGroup
|
|
3951
|
+
);
|
|
3952
|
+
});
|
|
3953
|
+
}
|
|
3954
|
+
/**
|
|
3955
|
+
* Generate user-friendly log describing what the filter matched
|
|
3956
|
+
*/
|
|
3957
|
+
generateFilterLog() {
|
|
3958
|
+
if (this.filters.projects?.length) {
|
|
3959
|
+
const matchedProjects = Array.from(this.originalFilteredProjects);
|
|
3960
|
+
this.filterLog = {
|
|
3961
|
+
title: `Your filter "${this.filters.projects.join(
|
|
3962
|
+
","
|
|
3963
|
+
)}" matched the following projects:`,
|
|
3964
|
+
bodyLines: matchedProjects.map((p) => {
|
|
3965
|
+
const releaseGroupForProject = this.projectToReleaseGroup.get(p);
|
|
3966
|
+
if (!releaseGroupForProject || releaseGroupForProject.name === config$1.IMPLICIT_DEFAULT_RELEASE_GROUP) {
|
|
3967
|
+
return `- ${p}`;
|
|
3968
|
+
}
|
|
3969
|
+
return `- ${p} (release group "${releaseGroupForProject.name}")`;
|
|
3970
|
+
})
|
|
3971
|
+
};
|
|
3972
|
+
}
|
|
3973
|
+
}
|
|
3974
|
+
/**
|
|
3975
|
+
* Build the group graph structure
|
|
3976
|
+
*/
|
|
3977
|
+
buildGroupGraphStructure() {
|
|
3978
|
+
for (const group of this.releaseGroups) {
|
|
3979
|
+
if (!this.groupGraph.has(group.name)) {
|
|
3980
|
+
this.groupGraph.set(group.name, {
|
|
3981
|
+
group,
|
|
3982
|
+
dependencies: /* @__PURE__ */ new Set(),
|
|
3983
|
+
dependents: /* @__PURE__ */ new Set()
|
|
3984
|
+
});
|
|
3985
|
+
}
|
|
3986
|
+
}
|
|
3987
|
+
}
|
|
3988
|
+
/**
|
|
3989
|
+
* Resolve current versions for all projects that will be processed
|
|
3990
|
+
*/
|
|
3991
|
+
async resolveCurrentVersionsForProjects(tree, projectGraph, preid) {
|
|
3992
|
+
for (const [, releaseGroupNode] of this.groupGraph) {
|
|
3993
|
+
for (const projectName of releaseGroupNode.group.projects) {
|
|
3994
|
+
const projectGraphNode = projectGraph.nodes[projectName];
|
|
3995
|
+
if (!this.allProjectsToProcess.has(projectName)) {
|
|
3996
|
+
continue;
|
|
3997
|
+
}
|
|
3998
|
+
const versionActions = this.projectsToVersionActions.get(projectName);
|
|
3999
|
+
const finalConfigForProject = this.finalConfigsByProject.get(projectName);
|
|
4000
|
+
let latestMatchingGitTag;
|
|
4001
|
+
const releaseTagPattern = releaseGroupNode.group.releaseTag.pattern;
|
|
4002
|
+
if (finalConfigForProject.currentVersionResolver === "git-tag") {
|
|
4003
|
+
const additionalInterpolationData = {
|
|
4004
|
+
projectName: git.sanitizeProjectNameForGitTag(projectGraphNode.name),
|
|
4005
|
+
releaseGroupName: releaseGroupNode.group.name
|
|
4006
|
+
};
|
|
4007
|
+
const options = {
|
|
4008
|
+
checkAllBranchesWhen: releaseGroupNode.group.releaseTag.checkAllBranchesWhen,
|
|
4009
|
+
preid,
|
|
4010
|
+
requireSemver: releaseGroupNode.group.releaseTag.requireSemver,
|
|
4011
|
+
strictPreid: releaseGroupNode.group.releaseTag.strictPreid
|
|
4012
|
+
};
|
|
4013
|
+
if (releaseGroupNode.group.projectsRelationship === "fixed" && !releaseTagPattern.includes("{projectName}")) {
|
|
4014
|
+
const groupReleaseTag = await git.getLatestGitTagForPattern(
|
|
4015
|
+
releaseTagPattern,
|
|
4016
|
+
additionalInterpolationData,
|
|
4017
|
+
this.resolveRepositoryTags.bind(this),
|
|
4018
|
+
options
|
|
4019
|
+
);
|
|
4020
|
+
const projectReleaseTag = await git.getLatestGitTagForPattern(
|
|
4021
|
+
releaseTagPattern.includes("{releaseGroupName}") ? releaseTagPattern.replace(
|
|
4022
|
+
/\{releaseGroupName\}/g,
|
|
4023
|
+
"{projectName}"
|
|
4024
|
+
) : `{projectName}@${releaseTagPattern}`,
|
|
4025
|
+
additionalInterpolationData,
|
|
4026
|
+
this.resolveRepositoryTags.bind(this),
|
|
4027
|
+
options
|
|
4028
|
+
);
|
|
4029
|
+
if (projectReleaseTag?.extractedVersion && groupReleaseTag?.extractedVersion && gte__default.default(
|
|
4030
|
+
projectReleaseTag.extractedVersion,
|
|
4031
|
+
groupReleaseTag.extractedVersion
|
|
4032
|
+
)) {
|
|
4033
|
+
latestMatchingGitTag = projectReleaseTag;
|
|
4034
|
+
} else {
|
|
4035
|
+
latestMatchingGitTag = groupReleaseTag;
|
|
4036
|
+
}
|
|
4037
|
+
} else {
|
|
4038
|
+
latestMatchingGitTag = await git.getLatestGitTagForPattern(
|
|
4039
|
+
releaseTagPattern,
|
|
4040
|
+
additionalInterpolationData,
|
|
4041
|
+
this.resolveRepositoryTags.bind(this),
|
|
4042
|
+
options
|
|
4043
|
+
);
|
|
4044
|
+
}
|
|
4045
|
+
this.cachedLatestMatchingGitTag.set(
|
|
4046
|
+
projectName,
|
|
4047
|
+
latestMatchingGitTag
|
|
4048
|
+
);
|
|
4049
|
+
const currentVersion = await resolveCurrentVersion.resolveCurrentVersion(
|
|
4050
|
+
tree,
|
|
4051
|
+
projectGraphNode,
|
|
4052
|
+
releaseGroupNode.group,
|
|
4053
|
+
versionActions,
|
|
4054
|
+
this.projectLoggers.get(projectName),
|
|
4055
|
+
this.currentVersionsPerFixedReleaseGroup,
|
|
4056
|
+
finalConfigForProject,
|
|
4057
|
+
releaseTagPattern,
|
|
4058
|
+
latestMatchingGitTag
|
|
4059
|
+
);
|
|
4060
|
+
this.cachedCurrentVersions.set(projectName, currentVersion);
|
|
4061
|
+
}
|
|
4062
|
+
}
|
|
4063
|
+
}
|
|
4064
|
+
}
|
|
4065
|
+
/**
|
|
4066
|
+
* Build dependency relationships between release groups
|
|
4067
|
+
*/
|
|
4068
|
+
buildGroupDependencyGraph() {
|
|
4069
|
+
for (const [releaseGroupName, releaseGroupNode] of this.groupGraph) {
|
|
4070
|
+
for (const projectName of releaseGroupNode.group.projects) {
|
|
4071
|
+
const projectDeps = this.getProjectDependencies(projectName);
|
|
4072
|
+
for (const dep of projectDeps) {
|
|
4073
|
+
const dependencyGroup = this.getReleaseGroupNameForProject(dep);
|
|
4074
|
+
if (dependencyGroup && dependencyGroup !== releaseGroupName) {
|
|
4075
|
+
releaseGroupNode.dependencies.add(dependencyGroup);
|
|
4076
|
+
const dependencyGroupNode = this.groupGraph.get(dependencyGroup);
|
|
4077
|
+
if (dependencyGroupNode) {
|
|
4078
|
+
dependencyGroupNode.dependents.add(releaseGroupName);
|
|
4079
|
+
}
|
|
4080
|
+
}
|
|
4081
|
+
}
|
|
4082
|
+
}
|
|
4083
|
+
}
|
|
4084
|
+
}
|
|
4085
|
+
/**
|
|
4086
|
+
* Topologically sort release groups
|
|
4087
|
+
*/
|
|
4088
|
+
topologicallySortReleaseGroups() {
|
|
4089
|
+
const groupNames = Array.from(this.groupGraph.keys());
|
|
4090
|
+
const getGroupDependencies = (groupName) => {
|
|
4091
|
+
const groupNode = this.groupGraph.get(groupName);
|
|
4092
|
+
if (!groupNode) {
|
|
4093
|
+
return [];
|
|
4094
|
+
}
|
|
4095
|
+
return Array.from(groupNode.dependencies);
|
|
4096
|
+
};
|
|
4097
|
+
return topologicalSort.topologicalSort(groupNames, getGroupDependencies);
|
|
4098
|
+
}
|
|
4099
|
+
/**
|
|
4100
|
+
* Topologically sort projects within a release group
|
|
4101
|
+
*/
|
|
4102
|
+
topologicallySortProjects(releaseGroup) {
|
|
4103
|
+
const projects = releaseGroup.projects.filter(
|
|
4104
|
+
(p) => this.allProjectsToProcess.has(p)
|
|
4105
|
+
);
|
|
4106
|
+
const getProjectDependenciesInSameGroup = (project) => {
|
|
4107
|
+
const deps = this.getProjectDependencies(project);
|
|
4108
|
+
return Array.from(deps).filter(
|
|
4109
|
+
(dep) => this.getReleaseGroupNameForProject(dep) === releaseGroup.name && this.allProjectsToProcess.has(dep)
|
|
4110
|
+
);
|
|
4111
|
+
};
|
|
4112
|
+
return topologicalSort.topologicalSort(projects, getProjectDependenciesInSameGroup);
|
|
4113
|
+
}
|
|
4114
|
+
async populateDependentProjectsData(tree, projectGraph) {
|
|
4115
|
+
for (const projectName of this.allProjectsToProcess) {
|
|
4116
|
+
const dependentProjectNames = Array.from(
|
|
4117
|
+
this.getProjectDependents(projectName)
|
|
4118
|
+
).filter((dep) => this.allProjectsConfiguredForNxRelease.has(dep));
|
|
4119
|
+
const dependentProjectsData = [];
|
|
4120
|
+
for (const dependentProjectName of dependentProjectNames) {
|
|
4121
|
+
const versionActions = this.projectsToVersionActions.get(dependentProjectName);
|
|
4122
|
+
const { currentVersion, dependencyCollection } = await versionActions.readCurrentVersionOfDependency(
|
|
4123
|
+
tree,
|
|
4124
|
+
projectGraph,
|
|
4125
|
+
projectName
|
|
4126
|
+
);
|
|
4127
|
+
dependentProjectsData.push({
|
|
4128
|
+
source: dependentProjectName,
|
|
4129
|
+
target: projectName,
|
|
4130
|
+
type: "static",
|
|
4131
|
+
dependencyCollection,
|
|
4132
|
+
rawVersionSpec: currentVersion
|
|
4133
|
+
});
|
|
4134
|
+
}
|
|
4135
|
+
this.originalDependentProjectsPerProject.set(
|
|
4136
|
+
projectName,
|
|
4137
|
+
dependentProjectsData
|
|
4138
|
+
);
|
|
4139
|
+
}
|
|
4140
|
+
}
|
|
4141
|
+
/**
|
|
4142
|
+
* Get all non-implicit dependents for a set of projects
|
|
4143
|
+
*/
|
|
4144
|
+
getAllNonImplicitDependents(projects) {
|
|
4145
|
+
return projects.flatMap((project) => Array.from(this.getProjectDependents(project))).filter((dep) => !this.allProjectsToProcess.has(dep));
|
|
4146
|
+
}
|
|
4147
|
+
/**
|
|
4148
|
+
* Resolve final configuration for a project
|
|
4149
|
+
*
|
|
4150
|
+
* NOTE: We are providing ultimate fallback values via ?? here mainly just to keep TypeScript happy.
|
|
4151
|
+
* All default values should have been applied by this point by config.ts but the types can't know
|
|
4152
|
+
* that for sure at this point.
|
|
4153
|
+
*/
|
|
4154
|
+
static resolveFinalConfigForProject(releaseGroup, projectGraphNode, firstRelease, versionActionsOptionsOverrides) {
|
|
4155
|
+
const releaseGroupVersionConfig = releaseGroup.version;
|
|
4156
|
+
const projectVersionConfig = projectGraphNode.data.release?.version;
|
|
4157
|
+
const projectDockerConfig = projectGraphNode.data.release?.docker;
|
|
4158
|
+
const specifierSource = projectVersionConfig?.specifierSource ?? releaseGroupVersionConfig?.specifierSource ?? "prompt";
|
|
4159
|
+
const versionPrefix = projectVersionConfig?.versionPrefix ?? releaseGroupVersionConfig?.versionPrefix ?? "auto";
|
|
4160
|
+
if (versionPrefix && !validReleaseVersionPrefixes.includes(versionPrefix)) {
|
|
4161
|
+
throw new Error(
|
|
4162
|
+
`Invalid value for versionPrefix: "${versionPrefix}"
|
|
4163
|
+
|
|
4164
|
+
Valid values are: ${validReleaseVersionPrefixes.map((s) => `"${s}"`).join(", ")}`
|
|
4165
|
+
);
|
|
4166
|
+
}
|
|
4167
|
+
const dockerOptions = Object.assign(
|
|
4168
|
+
{},
|
|
4169
|
+
releaseGroup.docker || {},
|
|
4170
|
+
projectDockerConfig || {}
|
|
4171
|
+
);
|
|
4172
|
+
let currentVersionResolver = projectVersionConfig?.currentVersionResolver ?? releaseGroupVersionConfig?.currentVersionResolver ?? "disk";
|
|
4173
|
+
const shouldSkip = shared.shouldSkipVersionActions(
|
|
4174
|
+
dockerOptions,
|
|
4175
|
+
projectGraphNode.name
|
|
4176
|
+
);
|
|
4177
|
+
if (shouldSkip) {
|
|
4178
|
+
currentVersionResolver = "none";
|
|
4179
|
+
} else if (specifierSource === "conventional-commits" && currentVersionResolver !== "git-tag") {
|
|
4180
|
+
throw new Error(
|
|
4181
|
+
`Invalid currentVersionResolver "${currentVersionResolver}" provided for project "${projectGraphNode.name}". Must be "git-tag" when "specifierSource" is "conventional-commits"`
|
|
4182
|
+
);
|
|
4183
|
+
}
|
|
4184
|
+
const currentVersionResolverMetadata = projectVersionConfig?.currentVersionResolverMetadata ?? releaseGroupVersionConfig?.currentVersionResolverMetadata ?? {};
|
|
4185
|
+
const preserveLocalDependencyProtocols = projectVersionConfig?.preserveLocalDependencyProtocols ?? releaseGroupVersionConfig?.preserveLocalDependencyProtocols ?? true;
|
|
4186
|
+
const preserveMatchingDependencyRanges = projectVersionConfig?.preserveMatchingDependencyRanges ?? releaseGroupVersionConfig?.preserveMatchingDependencyRanges ?? true;
|
|
4187
|
+
const adjustSemverBumpsForZeroMajorVersion = projectVersionConfig?.adjustSemverBumpsForZeroMajorVersion ?? releaseGroupVersionConfig?.adjustSemverBumpsForZeroMajorVersion ?? true;
|
|
4188
|
+
const applyPreidToDependents = projectVersionConfig?.applyPreidToDependents ?? releaseGroupVersionConfig?.applyPreidToDependents ?? false;
|
|
4189
|
+
const fallbackCurrentVersionResolver = projectVersionConfig?.fallbackCurrentVersionResolver ?? releaseGroupVersionConfig?.fallbackCurrentVersionResolver ?? (firstRelease ? "disk" : void 0);
|
|
4190
|
+
let versionActionsOptions = projectVersionConfig?.versionActionsOptions ?? releaseGroupVersionConfig?.versionActionsOptions ?? {};
|
|
4191
|
+
versionActionsOptions = {
|
|
4192
|
+
...versionActionsOptions,
|
|
4193
|
+
...versionActionsOptionsOverrides ?? {}
|
|
4194
|
+
};
|
|
4195
|
+
const manifestRootsToUpdate = (projectVersionConfig?.manifestRootsToUpdate ?? releaseGroupVersionConfig?.manifestRootsToUpdate ?? []).map((manifestRoot) => {
|
|
4196
|
+
if (typeof manifestRoot === "string") {
|
|
4197
|
+
return {
|
|
4198
|
+
path: manifestRoot,
|
|
4199
|
+
// Apply the project level preserveLocalDependencyProtocols setting that was already resolved
|
|
4200
|
+
preserveLocalDependencyProtocols
|
|
4201
|
+
};
|
|
4202
|
+
}
|
|
4203
|
+
return manifestRoot;
|
|
4204
|
+
});
|
|
4205
|
+
return {
|
|
4206
|
+
specifierSource,
|
|
4207
|
+
currentVersionResolver,
|
|
4208
|
+
currentVersionResolverMetadata,
|
|
4209
|
+
fallbackCurrentVersionResolver,
|
|
4210
|
+
versionPrefix,
|
|
4211
|
+
preserveLocalDependencyProtocols,
|
|
4212
|
+
preserveMatchingDependencyRanges,
|
|
4213
|
+
adjustSemverBumpsForZeroMajorVersion,
|
|
4214
|
+
applyPreidToDependents,
|
|
4215
|
+
versionActionsOptions,
|
|
4216
|
+
manifestRootsToUpdate,
|
|
4217
|
+
dockerOptions
|
|
4218
|
+
};
|
|
4219
|
+
}
|
|
4220
|
+
/**
|
|
4221
|
+
* Get the release group for a given project
|
|
4222
|
+
*/
|
|
4223
|
+
getReleaseGroupForProject(projectName) {
|
|
4224
|
+
return this.projectToReleaseGroup.get(projectName);
|
|
4225
|
+
}
|
|
4226
|
+
/**
|
|
4227
|
+
* Get the release group name for a given project
|
|
4228
|
+
*/
|
|
4229
|
+
getReleaseGroupNameForProject(projectName) {
|
|
4230
|
+
const group = this.projectToReleaseGroup.get(projectName);
|
|
4231
|
+
return group ? group.name : null;
|
|
4232
|
+
}
|
|
4233
|
+
/**
|
|
4234
|
+
* Get the dependencies of a project
|
|
4235
|
+
*/
|
|
4236
|
+
getProjectDependencies(projectName) {
|
|
4237
|
+
return this.projectToDependencies.get(projectName) || /* @__PURE__ */ new Set();
|
|
4238
|
+
}
|
|
4239
|
+
/**
|
|
4240
|
+
* Get the dependents of a project (projects that depend on it)
|
|
4241
|
+
*/
|
|
4242
|
+
getProjectDependents(projectName) {
|
|
4243
|
+
return this.projectToDependents.get(projectName) || /* @__PURE__ */ new Set();
|
|
4244
|
+
}
|
|
4245
|
+
/**
|
|
4246
|
+
* Get the version actions for a project
|
|
4247
|
+
*/
|
|
4248
|
+
getVersionActionsForProject(projectName) {
|
|
4249
|
+
return this.projectsToVersionActions.get(projectName);
|
|
4250
|
+
}
|
|
4251
|
+
/**
|
|
4252
|
+
* Check if a project will be processed
|
|
4253
|
+
*/
|
|
4254
|
+
isProjectToProcess(projectName) {
|
|
4255
|
+
return this.allProjectsToProcess.has(projectName);
|
|
4256
|
+
}
|
|
4257
|
+
async resolveAffectedFilesPerCommitInProjectGraph(commit, projectGraph) {
|
|
4258
|
+
const { shortHash } = commit;
|
|
4259
|
+
let affectedGraph = this.affectedGraphPerCommit.get(shortHash);
|
|
4260
|
+
if (affectedGraph) {
|
|
4261
|
+
return affectedGraph;
|
|
4262
|
+
}
|
|
4263
|
+
const touchedFiles = fileUtils.calculateFileChanges(commit.affectedFiles, {
|
|
4264
|
+
base: `${commit.shortHash}^`,
|
|
4265
|
+
head: commit.shortHash
|
|
4266
|
+
});
|
|
4267
|
+
affectedGraph = await affectedProjectGraph.filterAffected(projectGraph, touchedFiles);
|
|
4268
|
+
this.affectedGraphPerCommit.set(shortHash, affectedGraph);
|
|
4269
|
+
return affectedGraph;
|
|
4270
|
+
}
|
|
4271
|
+
async resolveRepositoryTags(resolveTagsWhen) {
|
|
4272
|
+
return this.repositoryGitTags.resolveTags(resolveTagsWhen);
|
|
4273
|
+
}
|
|
4274
|
+
/**
|
|
4275
|
+
* Runs validation on resolved VersionActions instances. E.g. check that manifest files exist for all projects that will be processed.
|
|
4276
|
+
* This should be called after preVersionCommand has run, as those commands may create manifest files that are needed for versioning.
|
|
4277
|
+
*/
|
|
4278
|
+
async validate(tree) {
|
|
4279
|
+
const validationPromises = [];
|
|
4280
|
+
for (const projectName of this.allProjectsToProcess) {
|
|
4281
|
+
const versionActions = this.projectsToVersionActions.get(projectName);
|
|
4282
|
+
if (versionActions) {
|
|
4283
|
+
validationPromises.push(versionActions.validate(tree));
|
|
4284
|
+
}
|
|
4285
|
+
}
|
|
4286
|
+
await Promise.all(validationPromises);
|
|
4287
|
+
}
|
|
4288
|
+
};
|
|
4289
|
+
async function createReleaseGraph(options) {
|
|
4290
|
+
const releaseGroups = Object.entries(
|
|
4291
|
+
options.nxReleaseConfig.groups ?? {}
|
|
4292
|
+
).map(([name, group]) => {
|
|
4293
|
+
return {
|
|
4294
|
+
...group,
|
|
4295
|
+
name,
|
|
4296
|
+
resolvedVersionPlans: group.versionPlans ? [] : false
|
|
4297
|
+
};
|
|
4298
|
+
});
|
|
4299
|
+
const graph = new ReleaseGraph(releaseGroups, options.filters);
|
|
4300
|
+
await graph.init(options);
|
|
4301
|
+
return graph;
|
|
4302
|
+
}
|
|
4303
|
+
var StormReleaseGroupProcessor = class _StormReleaseGroupProcessor extends releaseGroupProcessor.ReleaseGroupProcessor {
|
|
3616
4304
|
constructor(tree, workspaceConfig, projectGraph, nxReleaseConfig, releaseGraph, versionOptions) {
|
|
3617
4305
|
super(tree, projectGraph, nxReleaseConfig, releaseGraph, {
|
|
3618
4306
|
dryRun: !!versionOptions.dryRun,
|
|
@@ -3633,6 +4321,16 @@ var StormReleaseGroupProcessor = class extends releaseGroupProcessor.ReleaseGrou
|
|
|
3633
4321
|
this.#nxReleaseConfig = nxReleaseConfig;
|
|
3634
4322
|
this.#releaseGraph = releaseGraph;
|
|
3635
4323
|
}
|
|
4324
|
+
static #BUMP_TYPE_PRIORITY = {
|
|
4325
|
+
major: 8,
|
|
4326
|
+
premajor: 7,
|
|
4327
|
+
minor: 6,
|
|
4328
|
+
preminor: 5,
|
|
4329
|
+
patch: 4,
|
|
4330
|
+
prepatch: 3,
|
|
4331
|
+
prerelease: 2,
|
|
4332
|
+
none: 1
|
|
4333
|
+
};
|
|
3636
4334
|
#tree;
|
|
3637
4335
|
#projectGraph;
|
|
3638
4336
|
#nxReleaseConfig;
|
|
@@ -3817,45 +4515,54 @@ var StormReleaseGroupProcessor = class extends releaseGroupProcessor.ReleaseGrou
|
|
|
3817
4515
|
return false;
|
|
3818
4516
|
}
|
|
3819
4517
|
let bumped = false;
|
|
3820
|
-
const
|
|
4518
|
+
const fixedGroup = {
|
|
4519
|
+
firstProject: null,
|
|
4520
|
+
newVersion: null,
|
|
4521
|
+
currentVersion: null
|
|
4522
|
+
};
|
|
4523
|
+
for (const project of releaseGroup.projects) {
|
|
3821
4524
|
const currentVersion = this.#getCurrentCachedVersionForProject(project);
|
|
3822
4525
|
if (!currentVersion) {
|
|
3823
4526
|
chunkOOFHIS6Q_cjs.writeTrace(
|
|
3824
4527
|
`No current version found for project ${project} in release group ${releaseGroup.name}, skipping version comparison.`,
|
|
3825
4528
|
this.workspaceConfig
|
|
3826
4529
|
);
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
chunkOOFHIS6Q_cjs.writeTrace(
|
|
3831
|
-
`Defaulting to first version ${currentVersion} (project: ${project})`,
|
|
3832
|
-
this.workspaceConfig
|
|
3833
|
-
);
|
|
3834
|
-
return project;
|
|
3835
|
-
}
|
|
3836
|
-
const largestVersion = this.#getCurrentCachedVersionForProject(ret);
|
|
3837
|
-
if (!largestVersion) {
|
|
3838
|
-
chunkOOFHIS6Q_cjs.writeTrace(
|
|
3839
|
-
`No current version found for project ${ret} in release group ${releaseGroup.name}, skipping version comparison.`,
|
|
4530
|
+
} else {
|
|
4531
|
+
chunkOOFHIS6Q_cjs.writeDebug(
|
|
4532
|
+
`Comparing versions for fixed group ${releaseGroup.name}: Current Greatest Version: ${fixedGroup.currentVersion || "none"}, Current Project Version: ${currentVersion} (project: ${project})`,
|
|
3840
4533
|
this.workspaceConfig
|
|
3841
4534
|
);
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
this
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
4535
|
+
const {
|
|
4536
|
+
newVersionInput,
|
|
4537
|
+
newVersionInputReason,
|
|
4538
|
+
newVersionInputReasonData
|
|
4539
|
+
} = await this.#determineVersionBumpForProject(releaseGroup, project);
|
|
4540
|
+
if (!fixedGroup.currentVersion || currentVersion && semver__default.default.gt(currentVersion, fixedGroup.currentVersion) || !fixedGroup.newVersion || fixedGroup.newVersion.input === "none" || this.#isHigherPriorityBumpType(
|
|
4541
|
+
newVersionInput,
|
|
4542
|
+
fixedGroup.newVersion?.input
|
|
4543
|
+
)) {
|
|
4544
|
+
if (!fixedGroup.currentVersion || currentVersion && semver__default.default.gt(currentVersion, fixedGroup.currentVersion)) {
|
|
4545
|
+
fixedGroup.currentVersion = currentVersion;
|
|
4546
|
+
}
|
|
4547
|
+
if (!fixedGroup.newVersion || fixedGroup.newVersion.input === "none" || this.#isHigherPriorityBumpType(
|
|
4548
|
+
newVersionInput,
|
|
4549
|
+
fixedGroup.newVersion?.input
|
|
4550
|
+
)) {
|
|
4551
|
+
fixedGroup.newVersion = {
|
|
4552
|
+
input: newVersionInput,
|
|
4553
|
+
reason: newVersionInputReason,
|
|
4554
|
+
reasonData: newVersionInputReasonData
|
|
4555
|
+
};
|
|
4556
|
+
}
|
|
4557
|
+
chunkOOFHIS6Q_cjs.writeDebug(
|
|
4558
|
+
`Fixed release group ${releaseGroup.name} updated: Current Version: ${fixedGroup.currentVersion || "none"}, New Version: ${fixedGroup.newVersion?.input || "none"} (first project: ${project})`,
|
|
4559
|
+
this.workspaceConfig
|
|
4560
|
+
);
|
|
4561
|
+
fixedGroup.firstProject = project;
|
|
4562
|
+
}
|
|
3850
4563
|
}
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
const {
|
|
3854
|
-
newVersionInput,
|
|
3855
|
-
newVersionInputReason,
|
|
3856
|
-
newVersionInputReasonData
|
|
3857
|
-
} = await this.#determineVersionBumpForProject(releaseGroup, firstProject);
|
|
3858
|
-
if (newVersionInput === "none") {
|
|
4564
|
+
}
|
|
4565
|
+
if (fixedGroup.newVersion?.input === "none") {
|
|
3859
4566
|
let bumpedByDependency = false;
|
|
3860
4567
|
const sortedProjects2 = this.#releaseGraph.sortedProjects.get(releaseGroup.name) || [];
|
|
3861
4568
|
for (const project of sortedProjects2) {
|
|
@@ -3905,22 +4612,22 @@ var StormReleaseGroupProcessor = class extends releaseGroupProcessor.ReleaseGrou
|
|
|
3905
4612
|
dockerVersion: null,
|
|
3906
4613
|
dependentProjects: this.#getOriginalDependentProjects(project)
|
|
3907
4614
|
});
|
|
3908
|
-
if (project === firstProject) {
|
|
4615
|
+
if (project === fixedGroup.firstProject) {
|
|
3909
4616
|
continue;
|
|
3910
4617
|
}
|
|
3911
4618
|
const projectLogger = this.#getProjectLoggerForProject(project);
|
|
3912
4619
|
projectLogger.buffer(
|
|
3913
|
-
`\u{1F6AB} Skipping versioning for ${project} as it is a part of a fixed release group with ${firstProject} and no dependency bumps were detected`
|
|
4620
|
+
`\u{1F6AB} Skipping versioning for ${project} as it is a part of a fixed release group with ${fixedGroup.firstProject} and no dependency bumps were detected`
|
|
3914
4621
|
);
|
|
3915
4622
|
}
|
|
3916
4623
|
}
|
|
3917
4624
|
return bumpedByDependency;
|
|
3918
4625
|
}
|
|
3919
4626
|
const { newVersion } = await this.#calculateNewVersion(
|
|
3920
|
-
firstProject,
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
4627
|
+
fixedGroup.firstProject,
|
|
4628
|
+
fixedGroup.newVersion?.input ?? "none",
|
|
4629
|
+
fixedGroup.newVersion.reason,
|
|
4630
|
+
fixedGroup.newVersion?.reasonData ?? {}
|
|
3924
4631
|
);
|
|
3925
4632
|
const sortedProjects = this.#releaseGraph.sortedProjects.get(releaseGroup.name) || releaseGroup.projects;
|
|
3926
4633
|
for (const project of sortedProjects) {
|
|
@@ -3929,9 +4636,9 @@ var StormReleaseGroupProcessor = class extends releaseGroupProcessor.ReleaseGrou
|
|
|
3929
4636
|
const currentVersion = this.#getCurrentCachedVersionForProject(
|
|
3930
4637
|
project
|
|
3931
4638
|
);
|
|
3932
|
-
if (project !== firstProject) {
|
|
4639
|
+
if (project !== fixedGroup.firstProject) {
|
|
3933
4640
|
projectLogger.buffer(
|
|
3934
|
-
`\u2753 Applied version ${newVersion} directly, because the project is a member of a fixed release group containing ${firstProject}`
|
|
4641
|
+
`\u2753 Applied version ${newVersion} directly, because the project is a member of a fixed release group containing ${fixedGroup.firstProject}`
|
|
3935
4642
|
);
|
|
3936
4643
|
}
|
|
3937
4644
|
const logMessages = await versionActions.updateProjectVersion(
|
|
@@ -4115,6 +4822,17 @@ var StormReleaseGroupProcessor = class extends releaseGroupProcessor.ReleaseGrou
|
|
|
4115
4822
|
}
|
|
4116
4823
|
return bumped;
|
|
4117
4824
|
}
|
|
4825
|
+
#isHigherPriorityBumpType(candidate, current) {
|
|
4826
|
+
const candidatePriority = _StormReleaseGroupProcessor.#BUMP_TYPE_PRIORITY[candidate];
|
|
4827
|
+
const currentPriority = _StormReleaseGroupProcessor.#BUMP_TYPE_PRIORITY[current];
|
|
4828
|
+
if (candidatePriority === void 0) {
|
|
4829
|
+
return false;
|
|
4830
|
+
}
|
|
4831
|
+
if (currentPriority === void 0) {
|
|
4832
|
+
return true;
|
|
4833
|
+
}
|
|
4834
|
+
return candidatePriority > currentPriority;
|
|
4835
|
+
}
|
|
4118
4836
|
#getCurrentCachedVersionForProject(projectName) {
|
|
4119
4837
|
return this.#releaseGraph.cachedCurrentVersions.get(projectName) || null;
|
|
4120
4838
|
}
|
|
@@ -4370,7 +5088,7 @@ ${formatConfigLog(config5)}`,
|
|
|
4370
5088
|
v.newVersion ? extractPreid(v.newVersion) : void 0
|
|
4371
5089
|
])
|
|
4372
5090
|
);
|
|
4373
|
-
const releaseGraph
|
|
5091
|
+
const releaseGraph = await createReleaseGraph({
|
|
4374
5092
|
tree: this.tree,
|
|
4375
5093
|
projectGraph: this.projectGraph,
|
|
4376
5094
|
nxReleaseConfig: this.releaseConfig,
|
|
@@ -4382,7 +5100,7 @@ ${formatConfigLog(config5)}`,
|
|
|
4382
5100
|
verbose: chunkOOFHIS6Q_cjs.isVerbose(this.workspaceConfig.logLevel)
|
|
4383
5101
|
});
|
|
4384
5102
|
const projectToAdditionalDependencyBumps = /* @__PURE__ */ new Map();
|
|
4385
|
-
for (const releaseGroup of releaseGraph
|
|
5103
|
+
for (const releaseGroup of releaseGraph.releaseGroups) {
|
|
4386
5104
|
if (releaseGroup.projectsRelationship !== "independent") {
|
|
4387
5105
|
continue;
|
|
4388
5106
|
}
|
|
@@ -4410,12 +5128,12 @@ ${formatConfigLog(config5)}`,
|
|
|
4410
5128
|
}
|
|
4411
5129
|
}
|
|
4412
5130
|
const allProjectChangelogs = {};
|
|
4413
|
-
for (const releaseGroup of releaseGraph
|
|
5131
|
+
for (const releaseGroup of releaseGraph.releaseGroups) {
|
|
4414
5132
|
const config5 = releaseGroup.changelog;
|
|
4415
5133
|
if (config5 === false) {
|
|
4416
5134
|
continue;
|
|
4417
5135
|
}
|
|
4418
|
-
if (!releaseGraph
|
|
5136
|
+
if (!releaseGraph.releaseGroupToFilteredProjects.has(releaseGroup)) {
|
|
4419
5137
|
throw new Error(
|
|
4420
5138
|
`No filtered projects found for release group ${releaseGroup.name}`
|
|
4421
5139
|
);
|
|
@@ -4424,7 +5142,7 @@ ${formatConfigLog(config5)}`,
|
|
|
4424
5142
|
// If the user has passed a list of projects, we need to use the filtered list of projects within the release group, plus any dependents
|
|
4425
5143
|
Array.from(
|
|
4426
5144
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
4427
|
-
releaseGraph
|
|
5145
|
+
releaseGraph.releaseGroupToFilteredProjects.get(releaseGroup)
|
|
4428
5146
|
).flatMap((project) => {
|
|
4429
5147
|
return [
|
|
4430
5148
|
project,
|
|
@@ -4447,7 +5165,7 @@ ${formatConfigLog(config5)}`,
|
|
|
4447
5165
|
projectName: project.name,
|
|
4448
5166
|
releaseGroupName: releaseGroup.name
|
|
4449
5167
|
},
|
|
4450
|
-
releaseGraph
|
|
5168
|
+
releaseGraph.resolveRepositoryTags.bind(releaseGraph),
|
|
4451
5169
|
{
|
|
4452
5170
|
checkAllBranchesWhen: releaseGroup.releaseTag.checkAllBranchesWhen,
|
|
4453
5171
|
preid: projectsPreid[project.name] || this.workspaceConfig.preid,
|
|
@@ -4541,7 +5259,7 @@ ${formatConfigLog(config5)}`,
|
|
|
4541
5259
|
{
|
|
4542
5260
|
releaseGroupName: releaseGroup.name
|
|
4543
5261
|
},
|
|
4544
|
-
releaseGraph
|
|
5262
|
+
releaseGraph.resolveRepositoryTags.bind(releaseGraph),
|
|
4545
5263
|
{
|
|
4546
5264
|
checkAllBranchesWhen: releaseGroup.releaseTag.checkAllBranchesWhen,
|
|
4547
5265
|
preid: Object.keys(projectsPreid)[0] && projectsPreid?.[Object.keys(projectsPreid)[0]] ? projectsPreid?.[Object.keys(projectsPreid)[0]] : this.workspaceConfig.preid,
|
|
@@ -4699,7 +5417,7 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
|
|
|
4699
5417
|
"Failed to load the project graph. Please run `nx reset`, then run the `storm-git commit` command again."
|
|
4700
5418
|
);
|
|
4701
5419
|
}
|
|
4702
|
-
const releaseGraph
|
|
5420
|
+
const releaseGraph = await createReleaseGraph({
|
|
4703
5421
|
tree: this.tree,
|
|
4704
5422
|
projectGraph: this.projectGraph,
|
|
4705
5423
|
nxReleaseConfig: this.releaseConfig,
|
|
@@ -4712,26 +5430,26 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
|
|
|
4712
5430
|
preid: options.preid ?? this.workspaceConfig.preid,
|
|
4713
5431
|
versionActionsOptionsOverrides: options.versionActionsOptionsOverrides
|
|
4714
5432
|
});
|
|
4715
|
-
if (releaseGraph
|
|
4716
|
-
chunkOOFHIS6Q_cjs.writeDebug(formatNxLog(releaseGraph
|
|
5433
|
+
if (releaseGraph.filterLog && process.env.NX_RELEASE_INTERNAL_SUPPRESS_FILTER_LOG !== "true") {
|
|
5434
|
+
chunkOOFHIS6Q_cjs.writeDebug(formatNxLog(releaseGraph.filterLog), this.workspaceConfig);
|
|
4717
5435
|
}
|
|
4718
5436
|
if (!options.specifier) {
|
|
4719
5437
|
const rawVersionPlans = await versionPlans.readRawVersionPlans();
|
|
4720
5438
|
await versionPlans.setResolvedVersionPlansOnGroups(
|
|
4721
5439
|
rawVersionPlans,
|
|
4722
|
-
releaseGraph
|
|
5440
|
+
releaseGraph.releaseGroups,
|
|
4723
5441
|
Object.keys(this.projectGraph.nodes),
|
|
4724
5442
|
verbose
|
|
4725
5443
|
);
|
|
4726
5444
|
const versionPlanValidationError = versionPlanUtils.validateResolvedVersionPlansAgainstFilter(
|
|
4727
|
-
releaseGraph
|
|
4728
|
-
releaseGraph
|
|
5445
|
+
releaseGraph.releaseGroups,
|
|
5446
|
+
releaseGraph.releaseGroupToFilteredProjects
|
|
4729
5447
|
);
|
|
4730
5448
|
if (versionPlanValidationError) {
|
|
4731
5449
|
throw new Error(formatNxLog(versionPlanValidationError));
|
|
4732
5450
|
}
|
|
4733
5451
|
} else {
|
|
4734
|
-
if (verbose && releaseGraph
|
|
5452
|
+
if (verbose && releaseGraph.releaseGroups.some((g) => !!g.versionPlans)) {
|
|
4735
5453
|
chunkOOFHIS6Q_cjs.writeDebug(
|
|
4736
5454
|
`Skipping version plan discovery as a specifier was provided`,
|
|
4737
5455
|
this.workspaceConfig
|
|
@@ -4770,8 +5488,8 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
|
|
|
4770
5488
|
);
|
|
4771
5489
|
}
|
|
4772
5490
|
}
|
|
4773
|
-
for (const groupName of releaseGraph
|
|
4774
|
-
const releaseGroup = releaseGraph
|
|
5491
|
+
for (const groupName of releaseGraph.sortedReleaseGroups) {
|
|
5492
|
+
const releaseGroup = releaseGraph.releaseGroups.find(
|
|
4775
5493
|
(g) => g.name === groupName
|
|
4776
5494
|
);
|
|
4777
5495
|
if (!releaseGroup) {
|
|
@@ -4808,7 +5526,7 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
|
|
|
4808
5526
|
}
|
|
4809
5527
|
}
|
|
4810
5528
|
}
|
|
4811
|
-
await releaseGraph
|
|
5529
|
+
await releaseGraph.validate(this.tree);
|
|
4812
5530
|
const commitMessage = options.gitCommitMessage || this.releaseConfig.version?.git?.commitMessage;
|
|
4813
5531
|
const additionalChangedFiles = /* @__PURE__ */ new Set();
|
|
4814
5532
|
const additionalDeletedFiles = /* @__PURE__ */ new Set();
|
|
@@ -4817,7 +5535,7 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
|
|
|
4817
5535
|
this.workspaceConfig,
|
|
4818
5536
|
this.projectGraph,
|
|
4819
5537
|
this.releaseConfig,
|
|
4820
|
-
releaseGraph
|
|
5538
|
+
releaseGraph,
|
|
4821
5539
|
options
|
|
4822
5540
|
);
|
|
4823
5541
|
try {
|
|
@@ -4867,8 +5585,8 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
|
|
|
4867
5585
|
);
|
|
4868
5586
|
}
|
|
4869
5587
|
}
|
|
4870
|
-
for (const groupName of releaseGraph
|
|
4871
|
-
const releaseGroup = releaseGraph
|
|
5588
|
+
for (const groupName of releaseGraph.sortedReleaseGroups) {
|
|
5589
|
+
const releaseGroup = releaseGraph.releaseGroups.find(
|
|
4872
5590
|
(g) => g.name === groupName
|
|
4873
5591
|
);
|
|
4874
5592
|
if (!releaseGroup) {
|
|
@@ -4905,7 +5623,7 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
|
|
|
4905
5623
|
}
|
|
4906
5624
|
}
|
|
4907
5625
|
}
|
|
4908
|
-
if (this.releaseConfig.docker || releaseGraph
|
|
5626
|
+
if (this.releaseConfig.docker || releaseGraph.releaseGroups.some((rg) => rg.docker)) {
|
|
4909
5627
|
chunkOOFHIS6Q_cjs.writeWarning(
|
|
4910
5628
|
formatNxLog({
|
|
4911
5629
|
title: "Warning",
|
|
@@ -4921,17 +5639,17 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
|
|
|
4921
5639
|
);
|
|
4922
5640
|
const versionData = processor.getVersionData();
|
|
4923
5641
|
const gitTagValues = options.gitTag ?? this.releaseConfig.version?.git?.tag ? shared.createGitTagValues(
|
|
4924
|
-
releaseGraph
|
|
4925
|
-
releaseGraph
|
|
5642
|
+
releaseGraph.releaseGroups,
|
|
5643
|
+
releaseGraph.releaseGroupToFilteredProjects,
|
|
4926
5644
|
versionData
|
|
4927
5645
|
) : [];
|
|
4928
5646
|
shared.handleDuplicateGitTags(gitTagValues);
|
|
4929
5647
|
let workspaceVersion = void 0;
|
|
4930
|
-
if (releaseGraph
|
|
4931
|
-
const releaseGroup = releaseGraph
|
|
5648
|
+
if (releaseGraph.releaseGroups.length === 1) {
|
|
5649
|
+
const releaseGroup = releaseGraph.releaseGroups[0];
|
|
4932
5650
|
if (releaseGroup?.projectsRelationship === "fixed") {
|
|
4933
5651
|
const releaseGroupProjectNames = Array.from(
|
|
4934
|
-
releaseGraph
|
|
5652
|
+
releaseGraph.releaseGroupToFilteredProjects.get(releaseGroup)
|
|
4935
5653
|
);
|
|
4936
5654
|
workspaceVersion = versionData[releaseGroupProjectNames[0]].newVersion;
|
|
4937
5655
|
}
|
|
@@ -4945,7 +5663,7 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
|
|
|
4945
5663
|
return {
|
|
4946
5664
|
workspaceVersion,
|
|
4947
5665
|
projectsVersionData: versionData,
|
|
4948
|
-
releaseGraph
|
|
5666
|
+
releaseGraph
|
|
4949
5667
|
};
|
|
4950
5668
|
}
|
|
4951
5669
|
if (options.gitCommit ?? this.releaseConfig.version?.git?.commit) {
|
|
@@ -4955,8 +5673,8 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
|
|
|
4955
5673
|
isDryRun: !!options.dryRun,
|
|
4956
5674
|
isVerbose: !!options.verbose,
|
|
4957
5675
|
gitCommitMessages: shared.createCommitMessageValues(
|
|
4958
|
-
releaseGraph
|
|
4959
|
-
releaseGraph
|
|
5676
|
+
releaseGraph.releaseGroups,
|
|
5677
|
+
releaseGraph.releaseGroupToFilteredProjects,
|
|
4960
5678
|
versionData,
|
|
4961
5679
|
commitMessage
|
|
4962
5680
|
),
|
|
@@ -4995,7 +5713,7 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
|
|
|
4995
5713
|
return {
|
|
4996
5714
|
workspaceVersion,
|
|
4997
5715
|
projectsVersionData: versionData,
|
|
4998
|
-
releaseGraph
|
|
5716
|
+
releaseGraph
|
|
4999
5717
|
};
|
|
5000
5718
|
};
|
|
5001
5719
|
};
|