@storm-software/git-tools 2.130.40 → 2.131.6
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/README.md +1 -1
- package/bin/{chunk-3RY4CGUX.js → chunk-32WE3MHJ.js} +3 -3
- package/bin/{chunk-3RY4CGUX.js.map → chunk-32WE3MHJ.js.map} +1 -1
- package/bin/chunk-4EOHM2UV.cjs +16 -0
- package/bin/{chunk-ROM64JTJ.cjs.map → chunk-4EOHM2UV.cjs.map} +1 -1
- package/bin/{chunk-PTYTYIPG.cjs → chunk-4ILBJTRR.cjs} +9 -3
- package/bin/chunk-4ILBJTRR.cjs.map +1 -0
- package/bin/{chunk-BHWWH5OI.js → chunk-7ES3CGZQ.js} +9 -4
- package/bin/chunk-7ES3CGZQ.js.map +1 -0
- package/bin/{chunk-Y6YU46VF.js → chunk-ABI4JM6L.js} +3 -3
- package/bin/{chunk-Y6YU46VF.js.map → chunk-ABI4JM6L.js.map} +1 -1
- package/bin/{chunk-UIGOGTUM.cjs → chunk-AQ5YHZ3Z.cjs} +4 -4
- package/bin/{chunk-UIGOGTUM.cjs.map → chunk-AQ5YHZ3Z.cjs.map} +1 -1
- package/bin/{chunk-IEGXPTOH.js → chunk-AZGQVIYO.js} +4 -4
- package/bin/{chunk-IEGXPTOH.js.map → chunk-AZGQVIYO.js.map} +1 -1
- package/bin/{chunk-6V4HD3QJ.js → chunk-CDUCLZJV.js} +4 -4
- package/bin/{chunk-6V4HD3QJ.js.map → chunk-CDUCLZJV.js.map} +1 -1
- package/bin/{chunk-GU7L3IBA.js → chunk-CVTLZKKX.js} +4 -4
- package/bin/{chunk-GU7L3IBA.js.map → chunk-CVTLZKKX.js.map} +1 -1
- package/bin/{chunk-THX6DU6T.cjs → chunk-DPKFBB3S.cjs} +7 -7
- package/bin/{chunk-THX6DU6T.cjs.map → chunk-DPKFBB3S.cjs.map} +1 -1
- package/bin/{chunk-V6PBXXP5.js → chunk-IAZL2KCV.js} +4 -4
- package/bin/{chunk-V6PBXXP5.js.map → chunk-IAZL2KCV.js.map} +1 -1
- package/bin/{chunk-FH5OSXAJ.cjs → chunk-MTAYUS7E.cjs} +18 -2
- package/bin/chunk-MTAYUS7E.cjs.map +1 -0
- package/bin/{chunk-DNLVUV64.js → chunk-NOZEXVLA.js} +4 -4
- package/bin/{chunk-DNLVUV64.js.map → chunk-NOZEXVLA.js.map} +1 -1
- package/bin/{chunk-LR2WNL25.cjs → chunk-OGGY5I23.cjs} +7 -7
- package/bin/{chunk-LR2WNL25.cjs.map → chunk-OGGY5I23.cjs.map} +1 -1
- package/bin/chunk-POFLIQQB.cjs +18 -0
- package/bin/{chunk-USGU6ZVC.cjs.map → chunk-POFLIQQB.cjs.map} +1 -1
- package/bin/chunk-RPK5AKGK.js +39 -0
- package/bin/chunk-RPK5AKGK.js.map +1 -0
- package/bin/{chunk-27LFN4VQ.cjs → chunk-RZNFHUM6.cjs} +7 -7
- package/bin/{chunk-27LFN4VQ.cjs.map → chunk-RZNFHUM6.cjs.map} +1 -1
- package/bin/{chunk-MY767YV7.cjs → chunk-W5P2IM2W.cjs} +6 -6
- package/bin/{chunk-MY767YV7.cjs.map → chunk-W5P2IM2W.cjs.map} +1 -1
- package/bin/git.cjs +1341 -200
- package/bin/git.cjs.map +1 -1
- package/bin/git.js +1235 -97
- package/bin/git.js.map +1 -1
- package/bin/post-checkout.cjs +8 -8
- package/bin/post-checkout.js +3 -3
- package/bin/post-commit.cjs +8 -8
- package/bin/post-commit.js +3 -3
- package/bin/post-merge.cjs +8 -8
- package/bin/post-merge.js +3 -3
- package/bin/pre-commit.cjs +7 -7
- package/bin/pre-commit.js +2 -2
- package/bin/pre-install.cjs +8 -8
- package/bin/pre-install.js +3 -3
- package/bin/pre-push.cjs +7 -7
- package/bin/pre-push.js +2 -2
- package/bin/prepare.cjs +8 -8
- package/bin/prepare.js +3 -3
- package/bin/version-warning.cjs +5 -5
- package/bin/version-warning.js +1 -1
- package/dist/{chunk-GTHIKJY7.cjs → chunk-EMMN3RCO.cjs} +82 -18
- package/dist/{chunk-VBTXRYZY.js → chunk-R6XSEPQS.js} +76 -19
- package/dist/index.cjs +36 -8
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/release/config.cjs +36 -8
- package/dist/release/config.d.cts +138 -2
- package/dist/release/config.d.ts +138 -2
- package/dist/release/config.js +1 -1
- package/package.json +10 -8
- package/bin/chunk-BHWWH5OI.js.map +0 -1
- package/bin/chunk-FH5OSXAJ.cjs.map +0 -1
- package/bin/chunk-G3YPGVPS.js +0 -24
- package/bin/chunk-G3YPGVPS.js.map +0 -1
- package/bin/chunk-PTYTYIPG.cjs.map +0 -1
- package/bin/chunk-ROM64JTJ.cjs +0 -16
- package/bin/chunk-USGU6ZVC.cjs +0 -18
package/bin/git.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { postCheckoutHook } from './chunk-
|
|
3
|
-
import { postCommitHook } from './chunk-
|
|
4
|
-
import { postMergeHook } from './chunk-
|
|
5
|
-
import { preCommitHook } from './chunk-
|
|
6
|
-
import './chunk-
|
|
7
|
-
import { prePushHook } from './chunk-
|
|
2
|
+
import { postCheckoutHook } from './chunk-IAZL2KCV.js';
|
|
3
|
+
import { postCommitHook } from './chunk-CVTLZKKX.js';
|
|
4
|
+
import { postMergeHook } from './chunk-CDUCLZJV.js';
|
|
5
|
+
import { preCommitHook } from './chunk-32WE3MHJ.js';
|
|
6
|
+
import './chunk-NOZEXVLA.js';
|
|
7
|
+
import { prePushHook } from './chunk-ABI4JM6L.js';
|
|
8
8
|
import './chunk-HBLWPOJV.js';
|
|
9
|
-
import { prepareHook } from './chunk-
|
|
10
|
-
import { run } from './chunk-
|
|
11
|
-
import { getConfig, handleProcess, writeSuccess, exitWithSuccess, exitWithError, writeInfo, brandIcon, findWorkspaceRootSafe, writeFatal, getWorkspaceConfig, joinPaths, writeDebug, isVerbose, writeWarning, defu, writeTrace, STORM_DEFAULT_RELEASE_BANNER } from './chunk-
|
|
9
|
+
import { prepareHook } from './chunk-AZGQVIYO.js';
|
|
10
|
+
import { run, runAsync } from './chunk-RPK5AKGK.js';
|
|
11
|
+
import { getConfig, handleProcess, writeSuccess, exitWithSuccess, exitWithError, writeInfo, brandIcon, findWorkspaceRootSafe, writeFatal, getWorkspaceConfig, joinPaths, writeDebug, isVerbose, writeWarning, defu, writeTrace, __require, STORM_DEFAULT_RELEASE_BANNER } from './chunk-7ES3CGZQ.js';
|
|
12
12
|
import TOML from '@ltd/j-toml';
|
|
13
13
|
import { Command } from 'commander';
|
|
14
14
|
import '@inquirer/checkbox';
|
|
@@ -42,24 +42,36 @@ import anchor from 'anchor-markdown-header';
|
|
|
42
42
|
import { Parser } from 'htmlparser2';
|
|
43
43
|
import _ from 'underscore';
|
|
44
44
|
import updateSection from 'update-section';
|
|
45
|
-
import {
|
|
45
|
+
import { createProjectGraphAsync as createProjectGraphAsync$2, readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph$2, readCachedProjectGraph as readCachedProjectGraph$1, output, joinPathFragments } from '@nx/devkit';
|
|
46
46
|
import axios from 'axios';
|
|
47
47
|
import { homedir } from 'node:os';
|
|
48
48
|
import { defaultCreateReleaseProvider, GithubRemoteReleaseClient } from 'nx/src/command-line/release/utils/remote-release-clients/github';
|
|
49
49
|
import { parse } from 'yaml';
|
|
50
50
|
import chalk from 'chalk';
|
|
51
|
-
import { printAndFlushChanges } from 'nx/src/command-line/release/utils/print-changes';
|
|
51
|
+
import { printAndFlushChanges as printAndFlushChanges$1 } from 'nx/src/command-line/release/utils/print-changes';
|
|
52
52
|
import { createGitTagValues, handleDuplicateGitTags, createCommitMessageValues, isPrerelease, shouldPreferDockerVersionForReleaseGroup, ReleaseVersion, noDiffInChangelogMessage } from 'nx/src/command-line/release/utils/shared';
|
|
53
53
|
import { interpolate } from 'nx/src/tasks-runner/utils';
|
|
54
54
|
import { execCommand } from 'nx/src/command-line/release/utils/exec-command.js';
|
|
55
|
-
import { getCommitHash, getLatestGitTagForPattern, getFirstGitCommit, gitPush, getGitDiff, parseCommits
|
|
56
|
-
import { prerelease, major } from 'semver';
|
|
55
|
+
import { getCommitHash, getLatestGitTagForPattern, getFirstGitCommit, gitPush, gitAdd, getGitDiff, parseCommits } from 'nx/src/command-line/release/utils/git';
|
|
56
|
+
import semver, { prerelease, major } from 'semver';
|
|
57
|
+
import clone from 'nanoclone';
|
|
57
58
|
import { ReleaseClient } from 'nx/release';
|
|
59
|
+
import { readRawVersionPlans, setResolvedVersionPlansOnGroups } from 'nx/src/command-line/release/config/version-plans';
|
|
60
|
+
import { printAndFlushChanges } from 'nx/src/command-line/release/utils/print-changes.js';
|
|
61
|
+
import { createReleaseGraph } from 'nx/src/command-line/release/utils/release-graph';
|
|
62
|
+
import { validateResolvedVersionPlansAgainstFilter } from 'nx/src/command-line/release/utils/version-plan-utils';
|
|
58
63
|
import { readNxJson } from 'nx/src/config/nx-json';
|
|
59
64
|
import { FsTree } from 'nx/src/generators/tree';
|
|
60
65
|
import { createFileMapUsingProjectGraph } from 'nx/src/project-graph/file-map-utils';
|
|
66
|
+
import { findMatchingProjects } from 'nx/src/utils/find-matching-projects';
|
|
67
|
+
import importsPlugin from 'prettier-plugin-organize-imports';
|
|
61
68
|
import DefaultChangelogRenderer from 'nx/release/changelog-renderer';
|
|
62
69
|
import { DEFAULT_CONVENTIONAL_COMMITS_CONFIG } from 'nx/src/command-line/release/config/conventional-commits';
|
|
70
|
+
import { IMPLICIT_DEFAULT_RELEASE_GROUP } from 'nx/src/command-line/release/config/config.js';
|
|
71
|
+
import { deriveSpecifierFromConventionalCommits } from 'nx/src/command-line/release/version/derive-specifier-from-conventional-commits';
|
|
72
|
+
import { deriveSpecifierFromVersionPlan } from 'nx/src/command-line/release/version/deriver-specifier-from-version-plans';
|
|
73
|
+
import { ReleaseGroupProcessor } from 'nx/src/command-line/release/version/release-group-processor';
|
|
74
|
+
import { NOOP_VERSION_ACTIONS } from 'nx/src/command-line/release/version/version-actions.js';
|
|
63
75
|
|
|
64
76
|
function parseCargoToml(cargoString) {
|
|
65
77
|
if (!cargoString) {
|
|
@@ -1278,11 +1290,11 @@ var formatCommitMessage = (state, workspaceConfig) => {
|
|
|
1278
1290
|
const scope = workspaceConfig.variant !== "minimal" && typeof answers.scope === "string" && answers.scope ? answers.scope.trim() : "";
|
|
1279
1291
|
const subject = answers.subject?.trim();
|
|
1280
1292
|
const type = answers.type;
|
|
1281
|
-
const
|
|
1293
|
+
const format4 = config5.settings.format || (workspaceConfig.variant !== "minimal" ? "{type}({scope}): {emoji}{subject}" : "{type}: {emoji}{subject}");
|
|
1282
1294
|
const body = answers.body && typeof answers.body === "string" ? wrap(answers.body || "", wrapOptions) : "";
|
|
1283
1295
|
const breaking = answers.breakingBody && typeof answers.breakingBody === "string" ? wrap(answers.breakingBody || "", wrapOptions) : "";
|
|
1284
1296
|
const issues = answers.issuesBody && typeof answers.issuesBody === "string" ? wrap(answers.issuesBody || "", wrapOptions) : "";
|
|
1285
|
-
const head =
|
|
1297
|
+
const head = format4.replace(/\{emoji\}/g, config5.settings.disableEmoji ? "" : `${emoji} `).replace(/\{scope\}/g, scope).replace(/\{subject\}/g, subject || "").replace(/\{type\}/g, type || "");
|
|
1286
1298
|
let msg = head;
|
|
1287
1299
|
if (body) {
|
|
1288
1300
|
msg += `
|
|
@@ -1988,7 +2000,7 @@ var runReadme = async ({
|
|
|
1988
2000
|
project,
|
|
1989
2001
|
output: output3,
|
|
1990
2002
|
clean = true,
|
|
1991
|
-
prettier = true,
|
|
2003
|
+
prettier: prettier2 = true,
|
|
1992
2004
|
workspace = false
|
|
1993
2005
|
}) => {
|
|
1994
2006
|
const projectGraph = await createProjectGraphAsync({
|
|
@@ -2023,7 +2035,7 @@ var runReadme = async ({
|
|
|
2023
2035
|
templates,
|
|
2024
2036
|
output: output3,
|
|
2025
2037
|
clean,
|
|
2026
|
-
prettier
|
|
2038
|
+
prettier: prettier2
|
|
2027
2039
|
});
|
|
2028
2040
|
} else {
|
|
2029
2041
|
for (const projectName of Object.keys(projectConfigs.projects)) {
|
|
@@ -2031,12 +2043,12 @@ var runReadme = async ({
|
|
|
2031
2043
|
templates,
|
|
2032
2044
|
output: output3,
|
|
2033
2045
|
clean,
|
|
2034
|
-
prettier
|
|
2046
|
+
prettier: prettier2
|
|
2035
2047
|
});
|
|
2036
2048
|
}
|
|
2037
2049
|
}
|
|
2038
2050
|
};
|
|
2039
|
-
var runProjectReadme = async (projectName, { templates, output: output3, clean = true, prettier = true }) => {
|
|
2051
|
+
var runProjectReadme = async (projectName, { templates, output: output3, clean = true, prettier: prettier2 = true }) => {
|
|
2040
2052
|
const projectGraph = await createProjectGraphAsync({
|
|
2041
2053
|
exitOnError: true
|
|
2042
2054
|
});
|
|
@@ -2124,10 +2136,10 @@ var runProjectReadme = async (projectName, { templates, output: output3, clean =
|
|
|
2124
2136
|
}
|
|
2125
2137
|
}
|
|
2126
2138
|
}
|
|
2127
|
-
if (
|
|
2128
|
-
const
|
|
2139
|
+
if (prettier2) {
|
|
2140
|
+
const prettier3 = await import('prettier');
|
|
2129
2141
|
console.info("Formatting output with Prettier");
|
|
2130
|
-
newContent = await
|
|
2142
|
+
newContent = await prettier3.format(newContent, {
|
|
2131
2143
|
parser: "markdown",
|
|
2132
2144
|
trailingComma: "none",
|
|
2133
2145
|
tabWidth: 2,
|
|
@@ -2614,7 +2626,7 @@ async function generateChangelogForProjects({
|
|
|
2614
2626
|
workspaceConfig
|
|
2615
2627
|
);
|
|
2616
2628
|
tree.write(filePath, content);
|
|
2617
|
-
printAndFlushChanges(
|
|
2629
|
+
printAndFlushChanges$1(
|
|
2618
2630
|
tree,
|
|
2619
2631
|
!!args.dryRun,
|
|
2620
2632
|
3,
|
|
@@ -3003,6 +3015,54 @@ async function isUserAnOrganizationMember(userId, config5, remoteName = "origin"
|
|
|
3003
3015
|
return false;
|
|
3004
3016
|
}
|
|
3005
3017
|
}
|
|
3018
|
+
|
|
3019
|
+
// src/utilities/logs.ts
|
|
3020
|
+
function formatNxLog(message) {
|
|
3021
|
+
const { title, bodyLines } = message;
|
|
3022
|
+
return `${title}${bodyLines && bodyLines.length > 0 ? `
|
|
3023
|
+
${bodyLines.map((line) => ` ${line}`).join("\n")}` : ""}`;
|
|
3024
|
+
}
|
|
3025
|
+
async function format3(path, data) {
|
|
3026
|
+
let code = data;
|
|
3027
|
+
try {
|
|
3028
|
+
const resolvedConfig = await resolveConfig(path);
|
|
3029
|
+
if (resolvedConfig) {
|
|
3030
|
+
code = await format(
|
|
3031
|
+
data,
|
|
3032
|
+
defu(
|
|
3033
|
+
{
|
|
3034
|
+
absolutePath: path,
|
|
3035
|
+
...resolvedConfig
|
|
3036
|
+
},
|
|
3037
|
+
path.endsWith(".ts") || path.endsWith(".tsx") ? { plugins: [importsPlugin] } : {}
|
|
3038
|
+
)
|
|
3039
|
+
);
|
|
3040
|
+
}
|
|
3041
|
+
} catch (error) {
|
|
3042
|
+
throw new Error(
|
|
3043
|
+
`Failed to format file at ${path} with Prettier: ${error.message}`,
|
|
3044
|
+
{ cause: error }
|
|
3045
|
+
);
|
|
3046
|
+
}
|
|
3047
|
+
return code;
|
|
3048
|
+
}
|
|
3049
|
+
async function formatChangedFiles(tree) {
|
|
3050
|
+
if (process.env.NX_SKIP_FORMAT === "true") {
|
|
3051
|
+
return;
|
|
3052
|
+
}
|
|
3053
|
+
const files = new Set(
|
|
3054
|
+
tree.listChanges().filter((file) => file.type !== "DELETE")
|
|
3055
|
+
);
|
|
3056
|
+
const results = await Promise.all(
|
|
3057
|
+
Array.from(files).filter((file) => file.content && file.path).map(async (file) => [
|
|
3058
|
+
file.path,
|
|
3059
|
+
await format3(file.path, file.content?.toString("utf-8") ?? "")
|
|
3060
|
+
])
|
|
3061
|
+
);
|
|
3062
|
+
for (const [path, content] of results) {
|
|
3063
|
+
tree.write(path, content);
|
|
3064
|
+
}
|
|
3065
|
+
}
|
|
3006
3066
|
var StormChangelogRenderer = class extends DefaultChangelogRenderer {
|
|
3007
3067
|
/**
|
|
3008
3068
|
* The Storm workspace configuration object, which is loaded from the storm-workspace.json file.
|
|
@@ -3213,25 +3273,72 @@ var DEFAULT_CONVENTIONAL_COMMITS_CONFIG2 = {
|
|
|
3213
3273
|
types: DEFAULT_COMMIT_TYPES
|
|
3214
3274
|
};
|
|
3215
3275
|
var DEFAULT_RELEASE_TAG_PATTERN = "{projectName}@{version}";
|
|
3276
|
+
var DEFAULT_FIXED_RELEASE_TAG_PATTERN = "{releaseGroupName}@{version}";
|
|
3277
|
+
var DEFAULT_COMMIT_MESSAGE = "release(monorepo): Publish v{version} release updates";
|
|
3278
|
+
var DEFAULT_VERSION_ACTIONS_PATH = "@nx/js/src/release/version-actions";
|
|
3279
|
+
var DEFAULT_RELEASE_GROUP_GIT_CONFIG = {
|
|
3280
|
+
commit: false,
|
|
3281
|
+
commitMessage: DEFAULT_COMMIT_MESSAGE,
|
|
3282
|
+
commitArgs: "",
|
|
3283
|
+
tag: false,
|
|
3284
|
+
tagMessage: "",
|
|
3285
|
+
tagArgs: "",
|
|
3286
|
+
stageChanges: false,
|
|
3287
|
+
pushArgs: ""
|
|
3288
|
+
};
|
|
3289
|
+
var DEFAULT_VERSION_RELEASE_CONFIG = {
|
|
3290
|
+
currentVersionResolver: "git-tag",
|
|
3291
|
+
fallbackCurrentVersionResolver: "disk",
|
|
3292
|
+
specifierSource: "conventional-commits",
|
|
3293
|
+
groupPreVersionCommand: "pnpm build",
|
|
3294
|
+
versionActions: DEFAULT_VERSION_ACTIONS_PATH,
|
|
3295
|
+
versionActionsOptions: {},
|
|
3296
|
+
preserveLocalDependencyProtocols: true,
|
|
3297
|
+
preserveMatchingDependencyRanges: true,
|
|
3298
|
+
logUnchangedProjects: true,
|
|
3299
|
+
updateDependents: "always",
|
|
3300
|
+
git: {
|
|
3301
|
+
...DEFAULT_RELEASE_GROUP_GIT_CONFIG,
|
|
3302
|
+
stageChanges: true
|
|
3303
|
+
}
|
|
3304
|
+
};
|
|
3305
|
+
var DEFAULT_CHANGELOG_RELEASE_CONFIG = {
|
|
3306
|
+
createRelease: "github",
|
|
3307
|
+
entryWhenNoChanges: "This was a version bump only for {projectName} to align it with other projects, there were no code changes.",
|
|
3308
|
+
file: false,
|
|
3309
|
+
renderOptions: {
|
|
3310
|
+
authors: false,
|
|
3311
|
+
commitReferences: true,
|
|
3312
|
+
versionTitleDate: true
|
|
3313
|
+
},
|
|
3314
|
+
git: {
|
|
3315
|
+
...DEFAULT_RELEASE_GROUP_GIT_CONFIG,
|
|
3316
|
+
commit: true,
|
|
3317
|
+
tag: true,
|
|
3318
|
+
push: true
|
|
3319
|
+
}
|
|
3320
|
+
};
|
|
3216
3321
|
var DEFAULT_RELEASE_GROUP_CONFIG = {
|
|
3217
3322
|
projectsRelationship: "independent",
|
|
3218
3323
|
changelog: {
|
|
3219
|
-
|
|
3220
|
-
entryWhenNoChanges: false,
|
|
3221
|
-
file: false,
|
|
3222
|
-
renderOptions: {
|
|
3223
|
-
authors: false,
|
|
3224
|
-
commitReferences: true,
|
|
3225
|
-
versionTitleDate: true
|
|
3226
|
-
}
|
|
3324
|
+
...DEFAULT_CHANGELOG_RELEASE_CONFIG
|
|
3227
3325
|
},
|
|
3228
3326
|
version: {
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3327
|
+
...DEFAULT_VERSION_RELEASE_CONFIG
|
|
3328
|
+
},
|
|
3329
|
+
releaseTag: {
|
|
3330
|
+
pattern: DEFAULT_RELEASE_TAG_PATTERN,
|
|
3331
|
+
preferDockerVersion: false
|
|
3233
3332
|
},
|
|
3234
|
-
|
|
3333
|
+
versionPlans: false
|
|
3334
|
+
};
|
|
3335
|
+
var DEFAULT_FIXED_RELEASE_GROUP_CONFIG = {
|
|
3336
|
+
...DEFAULT_RELEASE_GROUP_CONFIG,
|
|
3337
|
+
projectsRelationship: "fixed",
|
|
3338
|
+
releaseTag: {
|
|
3339
|
+
...DEFAULT_RELEASE_GROUP_CONFIG.releaseTag,
|
|
3340
|
+
pattern: DEFAULT_FIXED_RELEASE_TAG_PATTERN
|
|
3341
|
+
}
|
|
3235
3342
|
};
|
|
3236
3343
|
var DEFAULT_JS_RELEASE_GROUP_CONFIG = {
|
|
3237
3344
|
...DEFAULT_RELEASE_GROUP_CONFIG,
|
|
@@ -3272,31 +3379,41 @@ var DEFAULT_RELEASE_CONFIG = {
|
|
|
3272
3379
|
crates: DEFAULT_RUST_RELEASE_GROUP_CONFIG
|
|
3273
3380
|
},
|
|
3274
3381
|
changelog: {
|
|
3382
|
+
...DEFAULT_CHANGELOG_RELEASE_CONFIG,
|
|
3275
3383
|
automaticFromRef: true,
|
|
3276
3384
|
workspaceChangelog: false,
|
|
3277
3385
|
projectChangelogs: true
|
|
3278
3386
|
},
|
|
3279
|
-
releaseTag: {
|
|
3387
|
+
releaseTag: {
|
|
3388
|
+
pattern: DEFAULT_RELEASE_TAG_PATTERN,
|
|
3389
|
+
preferDockerVersion: false
|
|
3390
|
+
},
|
|
3391
|
+
version: {
|
|
3392
|
+
...DEFAULT_VERSION_RELEASE_CONFIG
|
|
3393
|
+
}
|
|
3280
3394
|
};
|
|
3281
3395
|
function getReleaseGroupConfig(releaseConfig, workspaceConfig) {
|
|
3282
3396
|
return !releaseConfig?.groups || Object.keys(releaseConfig.groups).length === 0 ? {} : Object.fromEntries(
|
|
3283
3397
|
Object.entries(releaseConfig.groups).map(([name, group]) => {
|
|
3284
3398
|
const config5 = defu(
|
|
3285
3399
|
{
|
|
3286
|
-
...omit(
|
|
3400
|
+
...omit(
|
|
3401
|
+
group.projectsRelationship === "fixed" ? DEFAULT_FIXED_RELEASE_GROUP_CONFIG : DEFAULT_RELEASE_GROUP_CONFIG,
|
|
3402
|
+
["changelog", "version"]
|
|
3403
|
+
),
|
|
3287
3404
|
...group
|
|
3288
3405
|
},
|
|
3289
3406
|
{
|
|
3290
3407
|
version: {
|
|
3291
|
-
...DEFAULT_RELEASE_GROUP_CONFIG.version
|
|
3408
|
+
...(group.projectsRelationship === "fixed" ? DEFAULT_FIXED_RELEASE_GROUP_CONFIG : DEFAULT_RELEASE_GROUP_CONFIG).version
|
|
3292
3409
|
}
|
|
3293
3410
|
},
|
|
3294
3411
|
{
|
|
3295
3412
|
changelog: {
|
|
3296
|
-
...DEFAULT_RELEASE_GROUP_CONFIG.changelog,
|
|
3413
|
+
...(group.projectsRelationship === "fixed" ? DEFAULT_FIXED_RELEASE_GROUP_CONFIG : DEFAULT_RELEASE_GROUP_CONFIG).changelog,
|
|
3297
3414
|
renderer: StormChangelogRenderer,
|
|
3298
3415
|
renderOptions: {
|
|
3299
|
-
...DEFAULT_RELEASE_GROUP_CONFIG.changelog.renderOptions,
|
|
3416
|
+
...(group.projectsRelationship === "fixed" ? DEFAULT_FIXED_RELEASE_GROUP_CONFIG : DEFAULT_RELEASE_GROUP_CONFIG).changelog.renderOptions,
|
|
3300
3417
|
workspaceConfig
|
|
3301
3418
|
}
|
|
3302
3419
|
}
|
|
@@ -3320,6 +3437,658 @@ function getReleaseGroupConfig(releaseConfig, workspaceConfig) {
|
|
|
3320
3437
|
})
|
|
3321
3438
|
);
|
|
3322
3439
|
}
|
|
3440
|
+
var StormReleaseGroupProcessor = class extends ReleaseGroupProcessor {
|
|
3441
|
+
constructor(tree, workspaceConfig, projectGraph, nxReleaseConfig, releaseGraph, versionOptions) {
|
|
3442
|
+
super(tree, projectGraph, nxReleaseConfig, releaseGraph, {
|
|
3443
|
+
dryRun: !!versionOptions.dryRun,
|
|
3444
|
+
verbose: versionOptions.verbose || isVerbose(workspaceConfig.logLevel),
|
|
3445
|
+
firstRelease: !!versionOptions.firstRelease,
|
|
3446
|
+
preid: versionOptions.preid ?? workspaceConfig.preid ?? "",
|
|
3447
|
+
userGivenSpecifier: versionOptions.specifier,
|
|
3448
|
+
filters: {
|
|
3449
|
+
projects: versionOptions.projects,
|
|
3450
|
+
groups: versionOptions.groups
|
|
3451
|
+
},
|
|
3452
|
+
versionActionsOptionsOverrides: versionOptions.versionActionsOptionsOverrides
|
|
3453
|
+
});
|
|
3454
|
+
this.workspaceConfig = workspaceConfig;
|
|
3455
|
+
this.versionOptions = versionOptions;
|
|
3456
|
+
this.#tree = tree;
|
|
3457
|
+
this.#projectGraph = projectGraph;
|
|
3458
|
+
this.#nxReleaseConfig = nxReleaseConfig;
|
|
3459
|
+
this.#releaseGraph = releaseGraph;
|
|
3460
|
+
}
|
|
3461
|
+
#tree;
|
|
3462
|
+
#projectGraph;
|
|
3463
|
+
#nxReleaseConfig;
|
|
3464
|
+
#releaseGraph;
|
|
3465
|
+
/**
|
|
3466
|
+
* Track any version plan files that have been processed so that we can delete them after versioning is complete,
|
|
3467
|
+
* while leaving any unprocessed files in place.
|
|
3468
|
+
*/
|
|
3469
|
+
#processedVersionPlanFiles = /* @__PURE__ */ new Set();
|
|
3470
|
+
/**
|
|
3471
|
+
* Tracks which release groups have already been processed to avoid
|
|
3472
|
+
* processing them multiple times. Used during the group traversal.
|
|
3473
|
+
*/
|
|
3474
|
+
#processedGroups = /* @__PURE__ */ new Set();
|
|
3475
|
+
/**
|
|
3476
|
+
* Keeps track of which projects have already had their versions bumped.
|
|
3477
|
+
* This is used to avoid redundant version bumping and to determine which
|
|
3478
|
+
* projects need their dependencies updated.
|
|
3479
|
+
*/
|
|
3480
|
+
#bumpedProjects = /* @__PURE__ */ new Set();
|
|
3481
|
+
/**
|
|
3482
|
+
* versionData that will ultimately be returned to the nx release version handler by getVersionData()
|
|
3483
|
+
*/
|
|
3484
|
+
#versionData = /* @__PURE__ */ new Map();
|
|
3485
|
+
getReleaseGroupNameForProject(projectName) {
|
|
3486
|
+
const group = this.#releaseGraph.projectToReleaseGroup.get(projectName);
|
|
3487
|
+
return group ? group.name : null;
|
|
3488
|
+
}
|
|
3489
|
+
getNextGroup() {
|
|
3490
|
+
for (const [groupName, groupNode] of this.#releaseGraph.groupGraph) {
|
|
3491
|
+
if (!this.#processedGroups.has(groupName) && Array.from(groupNode.dependencies).every(
|
|
3492
|
+
(dep) => this.#processedGroups.has(dep)
|
|
3493
|
+
)) {
|
|
3494
|
+
return groupName;
|
|
3495
|
+
}
|
|
3496
|
+
}
|
|
3497
|
+
return null;
|
|
3498
|
+
}
|
|
3499
|
+
flushAllProjectLoggers() {
|
|
3500
|
+
for (const projectLogger of this.#releaseGraph.projectLoggers.values()) {
|
|
3501
|
+
projectLogger.flush();
|
|
3502
|
+
}
|
|
3503
|
+
}
|
|
3504
|
+
deleteProcessedVersionPlanFiles() {
|
|
3505
|
+
for (const versionPlanPath of this.#processedVersionPlanFiles) {
|
|
3506
|
+
this.#tree.delete(versionPlanPath);
|
|
3507
|
+
}
|
|
3508
|
+
}
|
|
3509
|
+
getVersionData() {
|
|
3510
|
+
return Object.fromEntries(this.#versionData);
|
|
3511
|
+
}
|
|
3512
|
+
/**
|
|
3513
|
+
* Invoke the afterAllProjectsVersioned functions for each unique versionActions type.
|
|
3514
|
+
* This can be useful for performing actions like updating a workspace level lock file.
|
|
3515
|
+
*
|
|
3516
|
+
* Because the tree has already been flushed to disk at this point, each afterAllProjectsVersioned
|
|
3517
|
+
* function is responsible for returning the list of changed and deleted files that it affected.
|
|
3518
|
+
*
|
|
3519
|
+
* The root level `release.version.versionActionsOptions` is what is passed in here because this
|
|
3520
|
+
* is a one time action for the whole workspace. Release group and project level overrides are
|
|
3521
|
+
* not applicable.
|
|
3522
|
+
*/
|
|
3523
|
+
async afterAllProjectsVersioned(rootVersionActionsOptions) {
|
|
3524
|
+
const changedFiles = /* @__PURE__ */ new Set();
|
|
3525
|
+
const deletedFiles = /* @__PURE__ */ new Set();
|
|
3526
|
+
for (const [, afterAllProjectsVersioned] of this.#releaseGraph.uniqueAfterAllProjectsVersioned) {
|
|
3527
|
+
const {
|
|
3528
|
+
changedFiles: changedFilesForVersionActions,
|
|
3529
|
+
deletedFiles: deletedFilesForVersionActions
|
|
3530
|
+
} = await afterAllProjectsVersioned(this.#tree.root, {
|
|
3531
|
+
dryRun: this.versionOptions.dryRun,
|
|
3532
|
+
verbose: this.versionOptions.verbose || isVerbose(this.workspaceConfig.logLevel),
|
|
3533
|
+
rootVersionActionsOptions
|
|
3534
|
+
});
|
|
3535
|
+
for (const file of changedFilesForVersionActions) {
|
|
3536
|
+
changedFiles.add(file);
|
|
3537
|
+
}
|
|
3538
|
+
for (const file of deletedFilesForVersionActions) {
|
|
3539
|
+
deletedFiles.add(file);
|
|
3540
|
+
}
|
|
3541
|
+
}
|
|
3542
|
+
return {
|
|
3543
|
+
changedFiles: Array.from(changedFiles),
|
|
3544
|
+
deletedFiles: Array.from(deletedFiles)
|
|
3545
|
+
};
|
|
3546
|
+
}
|
|
3547
|
+
async processDockerProjects(dockerVersionScheme, dockerVersion) {
|
|
3548
|
+
const dockerProjects = /* @__PURE__ */ new Map();
|
|
3549
|
+
for (const project of this.#versionData.keys()) {
|
|
3550
|
+
const hasDockerTechnology = Object.values(
|
|
3551
|
+
this.#projectGraph.nodes[project]?.data?.targets ?? []
|
|
3552
|
+
).some(({ metadata }) => metadata?.technologies?.includes("docker"));
|
|
3553
|
+
if (!hasDockerTechnology) {
|
|
3554
|
+
continue;
|
|
3555
|
+
}
|
|
3556
|
+
const finalConfigForProject = this.#releaseGraph.finalConfigsByProject.get(project);
|
|
3557
|
+
dockerProjects.set(project, finalConfigForProject);
|
|
3558
|
+
}
|
|
3559
|
+
if (dockerProjects.size === 0) {
|
|
3560
|
+
return;
|
|
3561
|
+
}
|
|
3562
|
+
let handleDockerVersion;
|
|
3563
|
+
try {
|
|
3564
|
+
const dockerVersionUtilsPath = "@nx/docker/release/version-utils";
|
|
3565
|
+
const { handleDockerVersion: _handleDockerVersion } = __require(dockerVersionUtilsPath);
|
|
3566
|
+
handleDockerVersion = _handleDockerVersion;
|
|
3567
|
+
} catch (e) {
|
|
3568
|
+
console.error(
|
|
3569
|
+
"Could not find `@nx/docker`. Please run `nx add @nx/docker` before attempting to release Docker images."
|
|
3570
|
+
);
|
|
3571
|
+
throw e;
|
|
3572
|
+
}
|
|
3573
|
+
for (const [project, finalConfigForProject] of dockerProjects.entries()) {
|
|
3574
|
+
const projectNode = this.#projectGraph.nodes[project];
|
|
3575
|
+
const projectVersionData = this.#versionData.get(project);
|
|
3576
|
+
const { newVersion, logs } = await handleDockerVersion(
|
|
3577
|
+
this.workspaceConfig.workspaceRoot,
|
|
3578
|
+
projectNode,
|
|
3579
|
+
finalConfigForProject,
|
|
3580
|
+
dockerVersionScheme,
|
|
3581
|
+
dockerVersion,
|
|
3582
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3583
|
+
projectVersionData?.newVersion
|
|
3584
|
+
);
|
|
3585
|
+
logs.forEach(
|
|
3586
|
+
(log) => this.#getProjectLoggerForProject(project).buffer(log)
|
|
3587
|
+
);
|
|
3588
|
+
const newVersionData = {
|
|
3589
|
+
...projectVersionData,
|
|
3590
|
+
dockerVersion: newVersion
|
|
3591
|
+
};
|
|
3592
|
+
this.#versionData.set(project, newVersionData);
|
|
3593
|
+
}
|
|
3594
|
+
this.flushAllProjectLoggers();
|
|
3595
|
+
}
|
|
3596
|
+
async processGroups() {
|
|
3597
|
+
const processOrder = [];
|
|
3598
|
+
for (const nextGroup of this.#releaseGraph.sortedReleaseGroups) {
|
|
3599
|
+
if (this.#processedGroups.has(nextGroup)) {
|
|
3600
|
+
continue;
|
|
3601
|
+
}
|
|
3602
|
+
if (!this.#releaseGraph.groupGraph.has(nextGroup)) {
|
|
3603
|
+
continue;
|
|
3604
|
+
}
|
|
3605
|
+
const allDependenciesProcessed = Array.from(
|
|
3606
|
+
this.#releaseGraph.groupGraph.get(nextGroup).dependencies
|
|
3607
|
+
).every((dep) => this.#processedGroups.has(dep));
|
|
3608
|
+
if (!allDependenciesProcessed) {
|
|
3609
|
+
for (const dep of this.#releaseGraph.groupGraph.get(nextGroup).dependencies) {
|
|
3610
|
+
if (!this.#processedGroups.has(dep)) {
|
|
3611
|
+
if (!this.#releaseGraph.groupGraph.has(dep)) {
|
|
3612
|
+
continue;
|
|
3613
|
+
}
|
|
3614
|
+
await this.#processGroup(dep);
|
|
3615
|
+
this.#processedGroups.add(dep);
|
|
3616
|
+
processOrder.push(dep);
|
|
3617
|
+
}
|
|
3618
|
+
}
|
|
3619
|
+
}
|
|
3620
|
+
await this.#processGroup(nextGroup);
|
|
3621
|
+
this.#processedGroups.add(nextGroup);
|
|
3622
|
+
processOrder.push(nextGroup);
|
|
3623
|
+
}
|
|
3624
|
+
return processOrder;
|
|
3625
|
+
}
|
|
3626
|
+
async #bumpVersions(releaseGroup) {
|
|
3627
|
+
if (releaseGroup.projectsRelationship === "fixed") {
|
|
3628
|
+
return this.#bumpFixedVersionGroup(releaseGroup);
|
|
3629
|
+
} else {
|
|
3630
|
+
return this.#bumpIndependentVersionGroup(releaseGroup);
|
|
3631
|
+
}
|
|
3632
|
+
}
|
|
3633
|
+
async #processGroup(releaseGroupName) {
|
|
3634
|
+
const groupNode = this.#releaseGraph.groupGraph.get(releaseGroupName);
|
|
3635
|
+
await this.#bumpVersions(groupNode.group);
|
|
3636
|
+
for (const project of groupNode.group.projects) {
|
|
3637
|
+
const projectLogger = this.#releaseGraph.projectLoggers.get(project);
|
|
3638
|
+
if (!projectLogger) {
|
|
3639
|
+
throw new Error(
|
|
3640
|
+
`No project logger found for project ${project} in release group ${releaseGroupName}. This should never happen.`
|
|
3641
|
+
);
|
|
3642
|
+
}
|
|
3643
|
+
projectLogger.flush();
|
|
3644
|
+
}
|
|
3645
|
+
}
|
|
3646
|
+
async #bumpFixedVersionGroup(releaseGroup) {
|
|
3647
|
+
if (releaseGroup.projects.length === 0) {
|
|
3648
|
+
return false;
|
|
3649
|
+
}
|
|
3650
|
+
let bumped = false;
|
|
3651
|
+
const firstProject = releaseGroup.projects.reduce((acc, project) => {
|
|
3652
|
+
const currentVersion = this.#getCurrentCachedVersionForProject(project);
|
|
3653
|
+
if (currentVersion && semver.gt(currentVersion, acc)) {
|
|
3654
|
+
return currentVersion;
|
|
3655
|
+
}
|
|
3656
|
+
return acc;
|
|
3657
|
+
}, "");
|
|
3658
|
+
const {
|
|
3659
|
+
newVersionInput,
|
|
3660
|
+
newVersionInputReason,
|
|
3661
|
+
newVersionInputReasonData
|
|
3662
|
+
} = await this.#determineVersionBumpForProject(releaseGroup, firstProject);
|
|
3663
|
+
if (newVersionInput === "none") {
|
|
3664
|
+
let bumpedByDependency = false;
|
|
3665
|
+
const sortedProjects2 = this.#releaseGraph.sortedProjects.get(releaseGroup.name) || [];
|
|
3666
|
+
for (const project of sortedProjects2) {
|
|
3667
|
+
const dependencies = this.#projectGraph.dependencies[project] || [];
|
|
3668
|
+
for (const dep of dependencies) {
|
|
3669
|
+
const depGroup = this.getReleaseGroupNameForProject(dep.target);
|
|
3670
|
+
if (depGroup && depGroup !== releaseGroup.name && this.#processedGroups.has(depGroup)) {
|
|
3671
|
+
const depGroupBumpType = await this.#getFixedReleaseGroupBumpType(depGroup);
|
|
3672
|
+
if (depGroupBumpType !== "none") {
|
|
3673
|
+
bumpedByDependency = true;
|
|
3674
|
+
const depBumpType = this.#determineSideEffectBump(
|
|
3675
|
+
releaseGroup,
|
|
3676
|
+
depGroupBumpType
|
|
3677
|
+
);
|
|
3678
|
+
await this.#bumpVersionForProject(
|
|
3679
|
+
project,
|
|
3680
|
+
depBumpType,
|
|
3681
|
+
"DEPENDENCY_ACROSS_GROUPS_WAS_BUMPED",
|
|
3682
|
+
{}
|
|
3683
|
+
);
|
|
3684
|
+
this.#bumpedProjects.add(project);
|
|
3685
|
+
await this.#updateDependenciesForProject(project);
|
|
3686
|
+
}
|
|
3687
|
+
}
|
|
3688
|
+
}
|
|
3689
|
+
}
|
|
3690
|
+
if (bumpedByDependency) {
|
|
3691
|
+
for (const project of sortedProjects2) {
|
|
3692
|
+
if (!this.#bumpedProjects.has(project)) {
|
|
3693
|
+
await this.#bumpVersionForProject(
|
|
3694
|
+
project,
|
|
3695
|
+
this.#applyPreidToBumpType("patch", project),
|
|
3696
|
+
"OTHER_PROJECT_IN_FIXED_GROUP_WAS_BUMPED_DUE_TO_DEPENDENCY",
|
|
3697
|
+
{}
|
|
3698
|
+
);
|
|
3699
|
+
this.#bumpedProjects.add(project);
|
|
3700
|
+
await this.#updateDependenciesForProject(project);
|
|
3701
|
+
}
|
|
3702
|
+
}
|
|
3703
|
+
} else {
|
|
3704
|
+
for (const project of releaseGroup.projects) {
|
|
3705
|
+
this.#versionData.set(project, {
|
|
3706
|
+
currentVersion: this.#getCurrentCachedVersionForProject(
|
|
3707
|
+
project
|
|
3708
|
+
),
|
|
3709
|
+
newVersion: null,
|
|
3710
|
+
dockerVersion: null,
|
|
3711
|
+
dependentProjects: this.#getOriginalDependentProjects(project)
|
|
3712
|
+
});
|
|
3713
|
+
if (project === firstProject) {
|
|
3714
|
+
continue;
|
|
3715
|
+
}
|
|
3716
|
+
const projectLogger = this.#getProjectLoggerForProject(project);
|
|
3717
|
+
projectLogger.buffer(
|
|
3718
|
+
`\u{1F6AB} Skipping versioning for ${project} as it is a part of a fixed release group with ${firstProject} and no dependency bumps were detected`
|
|
3719
|
+
);
|
|
3720
|
+
}
|
|
3721
|
+
}
|
|
3722
|
+
return bumpedByDependency;
|
|
3723
|
+
}
|
|
3724
|
+
const { newVersion } = await this.#calculateNewVersion(
|
|
3725
|
+
firstProject,
|
|
3726
|
+
newVersionInput,
|
|
3727
|
+
newVersionInputReason,
|
|
3728
|
+
newVersionInputReasonData
|
|
3729
|
+
);
|
|
3730
|
+
const sortedProjects = this.#releaseGraph.sortedProjects.get(releaseGroup.name) || releaseGroup.projects;
|
|
3731
|
+
for (const project of sortedProjects) {
|
|
3732
|
+
const versionActions = this.#getVersionActionsForProject(project);
|
|
3733
|
+
const projectLogger = this.#getProjectLoggerForProject(project);
|
|
3734
|
+
const currentVersion = this.#getCurrentCachedVersionForProject(
|
|
3735
|
+
project
|
|
3736
|
+
);
|
|
3737
|
+
if (project !== firstProject) {
|
|
3738
|
+
projectLogger.buffer(
|
|
3739
|
+
`\u2753 Applied version ${newVersion} directly, because the project is a member of a fixed release group containing ${firstProject}`
|
|
3740
|
+
);
|
|
3741
|
+
}
|
|
3742
|
+
const logMessages = await versionActions.updateProjectVersion(
|
|
3743
|
+
this.#tree,
|
|
3744
|
+
newVersion
|
|
3745
|
+
);
|
|
3746
|
+
for (const logMessage of logMessages) {
|
|
3747
|
+
projectLogger.buffer(logMessage);
|
|
3748
|
+
}
|
|
3749
|
+
this.#bumpedProjects.add(project);
|
|
3750
|
+
bumped = true;
|
|
3751
|
+
this.#versionData.set(project, {
|
|
3752
|
+
currentVersion,
|
|
3753
|
+
newVersion,
|
|
3754
|
+
dependentProjects: this.#getOriginalDependentProjects(project)
|
|
3755
|
+
});
|
|
3756
|
+
}
|
|
3757
|
+
if (bumped) {
|
|
3758
|
+
for (const project of sortedProjects) {
|
|
3759
|
+
await this.#updateDependenciesForProject(project);
|
|
3760
|
+
}
|
|
3761
|
+
}
|
|
3762
|
+
return bumped;
|
|
3763
|
+
}
|
|
3764
|
+
#getOriginalDependentProjects(project) {
|
|
3765
|
+
return this.#releaseGraph.originalDependentProjectsPerProject.get(project) || [];
|
|
3766
|
+
}
|
|
3767
|
+
async #updateDependenciesForProject(projectName) {
|
|
3768
|
+
if (!this.#releaseGraph.allProjectsToProcess.has(projectName)) {
|
|
3769
|
+
throw new Error(
|
|
3770
|
+
`Unable to find ${projectName} in allProjectsToProcess, please report this as a bug on https://github.com/nrwl/nx/issues`
|
|
3771
|
+
);
|
|
3772
|
+
}
|
|
3773
|
+
const versionActions = this.#getVersionActionsForProject(projectName);
|
|
3774
|
+
const cachedFinalConfigForProject = this.#getCachedFinalConfigForProject(projectName);
|
|
3775
|
+
const dependenciesToUpdate = {};
|
|
3776
|
+
const dependencies = this.#projectGraph.dependencies[projectName] || [];
|
|
3777
|
+
for (const dep of dependencies) {
|
|
3778
|
+
if (this.#releaseGraph.allProjectsToProcess.has(dep.target)) {
|
|
3779
|
+
const targetVersionData = this.#versionData.get(dep.target);
|
|
3780
|
+
if (targetVersionData) {
|
|
3781
|
+
const { currentVersion: currentDependencyVersion } = await versionActions.readCurrentVersionOfDependency(
|
|
3782
|
+
this.#tree,
|
|
3783
|
+
this.#projectGraph,
|
|
3784
|
+
dep.target
|
|
3785
|
+
);
|
|
3786
|
+
if (!currentDependencyVersion) {
|
|
3787
|
+
continue;
|
|
3788
|
+
}
|
|
3789
|
+
let finalPrefix = "";
|
|
3790
|
+
if (cachedFinalConfigForProject.versionPrefix === "auto") {
|
|
3791
|
+
const prefixMatch = currentDependencyVersion?.match(/^([~^=])/);
|
|
3792
|
+
finalPrefix = prefixMatch ? prefixMatch[1] : "";
|
|
3793
|
+
} else if (cachedFinalConfigForProject.versionPrefix && ["~", "^", "="].includes(cachedFinalConfigForProject.versionPrefix)) {
|
|
3794
|
+
finalPrefix = cachedFinalConfigForProject.versionPrefix;
|
|
3795
|
+
}
|
|
3796
|
+
const newVersion = targetVersionData.newVersion ?? this.#releaseGraph.cachedCurrentVersions.get(dep.target) ?? currentDependencyVersion;
|
|
3797
|
+
const cleanNewVersion = newVersion.replace(/^[~^=]/, "");
|
|
3798
|
+
dependenciesToUpdate[dep.target] = `${finalPrefix}${cleanNewVersion}`;
|
|
3799
|
+
}
|
|
3800
|
+
}
|
|
3801
|
+
}
|
|
3802
|
+
const projectLogger = this.#getProjectLoggerForProject(projectName);
|
|
3803
|
+
const logMessages = await versionActions.updateProjectDependencies(
|
|
3804
|
+
this.#tree,
|
|
3805
|
+
this.#projectGraph,
|
|
3806
|
+
dependenciesToUpdate
|
|
3807
|
+
);
|
|
3808
|
+
for (const logMessage of logMessages) {
|
|
3809
|
+
projectLogger.buffer(logMessage);
|
|
3810
|
+
}
|
|
3811
|
+
}
|
|
3812
|
+
#getVersionActionsForProject(projectName) {
|
|
3813
|
+
const versionActions = this.#releaseGraph.projectsToVersionActions.get(projectName);
|
|
3814
|
+
if (!versionActions) {
|
|
3815
|
+
throw new Error(
|
|
3816
|
+
`No versionActions found for project ${projectName}, please report this as a bug on https://github.com/nrwl/nx/issues`
|
|
3817
|
+
);
|
|
3818
|
+
}
|
|
3819
|
+
return versionActions;
|
|
3820
|
+
}
|
|
3821
|
+
async #getFixedReleaseGroupBumpType(releaseGroupName) {
|
|
3822
|
+
const releaseGroup = this.#releaseGraph.groupGraph.get(releaseGroupName).group;
|
|
3823
|
+
const releaseGroupFilteredProjects = this.#releaseGraph.releaseGroupToFilteredProjects.get(releaseGroup);
|
|
3824
|
+
if (!releaseGroupFilteredProjects || releaseGroupFilteredProjects.size === 0) {
|
|
3825
|
+
return "none";
|
|
3826
|
+
}
|
|
3827
|
+
const anyProject = releaseGroupFilteredProjects.values().next().value;
|
|
3828
|
+
const { currentVersion, newVersion } = this.#versionData.get(anyProject);
|
|
3829
|
+
if (newVersion) {
|
|
3830
|
+
return semver.diff(currentVersion, newVersion);
|
|
3831
|
+
}
|
|
3832
|
+
return (await this.#determineVersionBumpForProject(releaseGroup, anyProject)).newVersionInput;
|
|
3833
|
+
}
|
|
3834
|
+
// TODO: Support influencing the side effect bump in a future version, always patch for now like in legacy versioning
|
|
3835
|
+
#determineSideEffectBump(releaseGroup, dependencyBumpType) {
|
|
3836
|
+
const anyProject = releaseGroup.projects[0];
|
|
3837
|
+
return this.#applyPreidToBumpType("patch", anyProject);
|
|
3838
|
+
}
|
|
3839
|
+
/**
|
|
3840
|
+
* When a preid is set (e.g. --preid rc) and the project has opted in via
|
|
3841
|
+
* `applyPreidToDependents`, convert a "patch" side-effect bump into a
|
|
3842
|
+
* "prepatch" so that semver.inc() actually applies the preid.
|
|
3843
|
+
* semver.inc('1.0.0', 'patch', 'rc') ignores preid and returns '1.0.1'.
|
|
3844
|
+
* semver.inc('1.0.0', 'prepatch', 'rc') returns '1.0.1-rc.0' as expected.
|
|
3845
|
+
*/
|
|
3846
|
+
#applyPreidToBumpType(bumpType, projectName) {
|
|
3847
|
+
if (!(this.versionOptions.preid && this.workspaceConfig.preid) || bumpType === "none" || bumpType.startsWith("pre")) {
|
|
3848
|
+
return bumpType;
|
|
3849
|
+
}
|
|
3850
|
+
const finalConfig = this.#getCachedFinalConfigForProject(projectName);
|
|
3851
|
+
if (!finalConfig.applyPreidToDependents) {
|
|
3852
|
+
return bumpType;
|
|
3853
|
+
}
|
|
3854
|
+
switch (bumpType) {
|
|
3855
|
+
case "major":
|
|
3856
|
+
return "premajor";
|
|
3857
|
+
case "minor":
|
|
3858
|
+
return "preminor";
|
|
3859
|
+
case "patch":
|
|
3860
|
+
return "prepatch";
|
|
3861
|
+
default:
|
|
3862
|
+
return bumpType;
|
|
3863
|
+
}
|
|
3864
|
+
}
|
|
3865
|
+
#getCachedFinalConfigForProject(projectName) {
|
|
3866
|
+
const cachedFinalConfig = this.#releaseGraph.finalConfigsByProject.get(projectName);
|
|
3867
|
+
if (!cachedFinalConfig) {
|
|
3868
|
+
throw new Error(
|
|
3869
|
+
`Unexpected error: No cached config found for project ${projectName}, please report this as a bug on https://github.com/nrwl/nx/issues`
|
|
3870
|
+
);
|
|
3871
|
+
}
|
|
3872
|
+
return cachedFinalConfig;
|
|
3873
|
+
}
|
|
3874
|
+
async #bumpIndependentVersionGroup(releaseGroup) {
|
|
3875
|
+
const releaseGroupFilteredProjects = this.#releaseGraph.releaseGroupToFilteredProjects.get(releaseGroup);
|
|
3876
|
+
let bumped = false;
|
|
3877
|
+
const projectBumpTypes = /* @__PURE__ */ new Map();
|
|
3878
|
+
const projectsToUpdate = /* @__PURE__ */ new Set();
|
|
3879
|
+
if (releaseGroupFilteredProjects && releaseGroupFilteredProjects.size > 0) {
|
|
3880
|
+
for (const project of releaseGroupFilteredProjects) {
|
|
3881
|
+
const {
|
|
3882
|
+
newVersionInput: bumpType,
|
|
3883
|
+
newVersionInputReason: bumpTypeReason,
|
|
3884
|
+
newVersionInputReasonData: bumpTypeReasonData
|
|
3885
|
+
} = await this.#determineVersionBumpForProject(releaseGroup, project);
|
|
3886
|
+
projectBumpTypes.set(project, {
|
|
3887
|
+
bumpType,
|
|
3888
|
+
bumpTypeReason,
|
|
3889
|
+
bumpTypeReasonData
|
|
3890
|
+
});
|
|
3891
|
+
if (bumpType !== "none") {
|
|
3892
|
+
projectsToUpdate.add(project);
|
|
3893
|
+
}
|
|
3894
|
+
}
|
|
3895
|
+
const sortedProjects = this.#releaseGraph.sortedProjects.get(releaseGroup.name) || [];
|
|
3896
|
+
for (const project of sortedProjects) {
|
|
3897
|
+
if (projectsToUpdate.has(project) && releaseGroupFilteredProjects?.has(project)) {
|
|
3898
|
+
const {
|
|
3899
|
+
bumpType: finalBumpType,
|
|
3900
|
+
bumpTypeReason: finalBumpTypeReason,
|
|
3901
|
+
bumpTypeReasonData: finalBumpTypeReasonData
|
|
3902
|
+
} = projectBumpTypes.get(project);
|
|
3903
|
+
if (finalBumpType !== "none") {
|
|
3904
|
+
await this.#bumpVersionForProject(
|
|
3905
|
+
project,
|
|
3906
|
+
finalBumpType,
|
|
3907
|
+
finalBumpTypeReason,
|
|
3908
|
+
finalBumpTypeReasonData
|
|
3909
|
+
);
|
|
3910
|
+
this.#bumpedProjects.add(project);
|
|
3911
|
+
bumped = true;
|
|
3912
|
+
}
|
|
3913
|
+
}
|
|
3914
|
+
}
|
|
3915
|
+
for (const project of sortedProjects) {
|
|
3916
|
+
if (projectsToUpdate.has(project) && releaseGroupFilteredProjects?.has(project)) {
|
|
3917
|
+
await this.#updateDependenciesForProject(project);
|
|
3918
|
+
}
|
|
3919
|
+
}
|
|
3920
|
+
}
|
|
3921
|
+
return bumped;
|
|
3922
|
+
}
|
|
3923
|
+
#getCurrentCachedVersionForProject(projectName) {
|
|
3924
|
+
return this.#releaseGraph.cachedCurrentVersions.get(projectName) || null;
|
|
3925
|
+
}
|
|
3926
|
+
async #calculateNewVersion(project, newVersionInput, newVersionInputReason, newVersionInputReasonData) {
|
|
3927
|
+
const currentVersion = this.#getCurrentCachedVersionForProject(project);
|
|
3928
|
+
const versionActions = this.#getVersionActionsForProject(project);
|
|
3929
|
+
const { newVersion, logText } = await versionActions.calculateNewVersion(
|
|
3930
|
+
currentVersion,
|
|
3931
|
+
newVersionInput,
|
|
3932
|
+
newVersionInputReason,
|
|
3933
|
+
newVersionInputReasonData,
|
|
3934
|
+
this.versionOptions.preid || this.workspaceConfig.preid || ""
|
|
3935
|
+
);
|
|
3936
|
+
const projectLogger = this.#getProjectLoggerForProject(project);
|
|
3937
|
+
projectLogger.buffer(logText);
|
|
3938
|
+
return { currentVersion, newVersion };
|
|
3939
|
+
}
|
|
3940
|
+
async #bumpVersionForProject(projectName, bumpType, bumpTypeReason, bumpTypeReasonData) {
|
|
3941
|
+
const projectLogger = this.#getProjectLoggerForProject(projectName);
|
|
3942
|
+
if (bumpType === "none") {
|
|
3943
|
+
projectLogger.buffer(
|
|
3944
|
+
`\u23E9 Skipping bump for ${projectName} as bump type is "none"`
|
|
3945
|
+
);
|
|
3946
|
+
return;
|
|
3947
|
+
}
|
|
3948
|
+
const versionActions = this.#getVersionActionsForProject(projectName);
|
|
3949
|
+
const { currentVersion, newVersion } = await this.#calculateNewVersion(
|
|
3950
|
+
projectName,
|
|
3951
|
+
bumpType,
|
|
3952
|
+
bumpTypeReason,
|
|
3953
|
+
bumpTypeReasonData
|
|
3954
|
+
);
|
|
3955
|
+
const logMessages = await versionActions.updateProjectVersion(
|
|
3956
|
+
this.#tree,
|
|
3957
|
+
newVersion
|
|
3958
|
+
);
|
|
3959
|
+
for (const logMessage of logMessages) {
|
|
3960
|
+
projectLogger.buffer(logMessage);
|
|
3961
|
+
}
|
|
3962
|
+
this.#versionData.set(projectName, {
|
|
3963
|
+
currentVersion,
|
|
3964
|
+
newVersion,
|
|
3965
|
+
dependentProjects: this.#getOriginalDependentProjects(projectName)
|
|
3966
|
+
});
|
|
3967
|
+
this.#bumpedProjects.add(projectName);
|
|
3968
|
+
const releaseGroupName = this.getReleaseGroupNameForProject(projectName);
|
|
3969
|
+
if (!releaseGroupName) {
|
|
3970
|
+
projectLogger.buffer(
|
|
3971
|
+
`\u26A0\uFE0F Cannot find release group for ${projectName}, skipping dependent updates`
|
|
3972
|
+
);
|
|
3973
|
+
return;
|
|
3974
|
+
}
|
|
3975
|
+
const releaseGroup = this.#releaseGraph.groupGraph.get(releaseGroupName).group;
|
|
3976
|
+
const releaseGroupVersionConfig = releaseGroup.version;
|
|
3977
|
+
const updateDependents = releaseGroupVersionConfig?.updateDependents || "always";
|
|
3978
|
+
if (updateDependents === "auto" || updateDependents === "always") {
|
|
3979
|
+
const dependents = this.#getNonImplicitDependentsForProject(projectName);
|
|
3980
|
+
const dependentsToProcess = dependents.filter(
|
|
3981
|
+
(dep) => this.#releaseGraph.allProjectsToProcess.has(dep)
|
|
3982
|
+
);
|
|
3983
|
+
await this.#updateDependenciesForDependents(dependentsToProcess);
|
|
3984
|
+
for (const dependent of dependentsToProcess) {
|
|
3985
|
+
if (!this.#bumpedProjects.has(dependent)) {
|
|
3986
|
+
await this.#bumpVersionForProject(
|
|
3987
|
+
dependent,
|
|
3988
|
+
this.#applyPreidToBumpType("patch", dependent),
|
|
3989
|
+
"DEPENDENCY_WAS_BUMPED",
|
|
3990
|
+
{}
|
|
3991
|
+
);
|
|
3992
|
+
}
|
|
3993
|
+
}
|
|
3994
|
+
} else {
|
|
3995
|
+
const releaseGroupText = releaseGroupName !== IMPLICIT_DEFAULT_RELEASE_GROUP ? ` in release group "${releaseGroupName}" ` : " ";
|
|
3996
|
+
projectLogger.buffer(
|
|
3997
|
+
`\u23E9 Skipping dependent updates as "updateDependents"${releaseGroupText}is not "auto"`
|
|
3998
|
+
);
|
|
3999
|
+
}
|
|
4000
|
+
}
|
|
4001
|
+
#getProjectDependents(project) {
|
|
4002
|
+
return this.#releaseGraph.projectToDependents.get(project) || /* @__PURE__ */ new Set();
|
|
4003
|
+
}
|
|
4004
|
+
#getNonImplicitDependentsForProject(project) {
|
|
4005
|
+
return Array.from(this.#getProjectDependents(project));
|
|
4006
|
+
}
|
|
4007
|
+
async #updateDependenciesForDependents(dependents) {
|
|
4008
|
+
for (const dependent of dependents) {
|
|
4009
|
+
if (!this.#releaseGraph?.allProjectsToProcess.has(dependent)) {
|
|
4010
|
+
throw new Error(
|
|
4011
|
+
`Unable to find project "${dependent}" in allProjectsToProcess, please report this as a bug on https://github.com/nrwl/nx/issues`
|
|
4012
|
+
);
|
|
4013
|
+
}
|
|
4014
|
+
await this.#updateDependenciesForProject(dependent);
|
|
4015
|
+
}
|
|
4016
|
+
}
|
|
4017
|
+
async #determineVersionBumpForProject(releaseGroup, projectName) {
|
|
4018
|
+
if (this.versionOptions.specifier) {
|
|
4019
|
+
return {
|
|
4020
|
+
newVersionInput: this.versionOptions.specifier,
|
|
4021
|
+
newVersionInputReason: "USER_SPECIFIER",
|
|
4022
|
+
newVersionInputReasonData: {}
|
|
4023
|
+
};
|
|
4024
|
+
}
|
|
4025
|
+
const projectGraphNode = this.#projectGraph.nodes[projectName];
|
|
4026
|
+
const projectLogger = this.#getProjectLoggerForProject(projectName);
|
|
4027
|
+
const cachedFinalConfigForProject = this.#getCachedFinalConfigForProject(projectName);
|
|
4028
|
+
if (cachedFinalConfigForProject.specifierSource === "conventional-commits") {
|
|
4029
|
+
const currentVersion = this.#getCurrentCachedVersionForProject(projectName);
|
|
4030
|
+
const bumpType = await deriveSpecifierFromConventionalCommits(
|
|
4031
|
+
{
|
|
4032
|
+
...this.#nxReleaseConfig,
|
|
4033
|
+
git: this.#nxReleaseConfig.git ?? {}
|
|
4034
|
+
},
|
|
4035
|
+
this.#projectGraph,
|
|
4036
|
+
projectLogger,
|
|
4037
|
+
releaseGroup,
|
|
4038
|
+
projectGraphNode,
|
|
4039
|
+
!!semver.prerelease(currentVersion ?? ""),
|
|
4040
|
+
this.#releaseGraph.cachedLatestMatchingGitTag.get(projectName),
|
|
4041
|
+
this.#releaseGraph,
|
|
4042
|
+
cachedFinalConfigForProject.fallbackCurrentVersionResolver,
|
|
4043
|
+
this.versionOptions.preid || this.workspaceConfig.preid || ""
|
|
4044
|
+
);
|
|
4045
|
+
return {
|
|
4046
|
+
newVersionInput: bumpType,
|
|
4047
|
+
newVersionInputReason: "CONVENTIONAL_COMMITS",
|
|
4048
|
+
newVersionInputReasonData: {}
|
|
4049
|
+
};
|
|
4050
|
+
}
|
|
4051
|
+
if (releaseGroup.versionPlans) {
|
|
4052
|
+
const currentVersion = this.#getCurrentCachedVersionForProject(projectName);
|
|
4053
|
+
const { bumpType, versionPlanPath } = await deriveSpecifierFromVersionPlan(
|
|
4054
|
+
projectLogger,
|
|
4055
|
+
releaseGroup,
|
|
4056
|
+
projectGraphNode,
|
|
4057
|
+
currentVersion
|
|
4058
|
+
);
|
|
4059
|
+
if (bumpType !== "none") {
|
|
4060
|
+
this.#processedVersionPlanFiles.add(versionPlanPath);
|
|
4061
|
+
}
|
|
4062
|
+
return {
|
|
4063
|
+
newVersionInput: bumpType,
|
|
4064
|
+
newVersionInputReason: "VERSION_PLANS",
|
|
4065
|
+
newVersionInputReasonData: {
|
|
4066
|
+
versionPlanPath
|
|
4067
|
+
}
|
|
4068
|
+
};
|
|
4069
|
+
}
|
|
4070
|
+
const versionActions = this.#getVersionActionsForProject(projectName);
|
|
4071
|
+
if (versionActions instanceof NOOP_VERSION_ACTIONS) {
|
|
4072
|
+
return {
|
|
4073
|
+
newVersionInput: "none",
|
|
4074
|
+
newVersionInputReason: "NOOP_VERSION_ACTIONS",
|
|
4075
|
+
newVersionInputReasonData: {}
|
|
4076
|
+
};
|
|
4077
|
+
}
|
|
4078
|
+
throw new Error(
|
|
4079
|
+
`Unhandled version bump config, please report this as a bug on https://github.com/nrwl/nx/issues`
|
|
4080
|
+
);
|
|
4081
|
+
}
|
|
4082
|
+
#getProjectLoggerForProject(projectName) {
|
|
4083
|
+
const projectLogger = this.#releaseGraph.projectLoggers.get(projectName);
|
|
4084
|
+
if (!projectLogger) {
|
|
4085
|
+
throw new Error(
|
|
4086
|
+
`No project logger found for project ${projectName}, please report this as a bug on https://github.com/nrwl/nx/issues`
|
|
4087
|
+
);
|
|
4088
|
+
}
|
|
4089
|
+
return projectLogger;
|
|
4090
|
+
}
|
|
4091
|
+
};
|
|
3323
4092
|
|
|
3324
4093
|
// src/release/release-client.ts
|
|
3325
4094
|
var StormReleaseClient = class _StormReleaseClient extends ReleaseClient {
|
|
@@ -3327,24 +4096,90 @@ var StormReleaseClient = class _StormReleaseClient extends ReleaseClient {
|
|
|
3327
4096
|
if (!workspaceConfig) {
|
|
3328
4097
|
workspaceConfig = await getWorkspaceConfig();
|
|
3329
4098
|
}
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
}
|
|
3334
|
-
projectGraph = await createProjectGraphAsync$2({
|
|
3335
|
-
exitOnError: true,
|
|
3336
|
-
resetDaemonClient: true
|
|
3337
|
-
});
|
|
3338
|
-
}
|
|
4099
|
+
const projectGraph = await createProjectGraphAsync$2({
|
|
4100
|
+
exitOnError: true,
|
|
4101
|
+
resetDaemonClient: true
|
|
4102
|
+
});
|
|
3339
4103
|
if (!projectGraph) {
|
|
3340
4104
|
throw new Error(
|
|
3341
4105
|
"Failed to load the project graph. Please run `nx reset`, then run the `storm-git commit` command again."
|
|
3342
4106
|
);
|
|
3343
4107
|
}
|
|
4108
|
+
let nxJson;
|
|
4109
|
+
if (!ignoreNxJsonConfig && existsSync(joinPaths(workspaceConfig.workspaceRoot, "nx.json"))) {
|
|
4110
|
+
nxJson = readNxJson();
|
|
4111
|
+
}
|
|
4112
|
+
const config5 = defu(
|
|
4113
|
+
{
|
|
4114
|
+
changelog: {
|
|
4115
|
+
renderOptions: {
|
|
4116
|
+
workspaceConfig
|
|
4117
|
+
}
|
|
4118
|
+
}
|
|
4119
|
+
},
|
|
4120
|
+
{
|
|
4121
|
+
groups: getReleaseGroupConfig(releaseConfig, workspaceConfig)
|
|
4122
|
+
},
|
|
4123
|
+
{
|
|
4124
|
+
groups: getReleaseGroupConfig(
|
|
4125
|
+
nxJson.release ?? {},
|
|
4126
|
+
workspaceConfig
|
|
4127
|
+
)
|
|
4128
|
+
},
|
|
4129
|
+
omit(releaseConfig, ["groups"]),
|
|
4130
|
+
nxJson.release ? omit(nxJson.release, ["groups"]) : {},
|
|
4131
|
+
omit(DEFAULT_RELEASE_CONFIG, ["groups"])
|
|
4132
|
+
);
|
|
4133
|
+
const normalizedConfig = clone(config5);
|
|
4134
|
+
if (workspaceConfig.preid) {
|
|
4135
|
+
normalizedConfig.groups = Object.fromEntries(
|
|
4136
|
+
Object.entries(normalizedConfig.groups ?? {}).map(([name, group]) => {
|
|
4137
|
+
return [
|
|
4138
|
+
name,
|
|
4139
|
+
{
|
|
4140
|
+
...group,
|
|
4141
|
+
version: {
|
|
4142
|
+
...group.version,
|
|
4143
|
+
preid: workspaceConfig.preid
|
|
4144
|
+
}
|
|
4145
|
+
}
|
|
4146
|
+
];
|
|
4147
|
+
})
|
|
4148
|
+
);
|
|
4149
|
+
}
|
|
4150
|
+
const alreadyMatchedProjects = /* @__PURE__ */ new Set();
|
|
4151
|
+
normalizedConfig.groups = Object.fromEntries(
|
|
4152
|
+
Object.entries(normalizedConfig.groups ?? {}).map(([name, group]) => {
|
|
4153
|
+
const matchingProjects = findMatchingProjects(
|
|
4154
|
+
group.projects,
|
|
4155
|
+
projectGraph.nodes
|
|
4156
|
+
);
|
|
4157
|
+
if (!matchingProjects.length) {
|
|
4158
|
+
throw new Error(
|
|
4159
|
+
`Release group "${name}" does not have any matching projects.`
|
|
4160
|
+
);
|
|
4161
|
+
}
|
|
4162
|
+
for (const project of matchingProjects) {
|
|
4163
|
+
if (alreadyMatchedProjects.has(project)) {
|
|
4164
|
+
throw new Error(
|
|
4165
|
+
`Project "${project}" is included in more than one release group. Please ensure that each project is only included in one release group, or remove the "projects" property from the release group configuration to allow it to be included in the same release group as other projects with overlapping globs.`
|
|
4166
|
+
);
|
|
4167
|
+
}
|
|
4168
|
+
alreadyMatchedProjects.add(project);
|
|
4169
|
+
}
|
|
4170
|
+
return [
|
|
4171
|
+
name,
|
|
4172
|
+
{
|
|
4173
|
+
...group,
|
|
4174
|
+
projects: matchingProjects
|
|
4175
|
+
}
|
|
4176
|
+
];
|
|
4177
|
+
})
|
|
4178
|
+
);
|
|
3344
4179
|
return new _StormReleaseClient(
|
|
3345
4180
|
projectGraph,
|
|
3346
|
-
|
|
3347
|
-
|
|
4181
|
+
config5,
|
|
4182
|
+
normalizedConfig,
|
|
3348
4183
|
workspaceConfig
|
|
3349
4184
|
);
|
|
3350
4185
|
}
|
|
@@ -3352,6 +4187,10 @@ var StormReleaseClient = class _StormReleaseClient extends ReleaseClient {
|
|
|
3352
4187
|
* The release configuration used by this release client.
|
|
3353
4188
|
*/
|
|
3354
4189
|
config;
|
|
4190
|
+
/**
|
|
4191
|
+
* The normalized release configuration used by this release client.
|
|
4192
|
+
*/
|
|
4193
|
+
normalizedConfig;
|
|
3355
4194
|
/**
|
|
3356
4195
|
* The workspace configuration used by this release client.
|
|
3357
4196
|
*/
|
|
@@ -3376,40 +4215,16 @@ var StormReleaseClient = class _StormReleaseClient extends ReleaseClient {
|
|
|
3376
4215
|
* @param ignoreNxJsonConfig - Whether to ignore the nx.json configuration and use only the provided {@link releaseConfig}. Default is false.
|
|
3377
4216
|
* @param workspaceConfig - Optional Storm workspace configuration object for logging purposes.
|
|
3378
4217
|
*/
|
|
3379
|
-
constructor(projectGraph,
|
|
3380
|
-
|
|
3381
|
-
if (!ignoreNxJsonConfig && existsSync(joinPaths(workspaceConfig.workspaceRoot, "nx.json"))) {
|
|
3382
|
-
nxJson = readNxJson();
|
|
3383
|
-
}
|
|
3384
|
-
const config5 = defu(
|
|
3385
|
-
{
|
|
3386
|
-
changelog: {
|
|
3387
|
-
renderOptions: {
|
|
3388
|
-
workspaceConfig
|
|
3389
|
-
}
|
|
3390
|
-
}
|
|
3391
|
-
},
|
|
3392
|
-
{
|
|
3393
|
-
groups: getReleaseGroupConfig(releaseConfig, workspaceConfig)
|
|
3394
|
-
},
|
|
3395
|
-
{
|
|
3396
|
-
groups: getReleaseGroupConfig(
|
|
3397
|
-
nxJson.release ?? {},
|
|
3398
|
-
workspaceConfig
|
|
3399
|
-
)
|
|
3400
|
-
},
|
|
3401
|
-
omit(releaseConfig, ["groups"]),
|
|
3402
|
-
nxJson.release ? omit(nxJson.release, ["groups"]) : {},
|
|
3403
|
-
omit(DEFAULT_RELEASE_CONFIG, ["groups"])
|
|
3404
|
-
);
|
|
3405
|
-
super(config5, true);
|
|
4218
|
+
constructor(projectGraph, config5, normalizedConfig, workspaceConfig) {
|
|
4219
|
+
super(normalizedConfig, true);
|
|
3406
4220
|
writeDebug(
|
|
3407
4221
|
"Executing release with the following configuration",
|
|
3408
4222
|
workspaceConfig
|
|
3409
4223
|
);
|
|
3410
|
-
writeDebug(
|
|
4224
|
+
writeDebug(normalizedConfig, workspaceConfig);
|
|
3411
4225
|
this.projectGraph = projectGraph;
|
|
3412
4226
|
this.config = config5;
|
|
4227
|
+
this.normalizedConfig = normalizedConfig;
|
|
3413
4228
|
this.workspaceConfig = workspaceConfig;
|
|
3414
4229
|
this.tree = new FsTree(workspaceConfig.workspaceRoot, false);
|
|
3415
4230
|
this.projectConfigurations = readProjectsConfigurationFromProjectGraph$2(projectGraph);
|
|
@@ -3425,8 +4240,19 @@ var StormReleaseClient = class _StormReleaseClient extends ReleaseClient {
|
|
|
3425
4240
|
v.newVersion ? extractPreid(v.newVersion) : void 0
|
|
3426
4241
|
])
|
|
3427
4242
|
);
|
|
4243
|
+
const releaseGraph = options.releaseGraph ?? await createReleaseGraph({
|
|
4244
|
+
tree: this.tree,
|
|
4245
|
+
projectGraph: this.projectGraph,
|
|
4246
|
+
nxReleaseConfig: this.normalizedConfig,
|
|
4247
|
+
filters: {
|
|
4248
|
+
projects: options.projects,
|
|
4249
|
+
groups: options.groups
|
|
4250
|
+
},
|
|
4251
|
+
firstRelease: !!options.firstRelease,
|
|
4252
|
+
verbose: isVerbose(this.workspaceConfig.logLevel)
|
|
4253
|
+
});
|
|
3428
4254
|
const projectToAdditionalDependencyBumps = /* @__PURE__ */ new Map();
|
|
3429
|
-
for (const releaseGroup of
|
|
4255
|
+
for (const releaseGroup of releaseGraph.releaseGroups) {
|
|
3430
4256
|
if (releaseGroup.projectsRelationship !== "independent") {
|
|
3431
4257
|
continue;
|
|
3432
4258
|
}
|
|
@@ -3454,12 +4280,12 @@ var StormReleaseClient = class _StormReleaseClient extends ReleaseClient {
|
|
|
3454
4280
|
}
|
|
3455
4281
|
}
|
|
3456
4282
|
const allProjectChangelogs = {};
|
|
3457
|
-
for (const releaseGroup of
|
|
4283
|
+
for (const releaseGroup of releaseGraph.releaseGroups) {
|
|
3458
4284
|
const config5 = releaseGroup.changelog;
|
|
3459
4285
|
if (config5 === false) {
|
|
3460
4286
|
continue;
|
|
3461
4287
|
}
|
|
3462
|
-
if (!
|
|
4288
|
+
if (!releaseGraph.releaseGroupToFilteredProjects.has(releaseGroup)) {
|
|
3463
4289
|
throw new Error(
|
|
3464
4290
|
`No filtered projects found for release group ${releaseGroup.name}`
|
|
3465
4291
|
);
|
|
@@ -3468,9 +4294,7 @@ var StormReleaseClient = class _StormReleaseClient extends ReleaseClient {
|
|
|
3468
4294
|
// 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
|
|
3469
4295
|
Array.from(
|
|
3470
4296
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
3471
|
-
|
|
3472
|
-
releaseGroup
|
|
3473
|
-
)
|
|
4297
|
+
releaseGraph.releaseGroupToFilteredProjects.get(releaseGroup)
|
|
3474
4298
|
).flatMap((project) => {
|
|
3475
4299
|
return [
|
|
3476
4300
|
project,
|
|
@@ -3493,9 +4317,10 @@ var StormReleaseClient = class _StormReleaseClient extends ReleaseClient {
|
|
|
3493
4317
|
projectName: project.name,
|
|
3494
4318
|
releaseGroupName: releaseGroup.name
|
|
3495
4319
|
},
|
|
4320
|
+
releaseGraph.resolveRepositoryTags.bind(releaseGraph),
|
|
3496
4321
|
{
|
|
3497
4322
|
checkAllBranchesWhen: releaseGroup.releaseTag.checkAllBranchesWhen,
|
|
3498
|
-
preid: projectsPreid[project.name],
|
|
4323
|
+
preid: projectsPreid[project.name] || this.workspaceConfig.preid,
|
|
3499
4324
|
requireSemver: releaseGroup.releaseTag.requireSemver,
|
|
3500
4325
|
strictPreid: releaseGroup.releaseTag.strictPreid
|
|
3501
4326
|
}
|
|
@@ -3549,7 +4374,7 @@ var StormReleaseClient = class _StormReleaseClient extends ReleaseClient {
|
|
|
3549
4374
|
fileMap.nonProjectFiles
|
|
3550
4375
|
) ? "*" : getProjectsAffectedByCommit(c, fileToProjectMap)
|
|
3551
4376
|
})),
|
|
3552
|
-
this.
|
|
4377
|
+
this.normalizedConfig.conventionalCommits
|
|
3553
4378
|
);
|
|
3554
4379
|
writeDebug(
|
|
3555
4380
|
`Running changelog generation for the ${releaseGroup.name} release group`,
|
|
@@ -3583,12 +4408,15 @@ var StormReleaseClient = class _StormReleaseClient extends ReleaseClient {
|
|
|
3583
4408
|
let changes = [];
|
|
3584
4409
|
let fromRef = options.from || (await getLatestGitTagForPattern(
|
|
3585
4410
|
releaseGroup.releaseTag.pattern,
|
|
3586
|
-
{
|
|
4411
|
+
{
|
|
4412
|
+
releaseGroupName: releaseGroup.name
|
|
4413
|
+
},
|
|
4414
|
+
releaseGraph.resolveRepositoryTags.bind(releaseGraph),
|
|
3587
4415
|
{
|
|
3588
4416
|
checkAllBranchesWhen: releaseGroup.releaseTag.checkAllBranchesWhen,
|
|
3589
|
-
preid: Object.keys(projectsPreid)[0] ? projectsPreid?.[Object.keys(projectsPreid)[0]] :
|
|
4417
|
+
preid: Object.keys(projectsPreid)[0] && projectsPreid?.[Object.keys(projectsPreid)[0]] ? projectsPreid?.[Object.keys(projectsPreid)[0]] : this.workspaceConfig.preid,
|
|
3590
4418
|
requireSemver: releaseGroup.releaseTag.requireSemver,
|
|
3591
|
-
strictPreid: releaseGroup.releaseTag.strictPreid
|
|
4419
|
+
strictPreid: releaseGroup.releaseTag.strictPreid || this.workspaceConfig.preid !== void 0
|
|
3592
4420
|
}
|
|
3593
4421
|
))?.tag;
|
|
3594
4422
|
if (!fromRef) {
|
|
@@ -3620,7 +4448,7 @@ var StormReleaseClient = class _StormReleaseClient extends ReleaseClient {
|
|
|
3620
4448
|
fileMap.nonProjectFiles
|
|
3621
4449
|
) ? "*" : getProjectsAffectedByCommit(c, fileToProjectMap)
|
|
3622
4450
|
})),
|
|
3623
|
-
this.
|
|
4451
|
+
this.normalizedConfig.conventionalCommits
|
|
3624
4452
|
);
|
|
3625
4453
|
writeDebug(
|
|
3626
4454
|
`Running changelog generation for the ${releaseGroup.name} release group`,
|
|
@@ -3676,7 +4504,7 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
|
|
|
3676
4504
|
options.releaseGraph.releaseGroups,
|
|
3677
4505
|
options.releaseGraph.releaseGroupToFilteredProjects,
|
|
3678
4506
|
options.versionData,
|
|
3679
|
-
options.gitCommitMessage || this.
|
|
4507
|
+
options.gitCommitMessage || this.normalizedConfig.changelog?.git?.commitMessage || DEFAULT_COMMIT_MESSAGE
|
|
3680
4508
|
);
|
|
3681
4509
|
const changes = this.tree.listChanges();
|
|
3682
4510
|
if (!changes.length) {
|
|
@@ -3699,7 +4527,7 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
|
|
|
3699
4527
|
isDryRun: !!options.dryRun,
|
|
3700
4528
|
isVerbose: !!options.verbose,
|
|
3701
4529
|
gitCommitMessages: commitMessageValues,
|
|
3702
|
-
gitCommitArgs: options.gitCommitArgs || this.
|
|
4530
|
+
gitCommitArgs: options.gitCommitArgs || this.normalizedConfig.changelog?.git?.commitArgs
|
|
3703
4531
|
});
|
|
3704
4532
|
latestCommit = await getCommitHash("HEAD");
|
|
3705
4533
|
writeDebug(
|
|
@@ -3709,8 +4537,8 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
|
|
|
3709
4537
|
for (const tag of gitTagValues) {
|
|
3710
4538
|
await gitTag({
|
|
3711
4539
|
tag,
|
|
3712
|
-
message: options.gitTagMessage || this.
|
|
3713
|
-
additionalArgs: options.gitTagArgs || this.
|
|
4540
|
+
message: options.gitTagMessage || this.normalizedConfig.changelog?.git?.tagMessage,
|
|
4541
|
+
additionalArgs: options.gitTagArgs || this.normalizedConfig.changelog?.git?.tagArgs,
|
|
3714
4542
|
dryRun: options.dryRun,
|
|
3715
4543
|
verbose: options.verbose
|
|
3716
4544
|
});
|
|
@@ -3723,13 +4551,323 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
|
|
|
3723
4551
|
gitRemote: options.gitRemote,
|
|
3724
4552
|
dryRun: options.dryRun,
|
|
3725
4553
|
verbose: options.verbose,
|
|
3726
|
-
additionalArgs: options.gitPushArgs || this.
|
|
4554
|
+
additionalArgs: options.gitPushArgs || this.normalizedConfig.changelog?.git?.pushArgs
|
|
3727
4555
|
});
|
|
3728
4556
|
for (const postGitTask of postGitTasks) {
|
|
3729
4557
|
await postGitTask(latestCommit);
|
|
3730
4558
|
}
|
|
3731
4559
|
return;
|
|
3732
4560
|
};
|
|
4561
|
+
releaseVersion = async (options) => {
|
|
4562
|
+
const verbose = options.verbose || isVerbose(this.workspaceConfig.logLevel);
|
|
4563
|
+
this.projectGraph = await createProjectGraphAsync$2({
|
|
4564
|
+
exitOnError: true,
|
|
4565
|
+
resetDaemonClient: true
|
|
4566
|
+
});
|
|
4567
|
+
if (!this.projectGraph) {
|
|
4568
|
+
throw new Error(
|
|
4569
|
+
"Failed to load the project graph. Please run `nx reset`, then run the `storm-git commit` command again."
|
|
4570
|
+
);
|
|
4571
|
+
}
|
|
4572
|
+
const releaseGraph = options.releaseGraph ?? await createReleaseGraph({
|
|
4573
|
+
tree: this.tree,
|
|
4574
|
+
projectGraph: this.projectGraph,
|
|
4575
|
+
nxReleaseConfig: this.normalizedConfig,
|
|
4576
|
+
filters: {
|
|
4577
|
+
projects: options.projects,
|
|
4578
|
+
groups: options.groups
|
|
4579
|
+
},
|
|
4580
|
+
firstRelease: !!options.firstRelease,
|
|
4581
|
+
verbose,
|
|
4582
|
+
preid: options.preid ?? this.workspaceConfig.preid,
|
|
4583
|
+
versionActionsOptionsOverrides: options.versionActionsOptionsOverrides
|
|
4584
|
+
});
|
|
4585
|
+
if (releaseGraph.filterLog && process.env.NX_RELEASE_INTERNAL_SUPPRESS_FILTER_LOG !== "true") {
|
|
4586
|
+
writeDebug(formatNxLog(releaseGraph.filterLog), this.workspaceConfig);
|
|
4587
|
+
}
|
|
4588
|
+
if (!options.specifier) {
|
|
4589
|
+
const rawVersionPlans = await readRawVersionPlans();
|
|
4590
|
+
await setResolvedVersionPlansOnGroups(
|
|
4591
|
+
rawVersionPlans,
|
|
4592
|
+
releaseGraph.releaseGroups,
|
|
4593
|
+
Object.keys(this.projectGraph.nodes),
|
|
4594
|
+
verbose
|
|
4595
|
+
);
|
|
4596
|
+
const versionPlanValidationError = validateResolvedVersionPlansAgainstFilter(
|
|
4597
|
+
releaseGraph.releaseGroups,
|
|
4598
|
+
releaseGraph.releaseGroupToFilteredProjects
|
|
4599
|
+
);
|
|
4600
|
+
if (versionPlanValidationError) {
|
|
4601
|
+
throw new Error(formatNxLog(versionPlanValidationError));
|
|
4602
|
+
}
|
|
4603
|
+
} else {
|
|
4604
|
+
if (verbose && releaseGraph.releaseGroups.some((g) => !!g.versionPlans)) {
|
|
4605
|
+
writeDebug(
|
|
4606
|
+
`Skipping version plan discovery as a specifier was provided`,
|
|
4607
|
+
this.workspaceConfig
|
|
4608
|
+
);
|
|
4609
|
+
}
|
|
4610
|
+
}
|
|
4611
|
+
if (options.deleteVersionPlans === void 0) {
|
|
4612
|
+
options.deleteVersionPlans = false;
|
|
4613
|
+
}
|
|
4614
|
+
if (this.normalizedConfig.version?.preVersionCommand) {
|
|
4615
|
+
writeDebug(
|
|
4616
|
+
"Executing the following pre-version command: \n" + this.normalizedConfig.version.preVersionCommand,
|
|
4617
|
+
this.workspaceConfig
|
|
4618
|
+
);
|
|
4619
|
+
try {
|
|
4620
|
+
const childProcess2 = runAsync(
|
|
4621
|
+
this.workspaceConfig,
|
|
4622
|
+
this.normalizedConfig.version.preVersionCommand,
|
|
4623
|
+
this.workspaceConfig.workspaceRoot,
|
|
4624
|
+
{
|
|
4625
|
+
...process.env,
|
|
4626
|
+
NX_DRY_RUN: options.dryRun ? "true" : "false"
|
|
4627
|
+
}
|
|
4628
|
+
);
|
|
4629
|
+
if (options.verbose) {
|
|
4630
|
+
childProcess2.stdout?.pipe(process.stdout);
|
|
4631
|
+
childProcess2.stderr?.pipe(process.stderr);
|
|
4632
|
+
}
|
|
4633
|
+
await childProcess2;
|
|
4634
|
+
} catch (e) {
|
|
4635
|
+
throw new Error(
|
|
4636
|
+
formatNxLog({
|
|
4637
|
+
title: `The pre-version command failed. See the full output above.`,
|
|
4638
|
+
bodyLines: [this.normalizedConfig.version.preVersionCommand, e]
|
|
4639
|
+
})
|
|
4640
|
+
);
|
|
4641
|
+
}
|
|
4642
|
+
}
|
|
4643
|
+
for (const groupName of releaseGraph.sortedReleaseGroups) {
|
|
4644
|
+
const releaseGroup = releaseGraph.releaseGroups.find(
|
|
4645
|
+
(g) => g.name === groupName
|
|
4646
|
+
);
|
|
4647
|
+
if (!releaseGroup) {
|
|
4648
|
+
continue;
|
|
4649
|
+
}
|
|
4650
|
+
if (releaseGroup.version?.groupPreVersionCommand) {
|
|
4651
|
+
writeDebug(
|
|
4652
|
+
`Executing the ${releaseGroup.name} release group's pre-version command:
|
|
4653
|
+
` + releaseGroup.version?.groupPreVersionCommand,
|
|
4654
|
+
this.workspaceConfig
|
|
4655
|
+
);
|
|
4656
|
+
try {
|
|
4657
|
+
const childProcess2 = runAsync(
|
|
4658
|
+
this.workspaceConfig,
|
|
4659
|
+
releaseGroup.version?.groupPreVersionCommand,
|
|
4660
|
+
this.workspaceConfig.workspaceRoot,
|
|
4661
|
+
{
|
|
4662
|
+
...process.env,
|
|
4663
|
+
NX_DRY_RUN: options.dryRun ? "true" : "false"
|
|
4664
|
+
}
|
|
4665
|
+
);
|
|
4666
|
+
if (options.verbose) {
|
|
4667
|
+
childProcess2.stdout?.pipe(process.stdout);
|
|
4668
|
+
childProcess2.stderr?.pipe(process.stderr);
|
|
4669
|
+
}
|
|
4670
|
+
await childProcess2;
|
|
4671
|
+
} catch (e) {
|
|
4672
|
+
throw new Error(
|
|
4673
|
+
formatNxLog({
|
|
4674
|
+
title: `The ${releaseGroup.name} release group's pre-version command failed. See the full output above.`,
|
|
4675
|
+
bodyLines: [releaseGroup.version?.groupPreVersionCommand, e]
|
|
4676
|
+
})
|
|
4677
|
+
);
|
|
4678
|
+
}
|
|
4679
|
+
}
|
|
4680
|
+
}
|
|
4681
|
+
await releaseGraph.validate(this.tree);
|
|
4682
|
+
const commitMessage = options.gitCommitMessage || this.normalizedConfig.version?.git?.commitMessage;
|
|
4683
|
+
const additionalChangedFiles = /* @__PURE__ */ new Set();
|
|
4684
|
+
const additionalDeletedFiles = /* @__PURE__ */ new Set();
|
|
4685
|
+
const processor = new StormReleaseGroupProcessor(
|
|
4686
|
+
this.tree,
|
|
4687
|
+
this.workspaceConfig,
|
|
4688
|
+
this.projectGraph,
|
|
4689
|
+
this.normalizedConfig,
|
|
4690
|
+
releaseGraph,
|
|
4691
|
+
options
|
|
4692
|
+
);
|
|
4693
|
+
try {
|
|
4694
|
+
await processor.processGroups();
|
|
4695
|
+
if (options.deleteVersionPlans) {
|
|
4696
|
+
processor.deleteProcessedVersionPlanFiles();
|
|
4697
|
+
}
|
|
4698
|
+
} catch (err) {
|
|
4699
|
+
processor.flushAllProjectLoggers();
|
|
4700
|
+
throw err;
|
|
4701
|
+
}
|
|
4702
|
+
await formatChangedFiles(this.tree);
|
|
4703
|
+
printAndFlushChanges(this.tree, !!options.dryRun);
|
|
4704
|
+
const { changedFiles: changed, deletedFiles: deleted } = await processor.afterAllProjectsVersioned({
|
|
4705
|
+
...this.normalizedConfig.version.versionActionsOptions,
|
|
4706
|
+
...options.versionActionsOptionsOverrides ?? {}
|
|
4707
|
+
});
|
|
4708
|
+
changed.forEach((f) => additionalChangedFiles.add(f));
|
|
4709
|
+
deleted.forEach((f) => additionalDeletedFiles.add(f));
|
|
4710
|
+
if (this.normalizedConfig.docker && typeof this.normalizedConfig.docker === "object" && this.normalizedConfig.docker?.preVersionCommand) {
|
|
4711
|
+
writeDebug(
|
|
4712
|
+
`Executing the docker pre-version command:
|
|
4713
|
+
` + this.normalizedConfig.docker.preVersionCommand,
|
|
4714
|
+
this.workspaceConfig
|
|
4715
|
+
);
|
|
4716
|
+
try {
|
|
4717
|
+
const childProcess2 = runAsync(
|
|
4718
|
+
this.workspaceConfig,
|
|
4719
|
+
this.normalizedConfig.docker.preVersionCommand,
|
|
4720
|
+
this.workspaceConfig.workspaceRoot,
|
|
4721
|
+
{
|
|
4722
|
+
...process.env,
|
|
4723
|
+
NX_DRY_RUN: options.dryRun ? "true" : "false"
|
|
4724
|
+
}
|
|
4725
|
+
);
|
|
4726
|
+
if (options.verbose) {
|
|
4727
|
+
childProcess2.stdout?.pipe(process.stdout);
|
|
4728
|
+
childProcess2.stderr?.pipe(process.stderr);
|
|
4729
|
+
}
|
|
4730
|
+
await childProcess2;
|
|
4731
|
+
} catch (e) {
|
|
4732
|
+
throw new Error(
|
|
4733
|
+
formatNxLog({
|
|
4734
|
+
title: `The docker pre-version command failed. See the full output above.`,
|
|
4735
|
+
bodyLines: [this.normalizedConfig.docker.preVersionCommand, e]
|
|
4736
|
+
})
|
|
4737
|
+
);
|
|
4738
|
+
}
|
|
4739
|
+
}
|
|
4740
|
+
for (const groupName of releaseGraph.sortedReleaseGroups) {
|
|
4741
|
+
const releaseGroup = releaseGraph.releaseGroups.find(
|
|
4742
|
+
(g) => g.name === groupName
|
|
4743
|
+
);
|
|
4744
|
+
if (!releaseGroup) {
|
|
4745
|
+
continue;
|
|
4746
|
+
}
|
|
4747
|
+
if (releaseGroup.docker?.groupPreVersionCommand) {
|
|
4748
|
+
writeDebug(
|
|
4749
|
+
`Executing the ${releaseGroup.name} release group's docker pre-version command:
|
|
4750
|
+
` + releaseGroup.docker?.groupPreVersionCommand,
|
|
4751
|
+
this.workspaceConfig
|
|
4752
|
+
);
|
|
4753
|
+
try {
|
|
4754
|
+
const childProcess2 = runAsync(
|
|
4755
|
+
this.workspaceConfig,
|
|
4756
|
+
releaseGroup.docker?.groupPreVersionCommand,
|
|
4757
|
+
this.workspaceConfig.workspaceRoot,
|
|
4758
|
+
{
|
|
4759
|
+
...process.env,
|
|
4760
|
+
NX_DRY_RUN: options.dryRun ? "true" : "false"
|
|
4761
|
+
}
|
|
4762
|
+
);
|
|
4763
|
+
if (options.verbose) {
|
|
4764
|
+
childProcess2.stdout?.pipe(process.stdout);
|
|
4765
|
+
childProcess2.stderr?.pipe(process.stderr);
|
|
4766
|
+
}
|
|
4767
|
+
await childProcess2;
|
|
4768
|
+
} catch (e) {
|
|
4769
|
+
throw new Error(
|
|
4770
|
+
formatNxLog({
|
|
4771
|
+
title: `The ${releaseGroup.name} release group's docker pre-version command failed. See the full output above.`,
|
|
4772
|
+
bodyLines: [releaseGroup.docker?.groupPreVersionCommand, e]
|
|
4773
|
+
})
|
|
4774
|
+
);
|
|
4775
|
+
}
|
|
4776
|
+
}
|
|
4777
|
+
}
|
|
4778
|
+
if (this.normalizedConfig.docker || releaseGraph.releaseGroups.some((rg) => rg.docker)) {
|
|
4779
|
+
writeWarning(
|
|
4780
|
+
formatNxLog({
|
|
4781
|
+
title: "Warning",
|
|
4782
|
+
bodyLines: [
|
|
4783
|
+
`Docker support is experimental. Breaking changes may occur and not adhere to semver versioning.`
|
|
4784
|
+
]
|
|
4785
|
+
})
|
|
4786
|
+
);
|
|
4787
|
+
}
|
|
4788
|
+
await processor.processDockerProjects(
|
|
4789
|
+
options.dockerVersionScheme,
|
|
4790
|
+
options.dockerVersion
|
|
4791
|
+
);
|
|
4792
|
+
const versionData = processor.getVersionData();
|
|
4793
|
+
const gitTagValues = options.gitTag ?? this.normalizedConfig.version?.git?.tag ? createGitTagValues(
|
|
4794
|
+
releaseGraph.releaseGroups,
|
|
4795
|
+
releaseGraph.releaseGroupToFilteredProjects,
|
|
4796
|
+
versionData
|
|
4797
|
+
) : [];
|
|
4798
|
+
handleDuplicateGitTags(gitTagValues);
|
|
4799
|
+
let workspaceVersion = void 0;
|
|
4800
|
+
if (releaseGraph.releaseGroups.length === 1) {
|
|
4801
|
+
const releaseGroup = releaseGraph.releaseGroups[0];
|
|
4802
|
+
if (releaseGroup?.projectsRelationship === "fixed") {
|
|
4803
|
+
const releaseGroupProjectNames = Array.from(
|
|
4804
|
+
releaseGraph.releaseGroupToFilteredProjects.get(releaseGroup)
|
|
4805
|
+
);
|
|
4806
|
+
workspaceVersion = versionData[releaseGroupProjectNames[0]].newVersion;
|
|
4807
|
+
}
|
|
4808
|
+
}
|
|
4809
|
+
const changedFiles = [
|
|
4810
|
+
...this.tree.listChanges().map((f) => f.path),
|
|
4811
|
+
...additionalChangedFiles
|
|
4812
|
+
];
|
|
4813
|
+
const deletedFiles = Array.from(additionalDeletedFiles);
|
|
4814
|
+
if (!changedFiles.length && !deletedFiles.length) {
|
|
4815
|
+
return {
|
|
4816
|
+
workspaceVersion,
|
|
4817
|
+
projectsVersionData: versionData,
|
|
4818
|
+
releaseGraph
|
|
4819
|
+
};
|
|
4820
|
+
}
|
|
4821
|
+
if (options.gitCommit ?? this.normalizedConfig.version?.git?.commit) {
|
|
4822
|
+
await commitChanges({
|
|
4823
|
+
changedFiles,
|
|
4824
|
+
deletedFiles,
|
|
4825
|
+
isDryRun: !!options.dryRun,
|
|
4826
|
+
isVerbose: !!options.verbose,
|
|
4827
|
+
gitCommitMessages: createCommitMessageValues(
|
|
4828
|
+
releaseGraph.releaseGroups,
|
|
4829
|
+
releaseGraph.releaseGroupToFilteredProjects,
|
|
4830
|
+
versionData,
|
|
4831
|
+
commitMessage
|
|
4832
|
+
),
|
|
4833
|
+
gitCommitArgs: options.gitCommitArgs || this.normalizedConfig.version?.git?.commitArgs
|
|
4834
|
+
});
|
|
4835
|
+
} else if (options.stageChanges ?? this.normalizedConfig.version?.git?.stageChanges) {
|
|
4836
|
+
writeDebug(`Staging changed files with git`);
|
|
4837
|
+
await gitAdd({
|
|
4838
|
+
changedFiles,
|
|
4839
|
+
deletedFiles,
|
|
4840
|
+
dryRun: options.dryRun,
|
|
4841
|
+
verbose
|
|
4842
|
+
});
|
|
4843
|
+
}
|
|
4844
|
+
if (options.gitTag ?? this.normalizedConfig.version?.git?.tag) {
|
|
4845
|
+
writeDebug(`Tagging commit with git`);
|
|
4846
|
+
for (const tag of gitTagValues) {
|
|
4847
|
+
await gitTag({
|
|
4848
|
+
tag,
|
|
4849
|
+
message: options.gitTagMessage || this.normalizedConfig.version?.git?.tagMessage,
|
|
4850
|
+
additionalArgs: options.gitTagArgs || this.normalizedConfig.version?.git?.tagArgs,
|
|
4851
|
+
dryRun: options.dryRun,
|
|
4852
|
+
verbose: options.verbose
|
|
4853
|
+
});
|
|
4854
|
+
}
|
|
4855
|
+
}
|
|
4856
|
+
if (options.gitPush ?? this.normalizedConfig.version?.git?.push) {
|
|
4857
|
+
writeDebug(`Pushing to git remote "${options.gitRemote ?? "origin"}"`);
|
|
4858
|
+
await gitPush({
|
|
4859
|
+
gitRemote: options.gitRemote,
|
|
4860
|
+
dryRun: options.dryRun,
|
|
4861
|
+
verbose: options.verbose,
|
|
4862
|
+
additionalArgs: options.gitPushArgs || this.normalizedConfig.version?.git?.pushArgs
|
|
4863
|
+
});
|
|
4864
|
+
}
|
|
4865
|
+
return {
|
|
4866
|
+
workspaceVersion,
|
|
4867
|
+
projectsVersionData: versionData,
|
|
4868
|
+
releaseGraph
|
|
4869
|
+
};
|
|
4870
|
+
};
|
|
3733
4871
|
};
|
|
3734
4872
|
|
|
3735
4873
|
// src/release/run.ts
|