@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.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
require('./chunk-
|
|
9
|
-
var
|
|
4
|
+
var chunkDPKFBB3S_cjs = require('./chunk-DPKFBB3S.cjs');
|
|
5
|
+
var chunkOGGY5I23_cjs = require('./chunk-OGGY5I23.cjs');
|
|
6
|
+
var chunkRZNFHUM6_cjs = require('./chunk-RZNFHUM6.cjs');
|
|
7
|
+
var chunkAQ5YHZ3Z_cjs = require('./chunk-AQ5YHZ3Z.cjs');
|
|
8
|
+
require('./chunk-POFLIQQB.cjs');
|
|
9
|
+
var chunkW5P2IM2W_cjs = require('./chunk-W5P2IM2W.cjs');
|
|
10
10
|
require('./chunk-YHZNDNCW.cjs');
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
11
|
+
var chunk4EOHM2UV_cjs = require('./chunk-4EOHM2UV.cjs');
|
|
12
|
+
var chunkMTAYUS7E_cjs = require('./chunk-MTAYUS7E.cjs');
|
|
13
|
+
var chunk4ILBJTRR_cjs = require('./chunk-4ILBJTRR.cjs');
|
|
14
14
|
var TOML = require('@ltd/j-toml');
|
|
15
15
|
var commander = require('commander');
|
|
16
16
|
require('@inquirer/checkbox');
|
|
@@ -54,12 +54,24 @@ var utils = require('nx/src/tasks-runner/utils');
|
|
|
54
54
|
var execCommand_js = require('nx/src/command-line/release/utils/exec-command.js');
|
|
55
55
|
var git = require('nx/src/command-line/release/utils/git');
|
|
56
56
|
var semver = require('semver');
|
|
57
|
+
var clone = require('nanoclone');
|
|
57
58
|
var release = require('nx/release');
|
|
59
|
+
var versionPlans = require('nx/src/command-line/release/config/version-plans');
|
|
60
|
+
var printChanges_js = require('nx/src/command-line/release/utils/print-changes.js');
|
|
61
|
+
var releaseGraph = require('nx/src/command-line/release/utils/release-graph');
|
|
62
|
+
var versionPlanUtils = require('nx/src/command-line/release/utils/version-plan-utils');
|
|
58
63
|
var nxJson = require('nx/src/config/nx-json');
|
|
59
64
|
var tree = require('nx/src/generators/tree');
|
|
60
65
|
var fileMapUtils = require('nx/src/project-graph/file-map-utils');
|
|
66
|
+
var findMatchingProjects = require('nx/src/utils/find-matching-projects');
|
|
67
|
+
var importsPlugin = require('prettier-plugin-organize-imports');
|
|
61
68
|
var DefaultChangelogRenderer = require('nx/release/changelog-renderer');
|
|
62
69
|
var conventionalCommits = require('nx/src/command-line/release/config/conventional-commits');
|
|
70
|
+
var config_js = require('nx/src/command-line/release/config/config.js');
|
|
71
|
+
var deriveSpecifierFromConventionalCommits = require('nx/src/command-line/release/version/derive-specifier-from-conventional-commits');
|
|
72
|
+
var deriverSpecifierFromVersionPlans = require('nx/src/command-line/release/version/deriver-specifier-from-version-plans');
|
|
73
|
+
var releaseGroupProcessor = require('nx/src/command-line/release/version/release-group-processor');
|
|
74
|
+
var versionActions_js = require('nx/src/command-line/release/version/version-actions.js');
|
|
63
75
|
|
|
64
76
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
65
77
|
|
|
@@ -81,6 +93,9 @@ var ___default = /*#__PURE__*/_interopDefault(_);
|
|
|
81
93
|
var updateSection__default = /*#__PURE__*/_interopDefault(updateSection);
|
|
82
94
|
var axios__default = /*#__PURE__*/_interopDefault(axios);
|
|
83
95
|
var chalk__default = /*#__PURE__*/_interopDefault(chalk);
|
|
96
|
+
var semver__default = /*#__PURE__*/_interopDefault(semver);
|
|
97
|
+
var clone__default = /*#__PURE__*/_interopDefault(clone);
|
|
98
|
+
var importsPlugin__default = /*#__PURE__*/_interopDefault(importsPlugin);
|
|
84
99
|
var DefaultChangelogRenderer__default = /*#__PURE__*/_interopDefault(DefaultChangelogRenderer);
|
|
85
100
|
|
|
86
101
|
function parseCargoToml(cargoString) {
|
|
@@ -409,9 +424,9 @@ function getRuleFromScopeEnum(scopeEnum) {
|
|
|
409
424
|
|
|
410
425
|
// ../conventional-changelog/src/index.ts
|
|
411
426
|
async function createPreset(variant = "monorepo") {
|
|
412
|
-
const workspaceConfig = await
|
|
427
|
+
const workspaceConfig = await chunk4ILBJTRR_cjs.getWorkspaceConfig();
|
|
413
428
|
if (variant === "minimal") {
|
|
414
|
-
return
|
|
429
|
+
return chunk4ILBJTRR_cjs.defu(
|
|
415
430
|
await createBasePreset__default.default({ ...COMMIT_CONFIGS.minimal.changelogs.props }),
|
|
416
431
|
{
|
|
417
432
|
...COMMIT_CONFIGS.minimal,
|
|
@@ -425,7 +440,7 @@ async function createPreset(variant = "monorepo") {
|
|
|
425
440
|
);
|
|
426
441
|
}
|
|
427
442
|
const nxScopes = await getNxScopes({ config: workspaceConfig });
|
|
428
|
-
return
|
|
443
|
+
return chunk4ILBJTRR_cjs.defu(
|
|
429
444
|
await createBasePreset__default.default({
|
|
430
445
|
...COMMIT_CONFIGS.monorepo.changelogs.props,
|
|
431
446
|
scope: nxScopes
|
|
@@ -989,7 +1004,7 @@ async function lint(message, config5) {
|
|
|
989
1004
|
// src/commitlint/run.ts
|
|
990
1005
|
var COMMIT_EDITMSG_PATH = ".git/COMMIT_EDITMSG";
|
|
991
1006
|
async function runCommitLint(workspaceConfig, options) {
|
|
992
|
-
|
|
1007
|
+
chunk4ILBJTRR_cjs.writeInfo(
|
|
993
1008
|
"\u{1F4DD} Validating git commit message aligns with the Storm Software specification",
|
|
994
1009
|
workspaceConfig
|
|
995
1010
|
);
|
|
@@ -997,7 +1012,7 @@ async function runCommitLint(workspaceConfig, options) {
|
|
|
997
1012
|
if (options.message && options.message !== COMMIT_EDITMSG_PATH) {
|
|
998
1013
|
commitMessage = options.message;
|
|
999
1014
|
} else {
|
|
1000
|
-
const commitFile =
|
|
1015
|
+
const commitFile = chunk4ILBJTRR_cjs.joinPaths(
|
|
1001
1016
|
workspaceConfig.workspaceRoot,
|
|
1002
1017
|
options.file || options.message || COMMIT_EDITMSG_PATH
|
|
1003
1018
|
);
|
|
@@ -1014,17 +1029,17 @@ async function runCommitLint(workspaceConfig, options) {
|
|
|
1014
1029
|
if (upstreamRemote) {
|
|
1015
1030
|
const upstreamRemoteIdentifier = upstreamRemote.split(" ")[0]?.trim();
|
|
1016
1031
|
if (!upstreamRemoteIdentifier) {
|
|
1017
|
-
|
|
1032
|
+
chunk4ILBJTRR_cjs.writeWarning(
|
|
1018
1033
|
`No upstream remote found for ${workspaceConfig.name}.git. Skipping comparison.`,
|
|
1019
1034
|
workspaceConfig
|
|
1020
1035
|
);
|
|
1021
1036
|
return;
|
|
1022
1037
|
}
|
|
1023
|
-
|
|
1038
|
+
chunk4ILBJTRR_cjs.writeDebug(`Comparing against remote ${upstreamRemoteIdentifier}`);
|
|
1024
1039
|
const currentBranch = childProcess__default.default.execSync("git branch --show-current").toString().trim();
|
|
1025
1040
|
gitLogCmd = gitLogCmd + ` ${currentBranch} ^${upstreamRemoteIdentifier}/main`;
|
|
1026
1041
|
} else {
|
|
1027
|
-
|
|
1042
|
+
chunk4ILBJTRR_cjs.writeWarning(
|
|
1028
1043
|
`No upstream remote found for ${workspaceConfig.name}.git. Skipping comparison against upstream main.`,
|
|
1029
1044
|
workspaceConfig
|
|
1030
1045
|
);
|
|
@@ -1032,7 +1047,7 @@ async function runCommitLint(workspaceConfig, options) {
|
|
|
1032
1047
|
}
|
|
1033
1048
|
commitMessage = childProcess__default.default.execSync(gitLogCmd).toString().trim();
|
|
1034
1049
|
if (!commitMessage) {
|
|
1035
|
-
|
|
1050
|
+
chunk4ILBJTRR_cjs.writeWarning(
|
|
1036
1051
|
"No commits found. Skipping commit message validation.",
|
|
1037
1052
|
workspaceConfig
|
|
1038
1053
|
);
|
|
@@ -1042,7 +1057,7 @@ async function runCommitLint(workspaceConfig, options) {
|
|
|
1042
1057
|
const preset = await createPreset(workspaceConfig.variant);
|
|
1043
1058
|
const report = await lint(commitMessage, preset);
|
|
1044
1059
|
if (!preset.commitlint.regex.test(commitMessage) || report.errors.length || report.warnings.length) {
|
|
1045
|
-
|
|
1060
|
+
chunk4ILBJTRR_cjs.writeSuccess(
|
|
1046
1061
|
`Commit was processing completed successfully!`,
|
|
1047
1062
|
workspaceConfig
|
|
1048
1063
|
);
|
|
@@ -1254,7 +1269,7 @@ async function createState(workspaceConfig, configPath) {
|
|
|
1254
1269
|
const project = projectConfigurations.projects[scope];
|
|
1255
1270
|
if (project) {
|
|
1256
1271
|
let description = `${project.name} - ${project.root}`;
|
|
1257
|
-
const packageJsonPath =
|
|
1272
|
+
const packageJsonPath = chunk4ILBJTRR_cjs.joinPaths(project.root, "package.json");
|
|
1258
1273
|
if (fs$1.existsSync(packageJsonPath)) {
|
|
1259
1274
|
const packageJsonFile = await fs.readFile(packageJsonPath, "utf8");
|
|
1260
1275
|
const packageJson = JSON.parse(packageJsonFile);
|
|
@@ -1300,11 +1315,11 @@ var formatCommitMessage = (state, workspaceConfig) => {
|
|
|
1300
1315
|
const scope = workspaceConfig.variant !== "minimal" && typeof answers.scope === "string" && answers.scope ? answers.scope.trim() : "";
|
|
1301
1316
|
const subject = answers.subject?.trim();
|
|
1302
1317
|
const type = answers.type;
|
|
1303
|
-
const
|
|
1318
|
+
const format4 = config5.settings.format || (workspaceConfig.variant !== "minimal" ? "{type}({scope}): {emoji}{subject}" : "{type}: {emoji}{subject}");
|
|
1304
1319
|
const body = answers.body && typeof answers.body === "string" ? wrap__default.default(answers.body || "", wrapOptions) : "";
|
|
1305
1320
|
const breaking = answers.breakingBody && typeof answers.breakingBody === "string" ? wrap__default.default(answers.breakingBody || "", wrapOptions) : "";
|
|
1306
1321
|
const issues = answers.issuesBody && typeof answers.issuesBody === "string" ? wrap__default.default(answers.issuesBody || "", wrapOptions) : "";
|
|
1307
|
-
const head =
|
|
1322
|
+
const head = format4.replace(/\{emoji\}/g, config5.settings.disableEmoji ? "" : `${emoji} `).replace(/\{scope\}/g, scope).replace(/\{subject\}/g, subject || "").replace(/\{type\}/g, type || "");
|
|
1308
1323
|
let msg = head;
|
|
1309
1324
|
if (body) {
|
|
1310
1325
|
msg += `
|
|
@@ -1328,20 +1343,20 @@ ${closedIssueEmoji}${config5.settings.closedIssueMessage}${issues}`;
|
|
|
1328
1343
|
|
|
1329
1344
|
// src/commit/run.ts
|
|
1330
1345
|
async function runCommit(commitizenFile, dryRun = false) {
|
|
1331
|
-
const workspaceConfig = await
|
|
1346
|
+
const workspaceConfig = await chunk4ILBJTRR_cjs.getWorkspaceConfig();
|
|
1332
1347
|
const state = await createState(workspaceConfig);
|
|
1333
1348
|
if (dryRun) {
|
|
1334
|
-
|
|
1349
|
+
chunk4ILBJTRR_cjs.writeInfo("Running in dry mode.", workspaceConfig);
|
|
1335
1350
|
}
|
|
1336
1351
|
console.log(chalkTemplate__default.default`
|
|
1337
1352
|
{bold.#999999 ----------------------------------------}
|
|
1338
1353
|
|
|
1339
|
-
{bold.#FFFFFF ${
|
|
1354
|
+
{bold.#FFFFFF ${chunk4ILBJTRR_cjs.brandIcon(workspaceConfig)} Storm Software Git-Tools - Commit}
|
|
1340
1355
|
{#CCCCCC Please provide the requested details below...}
|
|
1341
1356
|
`);
|
|
1342
1357
|
state.answers = await askQuestions(state);
|
|
1343
1358
|
const message = formatCommitMessage(state, workspaceConfig);
|
|
1344
|
-
const commitMsgFile =
|
|
1359
|
+
const commitMsgFile = chunk4ILBJTRR_cjs.joinPaths(getGitDir(), "COMMIT_EDITMSG");
|
|
1345
1360
|
console.log(chalkTemplate__default.default`
|
|
1346
1361
|
{bold.#999999 ----------------------------------------}
|
|
1347
1362
|
|
|
@@ -1354,14 +1369,14 @@ async function runCommit(commitizenFile, dryRun = false) {
|
|
|
1354
1369
|
commandItems.push(...["--file", commitMsgFile]);
|
|
1355
1370
|
const command = shellescape__default.default(commandItems);
|
|
1356
1371
|
if (dryRun) {
|
|
1357
|
-
|
|
1372
|
+
chunk4ILBJTRR_cjs.writeDebug(
|
|
1358
1373
|
`Skipping execution [dry-run]: ${command.replace(commitMsgFile, ".git/COMMIT_EDITMSG")}`,
|
|
1359
1374
|
workspaceConfig
|
|
1360
1375
|
);
|
|
1361
|
-
|
|
1376
|
+
chunk4ILBJTRR_cjs.writeDebug(`Message [dry-run]: ${message}`, workspaceConfig);
|
|
1362
1377
|
} else {
|
|
1363
1378
|
await fs__default.default.writeFile(commitMsgFile, message);
|
|
1364
|
-
|
|
1379
|
+
chunkMTAYUS7E_cjs.run(workspaceConfig, command);
|
|
1365
1380
|
}
|
|
1366
1381
|
}
|
|
1367
1382
|
async function askQuestions(state) {
|
|
@@ -2010,14 +2025,14 @@ var runReadme = async ({
|
|
|
2010
2025
|
project,
|
|
2011
2026
|
output: output3,
|
|
2012
2027
|
clean = true,
|
|
2013
|
-
prettier = true,
|
|
2028
|
+
prettier: prettier2 = true,
|
|
2014
2029
|
workspace = false
|
|
2015
2030
|
}) => {
|
|
2016
2031
|
const projectGraph = await projectGraph_js.createProjectGraphAsync({
|
|
2017
2032
|
exitOnError: true
|
|
2018
2033
|
});
|
|
2019
2034
|
const projectConfigs = projectGraph_js.readProjectsConfigurationFromProjectGraph(projectGraph);
|
|
2020
|
-
const workspaceRoot =
|
|
2035
|
+
const workspaceRoot = chunk4ILBJTRR_cjs.findWorkspaceRootSafe(process.cwd());
|
|
2021
2036
|
if (!workspaceRoot) {
|
|
2022
2037
|
throw new Error(
|
|
2023
2038
|
"Unable to find the workspace root. Please ensure you are running this command from within a workspace."
|
|
@@ -2045,7 +2060,7 @@ var runReadme = async ({
|
|
|
2045
2060
|
templates,
|
|
2046
2061
|
output: output3,
|
|
2047
2062
|
clean,
|
|
2048
|
-
prettier
|
|
2063
|
+
prettier: prettier2
|
|
2049
2064
|
});
|
|
2050
2065
|
} else {
|
|
2051
2066
|
for (const projectName of Object.keys(projectConfigs.projects)) {
|
|
@@ -2053,12 +2068,12 @@ var runReadme = async ({
|
|
|
2053
2068
|
templates,
|
|
2054
2069
|
output: output3,
|
|
2055
2070
|
clean,
|
|
2056
|
-
prettier
|
|
2071
|
+
prettier: prettier2
|
|
2057
2072
|
});
|
|
2058
2073
|
}
|
|
2059
2074
|
}
|
|
2060
2075
|
};
|
|
2061
|
-
var runProjectReadme = async (projectName, { templates, output: output3, clean = true, prettier = true }) => {
|
|
2076
|
+
var runProjectReadme = async (projectName, { templates, output: output3, clean = true, prettier: prettier2 = true }) => {
|
|
2062
2077
|
const projectGraph = await projectGraph_js.createProjectGraphAsync({
|
|
2063
2078
|
exitOnError: true
|
|
2064
2079
|
});
|
|
@@ -2146,10 +2161,10 @@ var runProjectReadme = async (projectName, { templates, output: output3, clean =
|
|
|
2146
2161
|
}
|
|
2147
2162
|
}
|
|
2148
2163
|
}
|
|
2149
|
-
if (
|
|
2150
|
-
const
|
|
2164
|
+
if (prettier2) {
|
|
2165
|
+
const prettier3 = await import('prettier');
|
|
2151
2166
|
console.info("Formatting output with Prettier");
|
|
2152
|
-
newContent = await
|
|
2167
|
+
newContent = await prettier3.format(newContent, {
|
|
2153
2168
|
parser: "markdown",
|
|
2154
2169
|
trailingComma: "none",
|
|
2155
2170
|
tabWidth: 2,
|
|
@@ -2434,7 +2449,7 @@ async function generateChangelogContent(releaseVersion, filepath, newContent, cu
|
|
|
2434
2449
|
const header = await prettier.format(
|
|
2435
2450
|
` : void 0 : workspaceConfig?.release.banner.alt) || "Branded release banner image"}](${bannerUrl || chunk4ILBJTRR_cjs.STORM_DEFAULT_RELEASE_BANNER})
|
|
2438
2453
|
|
|
2439
2454
|
# Changelog ${project || workspaceConfig?.name ? "for" : ""}${workspaceConfig?.name ? ` ${titleCase(workspaceConfig.name)}` : ""}${project ? `${workspaceConfig?.name ? " -" : ""} ${titleCase(project)}` : ""}
|
|
2440
2455
|
|
|
@@ -2610,12 +2625,12 @@ async function generateChangelogForProjects({
|
|
|
2610
2625
|
projectChangelogs
|
|
2611
2626
|
)) {
|
|
2612
2627
|
if (!projectGraph.nodes[projectName]?.data.root) {
|
|
2613
|
-
|
|
2628
|
+
chunk4ILBJTRR_cjs.writeWarning(
|
|
2614
2629
|
`A changelog was generated for ${projectName}, but it could not be found in the project graph. Skipping writing changelog file.`,
|
|
2615
2630
|
workspaceConfig
|
|
2616
2631
|
);
|
|
2617
2632
|
} else if (projectChangelog.contents) {
|
|
2618
|
-
const filePath =
|
|
2633
|
+
const filePath = chunk4ILBJTRR_cjs.joinPaths(
|
|
2619
2634
|
projectGraph.nodes[projectName].data.root,
|
|
2620
2635
|
"CHANGELOG.md"
|
|
2621
2636
|
);
|
|
@@ -2623,7 +2638,7 @@ async function generateChangelogForProjects({
|
|
|
2623
2638
|
if (fs$1.existsSync(filePath)) {
|
|
2624
2639
|
currentContent = await fs.readFile(filePath, "utf8");
|
|
2625
2640
|
}
|
|
2626
|
-
|
|
2641
|
+
chunk4ILBJTRR_cjs.writeDebug(
|
|
2627
2642
|
`\u270D\uFE0F Writing changelog for project ${projectName} to ${filePath}`,
|
|
2628
2643
|
workspaceConfig
|
|
2629
2644
|
);
|
|
@@ -2846,7 +2861,7 @@ var StormGithubRemoteReleaseClient = class extends github.GithubRemoteReleaseCli
|
|
|
2846
2861
|
}
|
|
2847
2862
|
async createOrUpdateRelease(releaseVersion, changelogContents, latestCommit, { dryRun }) {
|
|
2848
2863
|
if (!this.workspaceConfig) {
|
|
2849
|
-
this.workspaceConfig = await
|
|
2864
|
+
this.workspaceConfig = await chunk4ILBJTRR_cjs.getWorkspaceConfig();
|
|
2850
2865
|
}
|
|
2851
2866
|
const name = releaseVersion.gitTag.includes("@") ? releaseVersion.gitTag.replace(new RegExp(`^@${this.workspaceConfig.name}/`), "").replace(/@.*$/, "") : releaseVersion.gitTag;
|
|
2852
2867
|
return super.createOrUpdateRelease(
|
|
@@ -3025,6 +3040,54 @@ async function isUserAnOrganizationMember(userId, config5, remoteName = "origin"
|
|
|
3025
3040
|
return false;
|
|
3026
3041
|
}
|
|
3027
3042
|
}
|
|
3043
|
+
|
|
3044
|
+
// src/utilities/logs.ts
|
|
3045
|
+
function formatNxLog(message) {
|
|
3046
|
+
const { title, bodyLines } = message;
|
|
3047
|
+
return `${title}${bodyLines && bodyLines.length > 0 ? `
|
|
3048
|
+
${bodyLines.map((line) => ` ${line}`).join("\n")}` : ""}`;
|
|
3049
|
+
}
|
|
3050
|
+
async function format3(path, data) {
|
|
3051
|
+
let code = data;
|
|
3052
|
+
try {
|
|
3053
|
+
const resolvedConfig = await prettier.resolveConfig(path);
|
|
3054
|
+
if (resolvedConfig) {
|
|
3055
|
+
code = await prettier.format(
|
|
3056
|
+
data,
|
|
3057
|
+
chunk4ILBJTRR_cjs.defu(
|
|
3058
|
+
{
|
|
3059
|
+
absolutePath: path,
|
|
3060
|
+
...resolvedConfig
|
|
3061
|
+
},
|
|
3062
|
+
path.endsWith(".ts") || path.endsWith(".tsx") ? { plugins: [importsPlugin__default.default] } : {}
|
|
3063
|
+
)
|
|
3064
|
+
);
|
|
3065
|
+
}
|
|
3066
|
+
} catch (error) {
|
|
3067
|
+
throw new Error(
|
|
3068
|
+
`Failed to format file at ${path} with Prettier: ${error.message}`,
|
|
3069
|
+
{ cause: error }
|
|
3070
|
+
);
|
|
3071
|
+
}
|
|
3072
|
+
return code;
|
|
3073
|
+
}
|
|
3074
|
+
async function formatChangedFiles(tree) {
|
|
3075
|
+
if (process.env.NX_SKIP_FORMAT === "true") {
|
|
3076
|
+
return;
|
|
3077
|
+
}
|
|
3078
|
+
const files = new Set(
|
|
3079
|
+
tree.listChanges().filter((file) => file.type !== "DELETE")
|
|
3080
|
+
);
|
|
3081
|
+
const results = await Promise.all(
|
|
3082
|
+
Array.from(files).filter((file) => file.content && file.path).map(async (file) => [
|
|
3083
|
+
file.path,
|
|
3084
|
+
await format3(file.path, file.content?.toString("utf-8") ?? "")
|
|
3085
|
+
])
|
|
3086
|
+
);
|
|
3087
|
+
for (const [path, content] of results) {
|
|
3088
|
+
tree.write(path, content);
|
|
3089
|
+
}
|
|
3090
|
+
}
|
|
3028
3091
|
var StormChangelogRenderer = class extends DefaultChangelogRenderer__default.default {
|
|
3029
3092
|
/**
|
|
3030
3093
|
* The Storm workspace configuration object, which is loaded from the storm-workspace.json file.
|
|
@@ -3047,7 +3110,7 @@ var StormChangelogRenderer = class extends DefaultChangelogRenderer__default.def
|
|
|
3047
3110
|
}
|
|
3048
3111
|
async render() {
|
|
3049
3112
|
if (!this.workspaceConfig) {
|
|
3050
|
-
this.workspaceConfig = await
|
|
3113
|
+
this.workspaceConfig = await chunk4ILBJTRR_cjs.getWorkspaceConfig();
|
|
3051
3114
|
}
|
|
3052
3115
|
return super.render();
|
|
3053
3116
|
}
|
|
@@ -3235,25 +3298,72 @@ var DEFAULT_CONVENTIONAL_COMMITS_CONFIG2 = {
|
|
|
3235
3298
|
types: DEFAULT_COMMIT_TYPES
|
|
3236
3299
|
};
|
|
3237
3300
|
var DEFAULT_RELEASE_TAG_PATTERN = "{projectName}@{version}";
|
|
3301
|
+
var DEFAULT_FIXED_RELEASE_TAG_PATTERN = "{releaseGroupName}@{version}";
|
|
3302
|
+
var DEFAULT_COMMIT_MESSAGE = "release(monorepo): Publish v{version} release updates";
|
|
3303
|
+
var DEFAULT_VERSION_ACTIONS_PATH = "@nx/js/src/release/version-actions";
|
|
3304
|
+
var DEFAULT_RELEASE_GROUP_GIT_CONFIG = {
|
|
3305
|
+
commit: false,
|
|
3306
|
+
commitMessage: DEFAULT_COMMIT_MESSAGE,
|
|
3307
|
+
commitArgs: "",
|
|
3308
|
+
tag: false,
|
|
3309
|
+
tagMessage: "",
|
|
3310
|
+
tagArgs: "",
|
|
3311
|
+
stageChanges: false,
|
|
3312
|
+
pushArgs: ""
|
|
3313
|
+
};
|
|
3314
|
+
var DEFAULT_VERSION_RELEASE_CONFIG = {
|
|
3315
|
+
currentVersionResolver: "git-tag",
|
|
3316
|
+
fallbackCurrentVersionResolver: "disk",
|
|
3317
|
+
specifierSource: "conventional-commits",
|
|
3318
|
+
groupPreVersionCommand: "pnpm build",
|
|
3319
|
+
versionActions: DEFAULT_VERSION_ACTIONS_PATH,
|
|
3320
|
+
versionActionsOptions: {},
|
|
3321
|
+
preserveLocalDependencyProtocols: true,
|
|
3322
|
+
preserveMatchingDependencyRanges: true,
|
|
3323
|
+
logUnchangedProjects: true,
|
|
3324
|
+
updateDependents: "always",
|
|
3325
|
+
git: {
|
|
3326
|
+
...DEFAULT_RELEASE_GROUP_GIT_CONFIG,
|
|
3327
|
+
stageChanges: true
|
|
3328
|
+
}
|
|
3329
|
+
};
|
|
3330
|
+
var DEFAULT_CHANGELOG_RELEASE_CONFIG = {
|
|
3331
|
+
createRelease: "github",
|
|
3332
|
+
entryWhenNoChanges: "This was a version bump only for {projectName} to align it with other projects, there were no code changes.",
|
|
3333
|
+
file: false,
|
|
3334
|
+
renderOptions: {
|
|
3335
|
+
authors: false,
|
|
3336
|
+
commitReferences: true,
|
|
3337
|
+
versionTitleDate: true
|
|
3338
|
+
},
|
|
3339
|
+
git: {
|
|
3340
|
+
...DEFAULT_RELEASE_GROUP_GIT_CONFIG,
|
|
3341
|
+
commit: true,
|
|
3342
|
+
tag: true,
|
|
3343
|
+
push: true
|
|
3344
|
+
}
|
|
3345
|
+
};
|
|
3238
3346
|
var DEFAULT_RELEASE_GROUP_CONFIG = {
|
|
3239
3347
|
projectsRelationship: "independent",
|
|
3240
3348
|
changelog: {
|
|
3241
|
-
|
|
3242
|
-
entryWhenNoChanges: false,
|
|
3243
|
-
file: false,
|
|
3244
|
-
renderOptions: {
|
|
3245
|
-
authors: false,
|
|
3246
|
-
commitReferences: true,
|
|
3247
|
-
versionTitleDate: true
|
|
3248
|
-
}
|
|
3349
|
+
...DEFAULT_CHANGELOG_RELEASE_CONFIG
|
|
3249
3350
|
},
|
|
3250
3351
|
version: {
|
|
3251
|
-
|
|
3252
|
-
fallbackCurrentVersionResolver: "disk",
|
|
3253
|
-
specifierSource: "conventional-commits",
|
|
3254
|
-
groupPreVersionCommand: "pnpm build"
|
|
3352
|
+
...DEFAULT_VERSION_RELEASE_CONFIG
|
|
3255
3353
|
},
|
|
3256
|
-
releaseTag: {
|
|
3354
|
+
releaseTag: {
|
|
3355
|
+
pattern: DEFAULT_RELEASE_TAG_PATTERN,
|
|
3356
|
+
preferDockerVersion: false
|
|
3357
|
+
},
|
|
3358
|
+
versionPlans: false
|
|
3359
|
+
};
|
|
3360
|
+
var DEFAULT_FIXED_RELEASE_GROUP_CONFIG = {
|
|
3361
|
+
...DEFAULT_RELEASE_GROUP_CONFIG,
|
|
3362
|
+
projectsRelationship: "fixed",
|
|
3363
|
+
releaseTag: {
|
|
3364
|
+
...DEFAULT_RELEASE_GROUP_CONFIG.releaseTag,
|
|
3365
|
+
pattern: DEFAULT_FIXED_RELEASE_TAG_PATTERN
|
|
3366
|
+
}
|
|
3257
3367
|
};
|
|
3258
3368
|
var DEFAULT_JS_RELEASE_GROUP_CONFIG = {
|
|
3259
3369
|
...DEFAULT_RELEASE_GROUP_CONFIG,
|
|
@@ -3294,31 +3404,41 @@ var DEFAULT_RELEASE_CONFIG = {
|
|
|
3294
3404
|
crates: DEFAULT_RUST_RELEASE_GROUP_CONFIG
|
|
3295
3405
|
},
|
|
3296
3406
|
changelog: {
|
|
3407
|
+
...DEFAULT_CHANGELOG_RELEASE_CONFIG,
|
|
3297
3408
|
automaticFromRef: true,
|
|
3298
3409
|
workspaceChangelog: false,
|
|
3299
3410
|
projectChangelogs: true
|
|
3300
3411
|
},
|
|
3301
|
-
releaseTag: {
|
|
3412
|
+
releaseTag: {
|
|
3413
|
+
pattern: DEFAULT_RELEASE_TAG_PATTERN,
|
|
3414
|
+
preferDockerVersion: false
|
|
3415
|
+
},
|
|
3416
|
+
version: {
|
|
3417
|
+
...DEFAULT_VERSION_RELEASE_CONFIG
|
|
3418
|
+
}
|
|
3302
3419
|
};
|
|
3303
3420
|
function getReleaseGroupConfig(releaseConfig, workspaceConfig) {
|
|
3304
3421
|
return !releaseConfig?.groups || Object.keys(releaseConfig.groups).length === 0 ? {} : Object.fromEntries(
|
|
3305
3422
|
Object.entries(releaseConfig.groups).map(([name, group]) => {
|
|
3306
|
-
const config5 =
|
|
3423
|
+
const config5 = chunk4ILBJTRR_cjs.defu(
|
|
3307
3424
|
{
|
|
3308
|
-
...omit(
|
|
3425
|
+
...omit(
|
|
3426
|
+
group.projectsRelationship === "fixed" ? DEFAULT_FIXED_RELEASE_GROUP_CONFIG : DEFAULT_RELEASE_GROUP_CONFIG,
|
|
3427
|
+
["changelog", "version"]
|
|
3428
|
+
),
|
|
3309
3429
|
...group
|
|
3310
3430
|
},
|
|
3311
3431
|
{
|
|
3312
3432
|
version: {
|
|
3313
|
-
...DEFAULT_RELEASE_GROUP_CONFIG.version
|
|
3433
|
+
...(group.projectsRelationship === "fixed" ? DEFAULT_FIXED_RELEASE_GROUP_CONFIG : DEFAULT_RELEASE_GROUP_CONFIG).version
|
|
3314
3434
|
}
|
|
3315
3435
|
},
|
|
3316
3436
|
{
|
|
3317
3437
|
changelog: {
|
|
3318
|
-
...DEFAULT_RELEASE_GROUP_CONFIG.changelog,
|
|
3438
|
+
...(group.projectsRelationship === "fixed" ? DEFAULT_FIXED_RELEASE_GROUP_CONFIG : DEFAULT_RELEASE_GROUP_CONFIG).changelog,
|
|
3319
3439
|
renderer: StormChangelogRenderer,
|
|
3320
3440
|
renderOptions: {
|
|
3321
|
-
...DEFAULT_RELEASE_GROUP_CONFIG.changelog.renderOptions,
|
|
3441
|
+
...(group.projectsRelationship === "fixed" ? DEFAULT_FIXED_RELEASE_GROUP_CONFIG : DEFAULT_RELEASE_GROUP_CONFIG).changelog.renderOptions,
|
|
3322
3442
|
workspaceConfig
|
|
3323
3443
|
}
|
|
3324
3444
|
}
|
|
@@ -3326,13 +3446,13 @@ function getReleaseGroupConfig(releaseConfig, workspaceConfig) {
|
|
|
3326
3446
|
);
|
|
3327
3447
|
if (workspaceConfig?.workspaceRoot) {
|
|
3328
3448
|
if (config5.changelog?.renderer && typeof config5.changelog?.renderer === "string" && config5.changelog?.renderer?.toString().startsWith("./")) {
|
|
3329
|
-
config5.changelog.renderer =
|
|
3449
|
+
config5.changelog.renderer = chunk4ILBJTRR_cjs.joinPaths(
|
|
3330
3450
|
workspaceConfig.workspaceRoot,
|
|
3331
3451
|
config5.changelog.renderer
|
|
3332
3452
|
);
|
|
3333
3453
|
}
|
|
3334
3454
|
if (config5.version?.versionActions && config5.version.versionActions.startsWith("./")) {
|
|
3335
|
-
config5.version.versionActions =
|
|
3455
|
+
config5.version.versionActions = chunk4ILBJTRR_cjs.joinPaths(
|
|
3336
3456
|
workspaceConfig.workspaceRoot,
|
|
3337
3457
|
config5.version?.versionActions
|
|
3338
3458
|
);
|
|
@@ -3342,31 +3462,749 @@ function getReleaseGroupConfig(releaseConfig, workspaceConfig) {
|
|
|
3342
3462
|
})
|
|
3343
3463
|
);
|
|
3344
3464
|
}
|
|
3465
|
+
var StormReleaseGroupProcessor = class extends releaseGroupProcessor.ReleaseGroupProcessor {
|
|
3466
|
+
constructor(tree, workspaceConfig, projectGraph, nxReleaseConfig, releaseGraph, versionOptions) {
|
|
3467
|
+
super(tree, projectGraph, nxReleaseConfig, releaseGraph, {
|
|
3468
|
+
dryRun: !!versionOptions.dryRun,
|
|
3469
|
+
verbose: versionOptions.verbose || chunk4ILBJTRR_cjs.isVerbose(workspaceConfig.logLevel),
|
|
3470
|
+
firstRelease: !!versionOptions.firstRelease,
|
|
3471
|
+
preid: versionOptions.preid ?? workspaceConfig.preid ?? "",
|
|
3472
|
+
userGivenSpecifier: versionOptions.specifier,
|
|
3473
|
+
filters: {
|
|
3474
|
+
projects: versionOptions.projects,
|
|
3475
|
+
groups: versionOptions.groups
|
|
3476
|
+
},
|
|
3477
|
+
versionActionsOptionsOverrides: versionOptions.versionActionsOptionsOverrides
|
|
3478
|
+
});
|
|
3479
|
+
this.workspaceConfig = workspaceConfig;
|
|
3480
|
+
this.versionOptions = versionOptions;
|
|
3481
|
+
this.#tree = tree;
|
|
3482
|
+
this.#projectGraph = projectGraph;
|
|
3483
|
+
this.#nxReleaseConfig = nxReleaseConfig;
|
|
3484
|
+
this.#releaseGraph = releaseGraph;
|
|
3485
|
+
}
|
|
3486
|
+
#tree;
|
|
3487
|
+
#projectGraph;
|
|
3488
|
+
#nxReleaseConfig;
|
|
3489
|
+
#releaseGraph;
|
|
3490
|
+
/**
|
|
3491
|
+
* Track any version plan files that have been processed so that we can delete them after versioning is complete,
|
|
3492
|
+
* while leaving any unprocessed files in place.
|
|
3493
|
+
*/
|
|
3494
|
+
#processedVersionPlanFiles = /* @__PURE__ */ new Set();
|
|
3495
|
+
/**
|
|
3496
|
+
* Tracks which release groups have already been processed to avoid
|
|
3497
|
+
* processing them multiple times. Used during the group traversal.
|
|
3498
|
+
*/
|
|
3499
|
+
#processedGroups = /* @__PURE__ */ new Set();
|
|
3500
|
+
/**
|
|
3501
|
+
* Keeps track of which projects have already had their versions bumped.
|
|
3502
|
+
* This is used to avoid redundant version bumping and to determine which
|
|
3503
|
+
* projects need their dependencies updated.
|
|
3504
|
+
*/
|
|
3505
|
+
#bumpedProjects = /* @__PURE__ */ new Set();
|
|
3506
|
+
/**
|
|
3507
|
+
* versionData that will ultimately be returned to the nx release version handler by getVersionData()
|
|
3508
|
+
*/
|
|
3509
|
+
#versionData = /* @__PURE__ */ new Map();
|
|
3510
|
+
getReleaseGroupNameForProject(projectName) {
|
|
3511
|
+
const group = this.#releaseGraph.projectToReleaseGroup.get(projectName);
|
|
3512
|
+
return group ? group.name : null;
|
|
3513
|
+
}
|
|
3514
|
+
getNextGroup() {
|
|
3515
|
+
for (const [groupName, groupNode] of this.#releaseGraph.groupGraph) {
|
|
3516
|
+
if (!this.#processedGroups.has(groupName) && Array.from(groupNode.dependencies).every(
|
|
3517
|
+
(dep) => this.#processedGroups.has(dep)
|
|
3518
|
+
)) {
|
|
3519
|
+
return groupName;
|
|
3520
|
+
}
|
|
3521
|
+
}
|
|
3522
|
+
return null;
|
|
3523
|
+
}
|
|
3524
|
+
flushAllProjectLoggers() {
|
|
3525
|
+
for (const projectLogger of this.#releaseGraph.projectLoggers.values()) {
|
|
3526
|
+
projectLogger.flush();
|
|
3527
|
+
}
|
|
3528
|
+
}
|
|
3529
|
+
deleteProcessedVersionPlanFiles() {
|
|
3530
|
+
for (const versionPlanPath of this.#processedVersionPlanFiles) {
|
|
3531
|
+
this.#tree.delete(versionPlanPath);
|
|
3532
|
+
}
|
|
3533
|
+
}
|
|
3534
|
+
getVersionData() {
|
|
3535
|
+
return Object.fromEntries(this.#versionData);
|
|
3536
|
+
}
|
|
3537
|
+
/**
|
|
3538
|
+
* Invoke the afterAllProjectsVersioned functions for each unique versionActions type.
|
|
3539
|
+
* This can be useful for performing actions like updating a workspace level lock file.
|
|
3540
|
+
*
|
|
3541
|
+
* Because the tree has already been flushed to disk at this point, each afterAllProjectsVersioned
|
|
3542
|
+
* function is responsible for returning the list of changed and deleted files that it affected.
|
|
3543
|
+
*
|
|
3544
|
+
* The root level `release.version.versionActionsOptions` is what is passed in here because this
|
|
3545
|
+
* is a one time action for the whole workspace. Release group and project level overrides are
|
|
3546
|
+
* not applicable.
|
|
3547
|
+
*/
|
|
3548
|
+
async afterAllProjectsVersioned(rootVersionActionsOptions) {
|
|
3549
|
+
const changedFiles = /* @__PURE__ */ new Set();
|
|
3550
|
+
const deletedFiles = /* @__PURE__ */ new Set();
|
|
3551
|
+
for (const [, afterAllProjectsVersioned] of this.#releaseGraph.uniqueAfterAllProjectsVersioned) {
|
|
3552
|
+
const {
|
|
3553
|
+
changedFiles: changedFilesForVersionActions,
|
|
3554
|
+
deletedFiles: deletedFilesForVersionActions
|
|
3555
|
+
} = await afterAllProjectsVersioned(this.#tree.root, {
|
|
3556
|
+
dryRun: this.versionOptions.dryRun,
|
|
3557
|
+
verbose: this.versionOptions.verbose || chunk4ILBJTRR_cjs.isVerbose(this.workspaceConfig.logLevel),
|
|
3558
|
+
rootVersionActionsOptions
|
|
3559
|
+
});
|
|
3560
|
+
for (const file of changedFilesForVersionActions) {
|
|
3561
|
+
changedFiles.add(file);
|
|
3562
|
+
}
|
|
3563
|
+
for (const file of deletedFilesForVersionActions) {
|
|
3564
|
+
deletedFiles.add(file);
|
|
3565
|
+
}
|
|
3566
|
+
}
|
|
3567
|
+
return {
|
|
3568
|
+
changedFiles: Array.from(changedFiles),
|
|
3569
|
+
deletedFiles: Array.from(deletedFiles)
|
|
3570
|
+
};
|
|
3571
|
+
}
|
|
3572
|
+
async processDockerProjects(dockerVersionScheme, dockerVersion) {
|
|
3573
|
+
const dockerProjects = /* @__PURE__ */ new Map();
|
|
3574
|
+
for (const project of this.#versionData.keys()) {
|
|
3575
|
+
const hasDockerTechnology = Object.values(
|
|
3576
|
+
this.#projectGraph.nodes[project]?.data?.targets ?? []
|
|
3577
|
+
).some(({ metadata }) => metadata?.technologies?.includes("docker"));
|
|
3578
|
+
if (!hasDockerTechnology) {
|
|
3579
|
+
continue;
|
|
3580
|
+
}
|
|
3581
|
+
const finalConfigForProject = this.#releaseGraph.finalConfigsByProject.get(project);
|
|
3582
|
+
dockerProjects.set(project, finalConfigForProject);
|
|
3583
|
+
}
|
|
3584
|
+
if (dockerProjects.size === 0) {
|
|
3585
|
+
return;
|
|
3586
|
+
}
|
|
3587
|
+
let handleDockerVersion;
|
|
3588
|
+
try {
|
|
3589
|
+
const dockerVersionUtilsPath = "@nx/docker/release/version-utils";
|
|
3590
|
+
const { handleDockerVersion: _handleDockerVersion } = chunk4ILBJTRR_cjs.__require(dockerVersionUtilsPath);
|
|
3591
|
+
handleDockerVersion = _handleDockerVersion;
|
|
3592
|
+
} catch (e) {
|
|
3593
|
+
console.error(
|
|
3594
|
+
"Could not find `@nx/docker`. Please run `nx add @nx/docker` before attempting to release Docker images."
|
|
3595
|
+
);
|
|
3596
|
+
throw e;
|
|
3597
|
+
}
|
|
3598
|
+
for (const [project, finalConfigForProject] of dockerProjects.entries()) {
|
|
3599
|
+
const projectNode = this.#projectGraph.nodes[project];
|
|
3600
|
+
const projectVersionData = this.#versionData.get(project);
|
|
3601
|
+
const { newVersion, logs } = await handleDockerVersion(
|
|
3602
|
+
this.workspaceConfig.workspaceRoot,
|
|
3603
|
+
projectNode,
|
|
3604
|
+
finalConfigForProject,
|
|
3605
|
+
dockerVersionScheme,
|
|
3606
|
+
dockerVersion,
|
|
3607
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3608
|
+
projectVersionData?.newVersion
|
|
3609
|
+
);
|
|
3610
|
+
logs.forEach(
|
|
3611
|
+
(log) => this.#getProjectLoggerForProject(project).buffer(log)
|
|
3612
|
+
);
|
|
3613
|
+
const newVersionData = {
|
|
3614
|
+
...projectVersionData,
|
|
3615
|
+
dockerVersion: newVersion
|
|
3616
|
+
};
|
|
3617
|
+
this.#versionData.set(project, newVersionData);
|
|
3618
|
+
}
|
|
3619
|
+
this.flushAllProjectLoggers();
|
|
3620
|
+
}
|
|
3621
|
+
async processGroups() {
|
|
3622
|
+
const processOrder = [];
|
|
3623
|
+
for (const nextGroup of this.#releaseGraph.sortedReleaseGroups) {
|
|
3624
|
+
if (this.#processedGroups.has(nextGroup)) {
|
|
3625
|
+
continue;
|
|
3626
|
+
}
|
|
3627
|
+
if (!this.#releaseGraph.groupGraph.has(nextGroup)) {
|
|
3628
|
+
continue;
|
|
3629
|
+
}
|
|
3630
|
+
const allDependenciesProcessed = Array.from(
|
|
3631
|
+
this.#releaseGraph.groupGraph.get(nextGroup).dependencies
|
|
3632
|
+
).every((dep) => this.#processedGroups.has(dep));
|
|
3633
|
+
if (!allDependenciesProcessed) {
|
|
3634
|
+
for (const dep of this.#releaseGraph.groupGraph.get(nextGroup).dependencies) {
|
|
3635
|
+
if (!this.#processedGroups.has(dep)) {
|
|
3636
|
+
if (!this.#releaseGraph.groupGraph.has(dep)) {
|
|
3637
|
+
continue;
|
|
3638
|
+
}
|
|
3639
|
+
await this.#processGroup(dep);
|
|
3640
|
+
this.#processedGroups.add(dep);
|
|
3641
|
+
processOrder.push(dep);
|
|
3642
|
+
}
|
|
3643
|
+
}
|
|
3644
|
+
}
|
|
3645
|
+
await this.#processGroup(nextGroup);
|
|
3646
|
+
this.#processedGroups.add(nextGroup);
|
|
3647
|
+
processOrder.push(nextGroup);
|
|
3648
|
+
}
|
|
3649
|
+
return processOrder;
|
|
3650
|
+
}
|
|
3651
|
+
async #bumpVersions(releaseGroup) {
|
|
3652
|
+
if (releaseGroup.projectsRelationship === "fixed") {
|
|
3653
|
+
return this.#bumpFixedVersionGroup(releaseGroup);
|
|
3654
|
+
} else {
|
|
3655
|
+
return this.#bumpIndependentVersionGroup(releaseGroup);
|
|
3656
|
+
}
|
|
3657
|
+
}
|
|
3658
|
+
async #processGroup(releaseGroupName) {
|
|
3659
|
+
const groupNode = this.#releaseGraph.groupGraph.get(releaseGroupName);
|
|
3660
|
+
await this.#bumpVersions(groupNode.group);
|
|
3661
|
+
for (const project of groupNode.group.projects) {
|
|
3662
|
+
const projectLogger = this.#releaseGraph.projectLoggers.get(project);
|
|
3663
|
+
if (!projectLogger) {
|
|
3664
|
+
throw new Error(
|
|
3665
|
+
`No project logger found for project ${project} in release group ${releaseGroupName}. This should never happen.`
|
|
3666
|
+
);
|
|
3667
|
+
}
|
|
3668
|
+
projectLogger.flush();
|
|
3669
|
+
}
|
|
3670
|
+
}
|
|
3671
|
+
async #bumpFixedVersionGroup(releaseGroup) {
|
|
3672
|
+
if (releaseGroup.projects.length === 0) {
|
|
3673
|
+
return false;
|
|
3674
|
+
}
|
|
3675
|
+
let bumped = false;
|
|
3676
|
+
const firstProject = releaseGroup.projects.reduce((acc, project) => {
|
|
3677
|
+
const currentVersion = this.#getCurrentCachedVersionForProject(project);
|
|
3678
|
+
if (currentVersion && semver__default.default.gt(currentVersion, acc)) {
|
|
3679
|
+
return currentVersion;
|
|
3680
|
+
}
|
|
3681
|
+
return acc;
|
|
3682
|
+
}, "");
|
|
3683
|
+
const {
|
|
3684
|
+
newVersionInput,
|
|
3685
|
+
newVersionInputReason,
|
|
3686
|
+
newVersionInputReasonData
|
|
3687
|
+
} = await this.#determineVersionBumpForProject(releaseGroup, firstProject);
|
|
3688
|
+
if (newVersionInput === "none") {
|
|
3689
|
+
let bumpedByDependency = false;
|
|
3690
|
+
const sortedProjects2 = this.#releaseGraph.sortedProjects.get(releaseGroup.name) || [];
|
|
3691
|
+
for (const project of sortedProjects2) {
|
|
3692
|
+
const dependencies = this.#projectGraph.dependencies[project] || [];
|
|
3693
|
+
for (const dep of dependencies) {
|
|
3694
|
+
const depGroup = this.getReleaseGroupNameForProject(dep.target);
|
|
3695
|
+
if (depGroup && depGroup !== releaseGroup.name && this.#processedGroups.has(depGroup)) {
|
|
3696
|
+
const depGroupBumpType = await this.#getFixedReleaseGroupBumpType(depGroup);
|
|
3697
|
+
if (depGroupBumpType !== "none") {
|
|
3698
|
+
bumpedByDependency = true;
|
|
3699
|
+
const depBumpType = this.#determineSideEffectBump(
|
|
3700
|
+
releaseGroup,
|
|
3701
|
+
depGroupBumpType
|
|
3702
|
+
);
|
|
3703
|
+
await this.#bumpVersionForProject(
|
|
3704
|
+
project,
|
|
3705
|
+
depBumpType,
|
|
3706
|
+
"DEPENDENCY_ACROSS_GROUPS_WAS_BUMPED",
|
|
3707
|
+
{}
|
|
3708
|
+
);
|
|
3709
|
+
this.#bumpedProjects.add(project);
|
|
3710
|
+
await this.#updateDependenciesForProject(project);
|
|
3711
|
+
}
|
|
3712
|
+
}
|
|
3713
|
+
}
|
|
3714
|
+
}
|
|
3715
|
+
if (bumpedByDependency) {
|
|
3716
|
+
for (const project of sortedProjects2) {
|
|
3717
|
+
if (!this.#bumpedProjects.has(project)) {
|
|
3718
|
+
await this.#bumpVersionForProject(
|
|
3719
|
+
project,
|
|
3720
|
+
this.#applyPreidToBumpType("patch", project),
|
|
3721
|
+
"OTHER_PROJECT_IN_FIXED_GROUP_WAS_BUMPED_DUE_TO_DEPENDENCY",
|
|
3722
|
+
{}
|
|
3723
|
+
);
|
|
3724
|
+
this.#bumpedProjects.add(project);
|
|
3725
|
+
await this.#updateDependenciesForProject(project);
|
|
3726
|
+
}
|
|
3727
|
+
}
|
|
3728
|
+
} else {
|
|
3729
|
+
for (const project of releaseGroup.projects) {
|
|
3730
|
+
this.#versionData.set(project, {
|
|
3731
|
+
currentVersion: this.#getCurrentCachedVersionForProject(
|
|
3732
|
+
project
|
|
3733
|
+
),
|
|
3734
|
+
newVersion: null,
|
|
3735
|
+
dockerVersion: null,
|
|
3736
|
+
dependentProjects: this.#getOriginalDependentProjects(project)
|
|
3737
|
+
});
|
|
3738
|
+
if (project === firstProject) {
|
|
3739
|
+
continue;
|
|
3740
|
+
}
|
|
3741
|
+
const projectLogger = this.#getProjectLoggerForProject(project);
|
|
3742
|
+
projectLogger.buffer(
|
|
3743
|
+
`\u{1F6AB} Skipping versioning for ${project} as it is a part of a fixed release group with ${firstProject} and no dependency bumps were detected`
|
|
3744
|
+
);
|
|
3745
|
+
}
|
|
3746
|
+
}
|
|
3747
|
+
return bumpedByDependency;
|
|
3748
|
+
}
|
|
3749
|
+
const { newVersion } = await this.#calculateNewVersion(
|
|
3750
|
+
firstProject,
|
|
3751
|
+
newVersionInput,
|
|
3752
|
+
newVersionInputReason,
|
|
3753
|
+
newVersionInputReasonData
|
|
3754
|
+
);
|
|
3755
|
+
const sortedProjects = this.#releaseGraph.sortedProjects.get(releaseGroup.name) || releaseGroup.projects;
|
|
3756
|
+
for (const project of sortedProjects) {
|
|
3757
|
+
const versionActions = this.#getVersionActionsForProject(project);
|
|
3758
|
+
const projectLogger = this.#getProjectLoggerForProject(project);
|
|
3759
|
+
const currentVersion = this.#getCurrentCachedVersionForProject(
|
|
3760
|
+
project
|
|
3761
|
+
);
|
|
3762
|
+
if (project !== firstProject) {
|
|
3763
|
+
projectLogger.buffer(
|
|
3764
|
+
`\u2753 Applied version ${newVersion} directly, because the project is a member of a fixed release group containing ${firstProject}`
|
|
3765
|
+
);
|
|
3766
|
+
}
|
|
3767
|
+
const logMessages = await versionActions.updateProjectVersion(
|
|
3768
|
+
this.#tree,
|
|
3769
|
+
newVersion
|
|
3770
|
+
);
|
|
3771
|
+
for (const logMessage of logMessages) {
|
|
3772
|
+
projectLogger.buffer(logMessage);
|
|
3773
|
+
}
|
|
3774
|
+
this.#bumpedProjects.add(project);
|
|
3775
|
+
bumped = true;
|
|
3776
|
+
this.#versionData.set(project, {
|
|
3777
|
+
currentVersion,
|
|
3778
|
+
newVersion,
|
|
3779
|
+
dependentProjects: this.#getOriginalDependentProjects(project)
|
|
3780
|
+
});
|
|
3781
|
+
}
|
|
3782
|
+
if (bumped) {
|
|
3783
|
+
for (const project of sortedProjects) {
|
|
3784
|
+
await this.#updateDependenciesForProject(project);
|
|
3785
|
+
}
|
|
3786
|
+
}
|
|
3787
|
+
return bumped;
|
|
3788
|
+
}
|
|
3789
|
+
#getOriginalDependentProjects(project) {
|
|
3790
|
+
return this.#releaseGraph.originalDependentProjectsPerProject.get(project) || [];
|
|
3791
|
+
}
|
|
3792
|
+
async #updateDependenciesForProject(projectName) {
|
|
3793
|
+
if (!this.#releaseGraph.allProjectsToProcess.has(projectName)) {
|
|
3794
|
+
throw new Error(
|
|
3795
|
+
`Unable to find ${projectName} in allProjectsToProcess, please report this as a bug on https://github.com/nrwl/nx/issues`
|
|
3796
|
+
);
|
|
3797
|
+
}
|
|
3798
|
+
const versionActions = this.#getVersionActionsForProject(projectName);
|
|
3799
|
+
const cachedFinalConfigForProject = this.#getCachedFinalConfigForProject(projectName);
|
|
3800
|
+
const dependenciesToUpdate = {};
|
|
3801
|
+
const dependencies = this.#projectGraph.dependencies[projectName] || [];
|
|
3802
|
+
for (const dep of dependencies) {
|
|
3803
|
+
if (this.#releaseGraph.allProjectsToProcess.has(dep.target)) {
|
|
3804
|
+
const targetVersionData = this.#versionData.get(dep.target);
|
|
3805
|
+
if (targetVersionData) {
|
|
3806
|
+
const { currentVersion: currentDependencyVersion } = await versionActions.readCurrentVersionOfDependency(
|
|
3807
|
+
this.#tree,
|
|
3808
|
+
this.#projectGraph,
|
|
3809
|
+
dep.target
|
|
3810
|
+
);
|
|
3811
|
+
if (!currentDependencyVersion) {
|
|
3812
|
+
continue;
|
|
3813
|
+
}
|
|
3814
|
+
let finalPrefix = "";
|
|
3815
|
+
if (cachedFinalConfigForProject.versionPrefix === "auto") {
|
|
3816
|
+
const prefixMatch = currentDependencyVersion?.match(/^([~^=])/);
|
|
3817
|
+
finalPrefix = prefixMatch ? prefixMatch[1] : "";
|
|
3818
|
+
} else if (cachedFinalConfigForProject.versionPrefix && ["~", "^", "="].includes(cachedFinalConfigForProject.versionPrefix)) {
|
|
3819
|
+
finalPrefix = cachedFinalConfigForProject.versionPrefix;
|
|
3820
|
+
}
|
|
3821
|
+
const newVersion = targetVersionData.newVersion ?? this.#releaseGraph.cachedCurrentVersions.get(dep.target) ?? currentDependencyVersion;
|
|
3822
|
+
const cleanNewVersion = newVersion.replace(/^[~^=]/, "");
|
|
3823
|
+
dependenciesToUpdate[dep.target] = `${finalPrefix}${cleanNewVersion}`;
|
|
3824
|
+
}
|
|
3825
|
+
}
|
|
3826
|
+
}
|
|
3827
|
+
const projectLogger = this.#getProjectLoggerForProject(projectName);
|
|
3828
|
+
const logMessages = await versionActions.updateProjectDependencies(
|
|
3829
|
+
this.#tree,
|
|
3830
|
+
this.#projectGraph,
|
|
3831
|
+
dependenciesToUpdate
|
|
3832
|
+
);
|
|
3833
|
+
for (const logMessage of logMessages) {
|
|
3834
|
+
projectLogger.buffer(logMessage);
|
|
3835
|
+
}
|
|
3836
|
+
}
|
|
3837
|
+
#getVersionActionsForProject(projectName) {
|
|
3838
|
+
const versionActions = this.#releaseGraph.projectsToVersionActions.get(projectName);
|
|
3839
|
+
if (!versionActions) {
|
|
3840
|
+
throw new Error(
|
|
3841
|
+
`No versionActions found for project ${projectName}, please report this as a bug on https://github.com/nrwl/nx/issues`
|
|
3842
|
+
);
|
|
3843
|
+
}
|
|
3844
|
+
return versionActions;
|
|
3845
|
+
}
|
|
3846
|
+
async #getFixedReleaseGroupBumpType(releaseGroupName) {
|
|
3847
|
+
const releaseGroup = this.#releaseGraph.groupGraph.get(releaseGroupName).group;
|
|
3848
|
+
const releaseGroupFilteredProjects = this.#releaseGraph.releaseGroupToFilteredProjects.get(releaseGroup);
|
|
3849
|
+
if (!releaseGroupFilteredProjects || releaseGroupFilteredProjects.size === 0) {
|
|
3850
|
+
return "none";
|
|
3851
|
+
}
|
|
3852
|
+
const anyProject = releaseGroupFilteredProjects.values().next().value;
|
|
3853
|
+
const { currentVersion, newVersion } = this.#versionData.get(anyProject);
|
|
3854
|
+
if (newVersion) {
|
|
3855
|
+
return semver__default.default.diff(currentVersion, newVersion);
|
|
3856
|
+
}
|
|
3857
|
+
return (await this.#determineVersionBumpForProject(releaseGroup, anyProject)).newVersionInput;
|
|
3858
|
+
}
|
|
3859
|
+
// TODO: Support influencing the side effect bump in a future version, always patch for now like in legacy versioning
|
|
3860
|
+
#determineSideEffectBump(releaseGroup, dependencyBumpType) {
|
|
3861
|
+
const anyProject = releaseGroup.projects[0];
|
|
3862
|
+
return this.#applyPreidToBumpType("patch", anyProject);
|
|
3863
|
+
}
|
|
3864
|
+
/**
|
|
3865
|
+
* When a preid is set (e.g. --preid rc) and the project has opted in via
|
|
3866
|
+
* `applyPreidToDependents`, convert a "patch" side-effect bump into a
|
|
3867
|
+
* "prepatch" so that semver.inc() actually applies the preid.
|
|
3868
|
+
* semver.inc('1.0.0', 'patch', 'rc') ignores preid and returns '1.0.1'.
|
|
3869
|
+
* semver.inc('1.0.0', 'prepatch', 'rc') returns '1.0.1-rc.0' as expected.
|
|
3870
|
+
*/
|
|
3871
|
+
#applyPreidToBumpType(bumpType, projectName) {
|
|
3872
|
+
if (!(this.versionOptions.preid && this.workspaceConfig.preid) || bumpType === "none" || bumpType.startsWith("pre")) {
|
|
3873
|
+
return bumpType;
|
|
3874
|
+
}
|
|
3875
|
+
const finalConfig = this.#getCachedFinalConfigForProject(projectName);
|
|
3876
|
+
if (!finalConfig.applyPreidToDependents) {
|
|
3877
|
+
return bumpType;
|
|
3878
|
+
}
|
|
3879
|
+
switch (bumpType) {
|
|
3880
|
+
case "major":
|
|
3881
|
+
return "premajor";
|
|
3882
|
+
case "minor":
|
|
3883
|
+
return "preminor";
|
|
3884
|
+
case "patch":
|
|
3885
|
+
return "prepatch";
|
|
3886
|
+
default:
|
|
3887
|
+
return bumpType;
|
|
3888
|
+
}
|
|
3889
|
+
}
|
|
3890
|
+
#getCachedFinalConfigForProject(projectName) {
|
|
3891
|
+
const cachedFinalConfig = this.#releaseGraph.finalConfigsByProject.get(projectName);
|
|
3892
|
+
if (!cachedFinalConfig) {
|
|
3893
|
+
throw new Error(
|
|
3894
|
+
`Unexpected error: No cached config found for project ${projectName}, please report this as a bug on https://github.com/nrwl/nx/issues`
|
|
3895
|
+
);
|
|
3896
|
+
}
|
|
3897
|
+
return cachedFinalConfig;
|
|
3898
|
+
}
|
|
3899
|
+
async #bumpIndependentVersionGroup(releaseGroup) {
|
|
3900
|
+
const releaseGroupFilteredProjects = this.#releaseGraph.releaseGroupToFilteredProjects.get(releaseGroup);
|
|
3901
|
+
let bumped = false;
|
|
3902
|
+
const projectBumpTypes = /* @__PURE__ */ new Map();
|
|
3903
|
+
const projectsToUpdate = /* @__PURE__ */ new Set();
|
|
3904
|
+
if (releaseGroupFilteredProjects && releaseGroupFilteredProjects.size > 0) {
|
|
3905
|
+
for (const project of releaseGroupFilteredProjects) {
|
|
3906
|
+
const {
|
|
3907
|
+
newVersionInput: bumpType,
|
|
3908
|
+
newVersionInputReason: bumpTypeReason,
|
|
3909
|
+
newVersionInputReasonData: bumpTypeReasonData
|
|
3910
|
+
} = await this.#determineVersionBumpForProject(releaseGroup, project);
|
|
3911
|
+
projectBumpTypes.set(project, {
|
|
3912
|
+
bumpType,
|
|
3913
|
+
bumpTypeReason,
|
|
3914
|
+
bumpTypeReasonData
|
|
3915
|
+
});
|
|
3916
|
+
if (bumpType !== "none") {
|
|
3917
|
+
projectsToUpdate.add(project);
|
|
3918
|
+
}
|
|
3919
|
+
}
|
|
3920
|
+
const sortedProjects = this.#releaseGraph.sortedProjects.get(releaseGroup.name) || [];
|
|
3921
|
+
for (const project of sortedProjects) {
|
|
3922
|
+
if (projectsToUpdate.has(project) && releaseGroupFilteredProjects?.has(project)) {
|
|
3923
|
+
const {
|
|
3924
|
+
bumpType: finalBumpType,
|
|
3925
|
+
bumpTypeReason: finalBumpTypeReason,
|
|
3926
|
+
bumpTypeReasonData: finalBumpTypeReasonData
|
|
3927
|
+
} = projectBumpTypes.get(project);
|
|
3928
|
+
if (finalBumpType !== "none") {
|
|
3929
|
+
await this.#bumpVersionForProject(
|
|
3930
|
+
project,
|
|
3931
|
+
finalBumpType,
|
|
3932
|
+
finalBumpTypeReason,
|
|
3933
|
+
finalBumpTypeReasonData
|
|
3934
|
+
);
|
|
3935
|
+
this.#bumpedProjects.add(project);
|
|
3936
|
+
bumped = true;
|
|
3937
|
+
}
|
|
3938
|
+
}
|
|
3939
|
+
}
|
|
3940
|
+
for (const project of sortedProjects) {
|
|
3941
|
+
if (projectsToUpdate.has(project) && releaseGroupFilteredProjects?.has(project)) {
|
|
3942
|
+
await this.#updateDependenciesForProject(project);
|
|
3943
|
+
}
|
|
3944
|
+
}
|
|
3945
|
+
}
|
|
3946
|
+
return bumped;
|
|
3947
|
+
}
|
|
3948
|
+
#getCurrentCachedVersionForProject(projectName) {
|
|
3949
|
+
return this.#releaseGraph.cachedCurrentVersions.get(projectName) || null;
|
|
3950
|
+
}
|
|
3951
|
+
async #calculateNewVersion(project, newVersionInput, newVersionInputReason, newVersionInputReasonData) {
|
|
3952
|
+
const currentVersion = this.#getCurrentCachedVersionForProject(project);
|
|
3953
|
+
const versionActions = this.#getVersionActionsForProject(project);
|
|
3954
|
+
const { newVersion, logText } = await versionActions.calculateNewVersion(
|
|
3955
|
+
currentVersion,
|
|
3956
|
+
newVersionInput,
|
|
3957
|
+
newVersionInputReason,
|
|
3958
|
+
newVersionInputReasonData,
|
|
3959
|
+
this.versionOptions.preid || this.workspaceConfig.preid || ""
|
|
3960
|
+
);
|
|
3961
|
+
const projectLogger = this.#getProjectLoggerForProject(project);
|
|
3962
|
+
projectLogger.buffer(logText);
|
|
3963
|
+
return { currentVersion, newVersion };
|
|
3964
|
+
}
|
|
3965
|
+
async #bumpVersionForProject(projectName, bumpType, bumpTypeReason, bumpTypeReasonData) {
|
|
3966
|
+
const projectLogger = this.#getProjectLoggerForProject(projectName);
|
|
3967
|
+
if (bumpType === "none") {
|
|
3968
|
+
projectLogger.buffer(
|
|
3969
|
+
`\u23E9 Skipping bump for ${projectName} as bump type is "none"`
|
|
3970
|
+
);
|
|
3971
|
+
return;
|
|
3972
|
+
}
|
|
3973
|
+
const versionActions = this.#getVersionActionsForProject(projectName);
|
|
3974
|
+
const { currentVersion, newVersion } = await this.#calculateNewVersion(
|
|
3975
|
+
projectName,
|
|
3976
|
+
bumpType,
|
|
3977
|
+
bumpTypeReason,
|
|
3978
|
+
bumpTypeReasonData
|
|
3979
|
+
);
|
|
3980
|
+
const logMessages = await versionActions.updateProjectVersion(
|
|
3981
|
+
this.#tree,
|
|
3982
|
+
newVersion
|
|
3983
|
+
);
|
|
3984
|
+
for (const logMessage of logMessages) {
|
|
3985
|
+
projectLogger.buffer(logMessage);
|
|
3986
|
+
}
|
|
3987
|
+
this.#versionData.set(projectName, {
|
|
3988
|
+
currentVersion,
|
|
3989
|
+
newVersion,
|
|
3990
|
+
dependentProjects: this.#getOriginalDependentProjects(projectName)
|
|
3991
|
+
});
|
|
3992
|
+
this.#bumpedProjects.add(projectName);
|
|
3993
|
+
const releaseGroupName = this.getReleaseGroupNameForProject(projectName);
|
|
3994
|
+
if (!releaseGroupName) {
|
|
3995
|
+
projectLogger.buffer(
|
|
3996
|
+
`\u26A0\uFE0F Cannot find release group for ${projectName}, skipping dependent updates`
|
|
3997
|
+
);
|
|
3998
|
+
return;
|
|
3999
|
+
}
|
|
4000
|
+
const releaseGroup = this.#releaseGraph.groupGraph.get(releaseGroupName).group;
|
|
4001
|
+
const releaseGroupVersionConfig = releaseGroup.version;
|
|
4002
|
+
const updateDependents = releaseGroupVersionConfig?.updateDependents || "always";
|
|
4003
|
+
if (updateDependents === "auto" || updateDependents === "always") {
|
|
4004
|
+
const dependents = this.#getNonImplicitDependentsForProject(projectName);
|
|
4005
|
+
const dependentsToProcess = dependents.filter(
|
|
4006
|
+
(dep) => this.#releaseGraph.allProjectsToProcess.has(dep)
|
|
4007
|
+
);
|
|
4008
|
+
await this.#updateDependenciesForDependents(dependentsToProcess);
|
|
4009
|
+
for (const dependent of dependentsToProcess) {
|
|
4010
|
+
if (!this.#bumpedProjects.has(dependent)) {
|
|
4011
|
+
await this.#bumpVersionForProject(
|
|
4012
|
+
dependent,
|
|
4013
|
+
this.#applyPreidToBumpType("patch", dependent),
|
|
4014
|
+
"DEPENDENCY_WAS_BUMPED",
|
|
4015
|
+
{}
|
|
4016
|
+
);
|
|
4017
|
+
}
|
|
4018
|
+
}
|
|
4019
|
+
} else {
|
|
4020
|
+
const releaseGroupText = releaseGroupName !== config_js.IMPLICIT_DEFAULT_RELEASE_GROUP ? ` in release group "${releaseGroupName}" ` : " ";
|
|
4021
|
+
projectLogger.buffer(
|
|
4022
|
+
`\u23E9 Skipping dependent updates as "updateDependents"${releaseGroupText}is not "auto"`
|
|
4023
|
+
);
|
|
4024
|
+
}
|
|
4025
|
+
}
|
|
4026
|
+
#getProjectDependents(project) {
|
|
4027
|
+
return this.#releaseGraph.projectToDependents.get(project) || /* @__PURE__ */ new Set();
|
|
4028
|
+
}
|
|
4029
|
+
#getNonImplicitDependentsForProject(project) {
|
|
4030
|
+
return Array.from(this.#getProjectDependents(project));
|
|
4031
|
+
}
|
|
4032
|
+
async #updateDependenciesForDependents(dependents) {
|
|
4033
|
+
for (const dependent of dependents) {
|
|
4034
|
+
if (!this.#releaseGraph?.allProjectsToProcess.has(dependent)) {
|
|
4035
|
+
throw new Error(
|
|
4036
|
+
`Unable to find project "${dependent}" in allProjectsToProcess, please report this as a bug on https://github.com/nrwl/nx/issues`
|
|
4037
|
+
);
|
|
4038
|
+
}
|
|
4039
|
+
await this.#updateDependenciesForProject(dependent);
|
|
4040
|
+
}
|
|
4041
|
+
}
|
|
4042
|
+
async #determineVersionBumpForProject(releaseGroup, projectName) {
|
|
4043
|
+
if (this.versionOptions.specifier) {
|
|
4044
|
+
return {
|
|
4045
|
+
newVersionInput: this.versionOptions.specifier,
|
|
4046
|
+
newVersionInputReason: "USER_SPECIFIER",
|
|
4047
|
+
newVersionInputReasonData: {}
|
|
4048
|
+
};
|
|
4049
|
+
}
|
|
4050
|
+
const projectGraphNode = this.#projectGraph.nodes[projectName];
|
|
4051
|
+
const projectLogger = this.#getProjectLoggerForProject(projectName);
|
|
4052
|
+
const cachedFinalConfigForProject = this.#getCachedFinalConfigForProject(projectName);
|
|
4053
|
+
if (cachedFinalConfigForProject.specifierSource === "conventional-commits") {
|
|
4054
|
+
const currentVersion = this.#getCurrentCachedVersionForProject(projectName);
|
|
4055
|
+
const bumpType = await deriveSpecifierFromConventionalCommits.deriveSpecifierFromConventionalCommits(
|
|
4056
|
+
{
|
|
4057
|
+
...this.#nxReleaseConfig,
|
|
4058
|
+
git: this.#nxReleaseConfig.git ?? {}
|
|
4059
|
+
},
|
|
4060
|
+
this.#projectGraph,
|
|
4061
|
+
projectLogger,
|
|
4062
|
+
releaseGroup,
|
|
4063
|
+
projectGraphNode,
|
|
4064
|
+
!!semver__default.default.prerelease(currentVersion ?? ""),
|
|
4065
|
+
this.#releaseGraph.cachedLatestMatchingGitTag.get(projectName),
|
|
4066
|
+
this.#releaseGraph,
|
|
4067
|
+
cachedFinalConfigForProject.fallbackCurrentVersionResolver,
|
|
4068
|
+
this.versionOptions.preid || this.workspaceConfig.preid || ""
|
|
4069
|
+
);
|
|
4070
|
+
return {
|
|
4071
|
+
newVersionInput: bumpType,
|
|
4072
|
+
newVersionInputReason: "CONVENTIONAL_COMMITS",
|
|
4073
|
+
newVersionInputReasonData: {}
|
|
4074
|
+
};
|
|
4075
|
+
}
|
|
4076
|
+
if (releaseGroup.versionPlans) {
|
|
4077
|
+
const currentVersion = this.#getCurrentCachedVersionForProject(projectName);
|
|
4078
|
+
const { bumpType, versionPlanPath } = await deriverSpecifierFromVersionPlans.deriveSpecifierFromVersionPlan(
|
|
4079
|
+
projectLogger,
|
|
4080
|
+
releaseGroup,
|
|
4081
|
+
projectGraphNode,
|
|
4082
|
+
currentVersion
|
|
4083
|
+
);
|
|
4084
|
+
if (bumpType !== "none") {
|
|
4085
|
+
this.#processedVersionPlanFiles.add(versionPlanPath);
|
|
4086
|
+
}
|
|
4087
|
+
return {
|
|
4088
|
+
newVersionInput: bumpType,
|
|
4089
|
+
newVersionInputReason: "VERSION_PLANS",
|
|
4090
|
+
newVersionInputReasonData: {
|
|
4091
|
+
versionPlanPath
|
|
4092
|
+
}
|
|
4093
|
+
};
|
|
4094
|
+
}
|
|
4095
|
+
const versionActions = this.#getVersionActionsForProject(projectName);
|
|
4096
|
+
if (versionActions instanceof versionActions_js.NOOP_VERSION_ACTIONS) {
|
|
4097
|
+
return {
|
|
4098
|
+
newVersionInput: "none",
|
|
4099
|
+
newVersionInputReason: "NOOP_VERSION_ACTIONS",
|
|
4100
|
+
newVersionInputReasonData: {}
|
|
4101
|
+
};
|
|
4102
|
+
}
|
|
4103
|
+
throw new Error(
|
|
4104
|
+
`Unhandled version bump config, please report this as a bug on https://github.com/nrwl/nx/issues`
|
|
4105
|
+
);
|
|
4106
|
+
}
|
|
4107
|
+
#getProjectLoggerForProject(projectName) {
|
|
4108
|
+
const projectLogger = this.#releaseGraph.projectLoggers.get(projectName);
|
|
4109
|
+
if (!projectLogger) {
|
|
4110
|
+
throw new Error(
|
|
4111
|
+
`No project logger found for project ${projectName}, please report this as a bug on https://github.com/nrwl/nx/issues`
|
|
4112
|
+
);
|
|
4113
|
+
}
|
|
4114
|
+
return projectLogger;
|
|
4115
|
+
}
|
|
4116
|
+
};
|
|
3345
4117
|
|
|
3346
4118
|
// src/release/release-client.ts
|
|
3347
4119
|
var StormReleaseClient = class _StormReleaseClient extends release.ReleaseClient {
|
|
3348
4120
|
static async create(releaseConfig = {}, ignoreNxJsonConfig = false, workspaceConfig) {
|
|
3349
4121
|
if (!workspaceConfig) {
|
|
3350
|
-
workspaceConfig = await
|
|
3351
|
-
}
|
|
3352
|
-
let projectGraph;
|
|
3353
|
-
try {
|
|
3354
|
-
projectGraph = devkit.readCachedProjectGraph();
|
|
3355
|
-
} catch {
|
|
3356
|
-
projectGraph = await devkit.createProjectGraphAsync({
|
|
3357
|
-
exitOnError: true,
|
|
3358
|
-
resetDaemonClient: true
|
|
3359
|
-
});
|
|
4122
|
+
workspaceConfig = await chunk4ILBJTRR_cjs.getWorkspaceConfig();
|
|
3360
4123
|
}
|
|
4124
|
+
const projectGraph = await devkit.createProjectGraphAsync({
|
|
4125
|
+
exitOnError: true,
|
|
4126
|
+
resetDaemonClient: true
|
|
4127
|
+
});
|
|
3361
4128
|
if (!projectGraph) {
|
|
3362
4129
|
throw new Error(
|
|
3363
4130
|
"Failed to load the project graph. Please run `nx reset`, then run the `storm-git commit` command again."
|
|
3364
4131
|
);
|
|
3365
4132
|
}
|
|
4133
|
+
let nxJson$1;
|
|
4134
|
+
if (!ignoreNxJsonConfig && fs$1.existsSync(chunk4ILBJTRR_cjs.joinPaths(workspaceConfig.workspaceRoot, "nx.json"))) {
|
|
4135
|
+
nxJson$1 = nxJson.readNxJson();
|
|
4136
|
+
}
|
|
4137
|
+
const config5 = chunk4ILBJTRR_cjs.defu(
|
|
4138
|
+
{
|
|
4139
|
+
changelog: {
|
|
4140
|
+
renderOptions: {
|
|
4141
|
+
workspaceConfig
|
|
4142
|
+
}
|
|
4143
|
+
}
|
|
4144
|
+
},
|
|
4145
|
+
{
|
|
4146
|
+
groups: getReleaseGroupConfig(releaseConfig, workspaceConfig)
|
|
4147
|
+
},
|
|
4148
|
+
{
|
|
4149
|
+
groups: getReleaseGroupConfig(
|
|
4150
|
+
nxJson$1.release ?? {},
|
|
4151
|
+
workspaceConfig
|
|
4152
|
+
)
|
|
4153
|
+
},
|
|
4154
|
+
omit(releaseConfig, ["groups"]),
|
|
4155
|
+
nxJson$1.release ? omit(nxJson$1.release, ["groups"]) : {},
|
|
4156
|
+
omit(DEFAULT_RELEASE_CONFIG, ["groups"])
|
|
4157
|
+
);
|
|
4158
|
+
const normalizedConfig = clone__default.default(config5);
|
|
4159
|
+
if (workspaceConfig.preid) {
|
|
4160
|
+
normalizedConfig.groups = Object.fromEntries(
|
|
4161
|
+
Object.entries(normalizedConfig.groups ?? {}).map(([name, group]) => {
|
|
4162
|
+
return [
|
|
4163
|
+
name,
|
|
4164
|
+
{
|
|
4165
|
+
...group,
|
|
4166
|
+
version: {
|
|
4167
|
+
...group.version,
|
|
4168
|
+
preid: workspaceConfig.preid
|
|
4169
|
+
}
|
|
4170
|
+
}
|
|
4171
|
+
];
|
|
4172
|
+
})
|
|
4173
|
+
);
|
|
4174
|
+
}
|
|
4175
|
+
const alreadyMatchedProjects = /* @__PURE__ */ new Set();
|
|
4176
|
+
normalizedConfig.groups = Object.fromEntries(
|
|
4177
|
+
Object.entries(normalizedConfig.groups ?? {}).map(([name, group]) => {
|
|
4178
|
+
const matchingProjects = findMatchingProjects.findMatchingProjects(
|
|
4179
|
+
group.projects,
|
|
4180
|
+
projectGraph.nodes
|
|
4181
|
+
);
|
|
4182
|
+
if (!matchingProjects.length) {
|
|
4183
|
+
throw new Error(
|
|
4184
|
+
`Release group "${name}" does not have any matching projects.`
|
|
4185
|
+
);
|
|
4186
|
+
}
|
|
4187
|
+
for (const project of matchingProjects) {
|
|
4188
|
+
if (alreadyMatchedProjects.has(project)) {
|
|
4189
|
+
throw new Error(
|
|
4190
|
+
`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.`
|
|
4191
|
+
);
|
|
4192
|
+
}
|
|
4193
|
+
alreadyMatchedProjects.add(project);
|
|
4194
|
+
}
|
|
4195
|
+
return [
|
|
4196
|
+
name,
|
|
4197
|
+
{
|
|
4198
|
+
...group,
|
|
4199
|
+
projects: matchingProjects
|
|
4200
|
+
}
|
|
4201
|
+
];
|
|
4202
|
+
})
|
|
4203
|
+
);
|
|
3366
4204
|
return new _StormReleaseClient(
|
|
3367
4205
|
projectGraph,
|
|
3368
|
-
|
|
3369
|
-
|
|
4206
|
+
config5,
|
|
4207
|
+
normalizedConfig,
|
|
3370
4208
|
workspaceConfig
|
|
3371
4209
|
);
|
|
3372
4210
|
}
|
|
@@ -3374,6 +4212,10 @@ var StormReleaseClient = class _StormReleaseClient extends release.ReleaseClient
|
|
|
3374
4212
|
* The release configuration used by this release client.
|
|
3375
4213
|
*/
|
|
3376
4214
|
config;
|
|
4215
|
+
/**
|
|
4216
|
+
* The normalized release configuration used by this release client.
|
|
4217
|
+
*/
|
|
4218
|
+
normalizedConfig;
|
|
3377
4219
|
/**
|
|
3378
4220
|
* The workspace configuration used by this release client.
|
|
3379
4221
|
*/
|
|
@@ -3398,40 +4240,16 @@ var StormReleaseClient = class _StormReleaseClient extends release.ReleaseClient
|
|
|
3398
4240
|
* @param ignoreNxJsonConfig - Whether to ignore the nx.json configuration and use only the provided {@link releaseConfig}. Default is false.
|
|
3399
4241
|
* @param workspaceConfig - Optional Storm workspace configuration object for logging purposes.
|
|
3400
4242
|
*/
|
|
3401
|
-
constructor(projectGraph,
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
nxJson$1 = nxJson.readNxJson();
|
|
3405
|
-
}
|
|
3406
|
-
const config5 = chunkPTYTYIPG_cjs.defu(
|
|
3407
|
-
{
|
|
3408
|
-
changelog: {
|
|
3409
|
-
renderOptions: {
|
|
3410
|
-
workspaceConfig
|
|
3411
|
-
}
|
|
3412
|
-
}
|
|
3413
|
-
},
|
|
3414
|
-
{
|
|
3415
|
-
groups: getReleaseGroupConfig(releaseConfig, workspaceConfig)
|
|
3416
|
-
},
|
|
3417
|
-
{
|
|
3418
|
-
groups: getReleaseGroupConfig(
|
|
3419
|
-
nxJson$1.release ?? {},
|
|
3420
|
-
workspaceConfig
|
|
3421
|
-
)
|
|
3422
|
-
},
|
|
3423
|
-
omit(releaseConfig, ["groups"]),
|
|
3424
|
-
nxJson$1.release ? omit(nxJson$1.release, ["groups"]) : {},
|
|
3425
|
-
omit(DEFAULT_RELEASE_CONFIG, ["groups"])
|
|
3426
|
-
);
|
|
3427
|
-
super(config5, true);
|
|
3428
|
-
chunkPTYTYIPG_cjs.writeDebug(
|
|
4243
|
+
constructor(projectGraph, config5, normalizedConfig, workspaceConfig) {
|
|
4244
|
+
super(normalizedConfig, true);
|
|
4245
|
+
chunk4ILBJTRR_cjs.writeDebug(
|
|
3429
4246
|
"Executing release with the following configuration",
|
|
3430
4247
|
workspaceConfig
|
|
3431
4248
|
);
|
|
3432
|
-
|
|
4249
|
+
chunk4ILBJTRR_cjs.writeDebug(normalizedConfig, workspaceConfig);
|
|
3433
4250
|
this.projectGraph = projectGraph;
|
|
3434
4251
|
this.config = config5;
|
|
4252
|
+
this.normalizedConfig = normalizedConfig;
|
|
3435
4253
|
this.workspaceConfig = workspaceConfig;
|
|
3436
4254
|
this.tree = new tree.FsTree(workspaceConfig.workspaceRoot, false);
|
|
3437
4255
|
this.projectConfigurations = devkit.readProjectsConfigurationFromProjectGraph(projectGraph);
|
|
@@ -3447,8 +4265,19 @@ var StormReleaseClient = class _StormReleaseClient extends release.ReleaseClient
|
|
|
3447
4265
|
v.newVersion ? extractPreid(v.newVersion) : void 0
|
|
3448
4266
|
])
|
|
3449
4267
|
);
|
|
4268
|
+
const releaseGraph$1 = options.releaseGraph ?? await releaseGraph.createReleaseGraph({
|
|
4269
|
+
tree: this.tree,
|
|
4270
|
+
projectGraph: this.projectGraph,
|
|
4271
|
+
nxReleaseConfig: this.normalizedConfig,
|
|
4272
|
+
filters: {
|
|
4273
|
+
projects: options.projects,
|
|
4274
|
+
groups: options.groups
|
|
4275
|
+
},
|
|
4276
|
+
firstRelease: !!options.firstRelease,
|
|
4277
|
+
verbose: chunk4ILBJTRR_cjs.isVerbose(this.workspaceConfig.logLevel)
|
|
4278
|
+
});
|
|
3450
4279
|
const projectToAdditionalDependencyBumps = /* @__PURE__ */ new Map();
|
|
3451
|
-
for (const releaseGroup of
|
|
4280
|
+
for (const releaseGroup of releaseGraph$1.releaseGroups) {
|
|
3452
4281
|
if (releaseGroup.projectsRelationship !== "independent") {
|
|
3453
4282
|
continue;
|
|
3454
4283
|
}
|
|
@@ -3476,12 +4305,12 @@ var StormReleaseClient = class _StormReleaseClient extends release.ReleaseClient
|
|
|
3476
4305
|
}
|
|
3477
4306
|
}
|
|
3478
4307
|
const allProjectChangelogs = {};
|
|
3479
|
-
for (const releaseGroup of
|
|
4308
|
+
for (const releaseGroup of releaseGraph$1.releaseGroups) {
|
|
3480
4309
|
const config5 = releaseGroup.changelog;
|
|
3481
4310
|
if (config5 === false) {
|
|
3482
4311
|
continue;
|
|
3483
4312
|
}
|
|
3484
|
-
if (!
|
|
4313
|
+
if (!releaseGraph$1.releaseGroupToFilteredProjects.has(releaseGroup)) {
|
|
3485
4314
|
throw new Error(
|
|
3486
4315
|
`No filtered projects found for release group ${releaseGroup.name}`
|
|
3487
4316
|
);
|
|
@@ -3490,9 +4319,7 @@ var StormReleaseClient = class _StormReleaseClient extends release.ReleaseClient
|
|
|
3490
4319
|
// 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
|
|
3491
4320
|
Array.from(
|
|
3492
4321
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
3493
|
-
|
|
3494
|
-
releaseGroup
|
|
3495
|
-
)
|
|
4322
|
+
releaseGraph$1.releaseGroupToFilteredProjects.get(releaseGroup)
|
|
3496
4323
|
).flatMap((project) => {
|
|
3497
4324
|
return [
|
|
3498
4325
|
project,
|
|
@@ -3515,9 +4342,10 @@ var StormReleaseClient = class _StormReleaseClient extends release.ReleaseClient
|
|
|
3515
4342
|
projectName: project.name,
|
|
3516
4343
|
releaseGroupName: releaseGroup.name
|
|
3517
4344
|
},
|
|
4345
|
+
releaseGraph$1.resolveRepositoryTags.bind(releaseGraph$1),
|
|
3518
4346
|
{
|
|
3519
4347
|
checkAllBranchesWhen: releaseGroup.releaseTag.checkAllBranchesWhen,
|
|
3520
|
-
preid: projectsPreid[project.name],
|
|
4348
|
+
preid: projectsPreid[project.name] || this.workspaceConfig.preid,
|
|
3521
4349
|
requireSemver: releaseGroup.releaseTag.requireSemver,
|
|
3522
4350
|
strictPreid: releaseGroup.releaseTag.strictPreid
|
|
3523
4351
|
}
|
|
@@ -3571,9 +4399,9 @@ var StormReleaseClient = class _StormReleaseClient extends release.ReleaseClient
|
|
|
3571
4399
|
fileMap.nonProjectFiles
|
|
3572
4400
|
) ? "*" : getProjectsAffectedByCommit(c, fileToProjectMap)
|
|
3573
4401
|
})),
|
|
3574
|
-
this.
|
|
4402
|
+
this.normalizedConfig.conventionalCommits
|
|
3575
4403
|
);
|
|
3576
|
-
|
|
4404
|
+
chunk4ILBJTRR_cjs.writeDebug(
|
|
3577
4405
|
`Running changelog generation for the ${releaseGroup.name} release group`,
|
|
3578
4406
|
this.workspaceConfig
|
|
3579
4407
|
);
|
|
@@ -3605,12 +4433,15 @@ var StormReleaseClient = class _StormReleaseClient extends release.ReleaseClient
|
|
|
3605
4433
|
let changes = [];
|
|
3606
4434
|
let fromRef = options.from || (await git.getLatestGitTagForPattern(
|
|
3607
4435
|
releaseGroup.releaseTag.pattern,
|
|
3608
|
-
{
|
|
4436
|
+
{
|
|
4437
|
+
releaseGroupName: releaseGroup.name
|
|
4438
|
+
},
|
|
4439
|
+
releaseGraph$1.resolveRepositoryTags.bind(releaseGraph$1),
|
|
3609
4440
|
{
|
|
3610
4441
|
checkAllBranchesWhen: releaseGroup.releaseTag.checkAllBranchesWhen,
|
|
3611
|
-
preid: Object.keys(projectsPreid)[0] ? projectsPreid?.[Object.keys(projectsPreid)[0]] :
|
|
4442
|
+
preid: Object.keys(projectsPreid)[0] && projectsPreid?.[Object.keys(projectsPreid)[0]] ? projectsPreid?.[Object.keys(projectsPreid)[0]] : this.workspaceConfig.preid,
|
|
3612
4443
|
requireSemver: releaseGroup.releaseTag.requireSemver,
|
|
3613
|
-
strictPreid: releaseGroup.releaseTag.strictPreid
|
|
4444
|
+
strictPreid: releaseGroup.releaseTag.strictPreid || this.workspaceConfig.preid !== void 0
|
|
3614
4445
|
}
|
|
3615
4446
|
))?.tag;
|
|
3616
4447
|
if (!fromRef) {
|
|
@@ -3642,9 +4473,9 @@ var StormReleaseClient = class _StormReleaseClient extends release.ReleaseClient
|
|
|
3642
4473
|
fileMap.nonProjectFiles
|
|
3643
4474
|
) ? "*" : getProjectsAffectedByCommit(c, fileToProjectMap)
|
|
3644
4475
|
})),
|
|
3645
|
-
this.
|
|
4476
|
+
this.normalizedConfig.conventionalCommits
|
|
3646
4477
|
);
|
|
3647
|
-
|
|
4478
|
+
chunk4ILBJTRR_cjs.writeDebug(
|
|
3648
4479
|
`Running changelog generation for the ${releaseGroup.name} release group`,
|
|
3649
4480
|
this.workspaceConfig
|
|
3650
4481
|
);
|
|
@@ -3673,7 +4504,7 @@ var StormReleaseClient = class _StormReleaseClient extends release.ReleaseClient
|
|
|
3673
4504
|
}
|
|
3674
4505
|
}
|
|
3675
4506
|
}
|
|
3676
|
-
|
|
4507
|
+
chunk4ILBJTRR_cjs.writeDebug(
|
|
3677
4508
|
`Generated changelogs for ${Object.keys(allProjectChangelogs).length} projects:
|
|
3678
4509
|
${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
|
|
3679
4510
|
`,
|
|
@@ -3698,11 +4529,11 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
|
|
|
3698
4529
|
options.releaseGraph.releaseGroups,
|
|
3699
4530
|
options.releaseGraph.releaseGroupToFilteredProjects,
|
|
3700
4531
|
options.versionData,
|
|
3701
|
-
options.gitCommitMessage || this.
|
|
4532
|
+
options.gitCommitMessage || this.normalizedConfig.changelog?.git?.commitMessage || DEFAULT_COMMIT_MESSAGE
|
|
3702
4533
|
);
|
|
3703
4534
|
const changes = this.tree.listChanges();
|
|
3704
4535
|
if (!changes.length) {
|
|
3705
|
-
|
|
4536
|
+
chunk4ILBJTRR_cjs.writeWarning(
|
|
3706
4537
|
"No changes were detected for any changelog files, so no changelog entries will be generated.",
|
|
3707
4538
|
this.workspaceConfig
|
|
3708
4539
|
);
|
|
@@ -3721,23 +4552,23 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
|
|
|
3721
4552
|
isDryRun: !!options.dryRun,
|
|
3722
4553
|
isVerbose: !!options.verbose,
|
|
3723
4554
|
gitCommitMessages: commitMessageValues,
|
|
3724
|
-
gitCommitArgs: options.gitCommitArgs || this.
|
|
4555
|
+
gitCommitArgs: options.gitCommitArgs || this.normalizedConfig.changelog?.git?.commitArgs
|
|
3725
4556
|
});
|
|
3726
4557
|
latestCommit = await git.getCommitHash("HEAD");
|
|
3727
|
-
|
|
4558
|
+
chunk4ILBJTRR_cjs.writeDebug(
|
|
3728
4559
|
`Creating git tags: ${gitTagValues.join(", ")}`,
|
|
3729
4560
|
this.workspaceConfig
|
|
3730
4561
|
);
|
|
3731
4562
|
for (const tag of gitTagValues) {
|
|
3732
4563
|
await gitTag({
|
|
3733
4564
|
tag,
|
|
3734
|
-
message: options.gitTagMessage || this.
|
|
3735
|
-
additionalArgs: options.gitTagArgs || this.
|
|
4565
|
+
message: options.gitTagMessage || this.normalizedConfig.changelog?.git?.tagMessage,
|
|
4566
|
+
additionalArgs: options.gitTagArgs || this.normalizedConfig.changelog?.git?.tagArgs,
|
|
3736
4567
|
dryRun: options.dryRun,
|
|
3737
4568
|
verbose: options.verbose
|
|
3738
4569
|
});
|
|
3739
4570
|
}
|
|
3740
|
-
|
|
4571
|
+
chunk4ILBJTRR_cjs.writeDebug(
|
|
3741
4572
|
`Pushing to git remote "${options.gitRemote ?? "origin"}"`,
|
|
3742
4573
|
this.workspaceConfig
|
|
3743
4574
|
);
|
|
@@ -3745,13 +4576,323 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
|
|
|
3745
4576
|
gitRemote: options.gitRemote,
|
|
3746
4577
|
dryRun: options.dryRun,
|
|
3747
4578
|
verbose: options.verbose,
|
|
3748
|
-
additionalArgs: options.gitPushArgs || this.
|
|
4579
|
+
additionalArgs: options.gitPushArgs || this.normalizedConfig.changelog?.git?.pushArgs
|
|
3749
4580
|
});
|
|
3750
4581
|
for (const postGitTask of postGitTasks) {
|
|
3751
4582
|
await postGitTask(latestCommit);
|
|
3752
4583
|
}
|
|
3753
4584
|
return;
|
|
3754
4585
|
};
|
|
4586
|
+
releaseVersion = async (options) => {
|
|
4587
|
+
const verbose = options.verbose || chunk4ILBJTRR_cjs.isVerbose(this.workspaceConfig.logLevel);
|
|
4588
|
+
this.projectGraph = await devkit.createProjectGraphAsync({
|
|
4589
|
+
exitOnError: true,
|
|
4590
|
+
resetDaemonClient: true
|
|
4591
|
+
});
|
|
4592
|
+
if (!this.projectGraph) {
|
|
4593
|
+
throw new Error(
|
|
4594
|
+
"Failed to load the project graph. Please run `nx reset`, then run the `storm-git commit` command again."
|
|
4595
|
+
);
|
|
4596
|
+
}
|
|
4597
|
+
const releaseGraph$1 = options.releaseGraph ?? await releaseGraph.createReleaseGraph({
|
|
4598
|
+
tree: this.tree,
|
|
4599
|
+
projectGraph: this.projectGraph,
|
|
4600
|
+
nxReleaseConfig: this.normalizedConfig,
|
|
4601
|
+
filters: {
|
|
4602
|
+
projects: options.projects,
|
|
4603
|
+
groups: options.groups
|
|
4604
|
+
},
|
|
4605
|
+
firstRelease: !!options.firstRelease,
|
|
4606
|
+
verbose,
|
|
4607
|
+
preid: options.preid ?? this.workspaceConfig.preid,
|
|
4608
|
+
versionActionsOptionsOverrides: options.versionActionsOptionsOverrides
|
|
4609
|
+
});
|
|
4610
|
+
if (releaseGraph$1.filterLog && process.env.NX_RELEASE_INTERNAL_SUPPRESS_FILTER_LOG !== "true") {
|
|
4611
|
+
chunk4ILBJTRR_cjs.writeDebug(formatNxLog(releaseGraph$1.filterLog), this.workspaceConfig);
|
|
4612
|
+
}
|
|
4613
|
+
if (!options.specifier) {
|
|
4614
|
+
const rawVersionPlans = await versionPlans.readRawVersionPlans();
|
|
4615
|
+
await versionPlans.setResolvedVersionPlansOnGroups(
|
|
4616
|
+
rawVersionPlans,
|
|
4617
|
+
releaseGraph$1.releaseGroups,
|
|
4618
|
+
Object.keys(this.projectGraph.nodes),
|
|
4619
|
+
verbose
|
|
4620
|
+
);
|
|
4621
|
+
const versionPlanValidationError = versionPlanUtils.validateResolvedVersionPlansAgainstFilter(
|
|
4622
|
+
releaseGraph$1.releaseGroups,
|
|
4623
|
+
releaseGraph$1.releaseGroupToFilteredProjects
|
|
4624
|
+
);
|
|
4625
|
+
if (versionPlanValidationError) {
|
|
4626
|
+
throw new Error(formatNxLog(versionPlanValidationError));
|
|
4627
|
+
}
|
|
4628
|
+
} else {
|
|
4629
|
+
if (verbose && releaseGraph$1.releaseGroups.some((g) => !!g.versionPlans)) {
|
|
4630
|
+
chunk4ILBJTRR_cjs.writeDebug(
|
|
4631
|
+
`Skipping version plan discovery as a specifier was provided`,
|
|
4632
|
+
this.workspaceConfig
|
|
4633
|
+
);
|
|
4634
|
+
}
|
|
4635
|
+
}
|
|
4636
|
+
if (options.deleteVersionPlans === void 0) {
|
|
4637
|
+
options.deleteVersionPlans = false;
|
|
4638
|
+
}
|
|
4639
|
+
if (this.normalizedConfig.version?.preVersionCommand) {
|
|
4640
|
+
chunk4ILBJTRR_cjs.writeDebug(
|
|
4641
|
+
"Executing the following pre-version command: \n" + this.normalizedConfig.version.preVersionCommand,
|
|
4642
|
+
this.workspaceConfig
|
|
4643
|
+
);
|
|
4644
|
+
try {
|
|
4645
|
+
const childProcess2 = chunkMTAYUS7E_cjs.runAsync(
|
|
4646
|
+
this.workspaceConfig,
|
|
4647
|
+
this.normalizedConfig.version.preVersionCommand,
|
|
4648
|
+
this.workspaceConfig.workspaceRoot,
|
|
4649
|
+
{
|
|
4650
|
+
...process.env,
|
|
4651
|
+
NX_DRY_RUN: options.dryRun ? "true" : "false"
|
|
4652
|
+
}
|
|
4653
|
+
);
|
|
4654
|
+
if (options.verbose) {
|
|
4655
|
+
childProcess2.stdout?.pipe(process.stdout);
|
|
4656
|
+
childProcess2.stderr?.pipe(process.stderr);
|
|
4657
|
+
}
|
|
4658
|
+
await childProcess2;
|
|
4659
|
+
} catch (e) {
|
|
4660
|
+
throw new Error(
|
|
4661
|
+
formatNxLog({
|
|
4662
|
+
title: `The pre-version command failed. See the full output above.`,
|
|
4663
|
+
bodyLines: [this.normalizedConfig.version.preVersionCommand, e]
|
|
4664
|
+
})
|
|
4665
|
+
);
|
|
4666
|
+
}
|
|
4667
|
+
}
|
|
4668
|
+
for (const groupName of releaseGraph$1.sortedReleaseGroups) {
|
|
4669
|
+
const releaseGroup = releaseGraph$1.releaseGroups.find(
|
|
4670
|
+
(g) => g.name === groupName
|
|
4671
|
+
);
|
|
4672
|
+
if (!releaseGroup) {
|
|
4673
|
+
continue;
|
|
4674
|
+
}
|
|
4675
|
+
if (releaseGroup.version?.groupPreVersionCommand) {
|
|
4676
|
+
chunk4ILBJTRR_cjs.writeDebug(
|
|
4677
|
+
`Executing the ${releaseGroup.name} release group's pre-version command:
|
|
4678
|
+
` + releaseGroup.version?.groupPreVersionCommand,
|
|
4679
|
+
this.workspaceConfig
|
|
4680
|
+
);
|
|
4681
|
+
try {
|
|
4682
|
+
const childProcess2 = chunkMTAYUS7E_cjs.runAsync(
|
|
4683
|
+
this.workspaceConfig,
|
|
4684
|
+
releaseGroup.version?.groupPreVersionCommand,
|
|
4685
|
+
this.workspaceConfig.workspaceRoot,
|
|
4686
|
+
{
|
|
4687
|
+
...process.env,
|
|
4688
|
+
NX_DRY_RUN: options.dryRun ? "true" : "false"
|
|
4689
|
+
}
|
|
4690
|
+
);
|
|
4691
|
+
if (options.verbose) {
|
|
4692
|
+
childProcess2.stdout?.pipe(process.stdout);
|
|
4693
|
+
childProcess2.stderr?.pipe(process.stderr);
|
|
4694
|
+
}
|
|
4695
|
+
await childProcess2;
|
|
4696
|
+
} catch (e) {
|
|
4697
|
+
throw new Error(
|
|
4698
|
+
formatNxLog({
|
|
4699
|
+
title: `The ${releaseGroup.name} release group's pre-version command failed. See the full output above.`,
|
|
4700
|
+
bodyLines: [releaseGroup.version?.groupPreVersionCommand, e]
|
|
4701
|
+
})
|
|
4702
|
+
);
|
|
4703
|
+
}
|
|
4704
|
+
}
|
|
4705
|
+
}
|
|
4706
|
+
await releaseGraph$1.validate(this.tree);
|
|
4707
|
+
const commitMessage = options.gitCommitMessage || this.normalizedConfig.version?.git?.commitMessage;
|
|
4708
|
+
const additionalChangedFiles = /* @__PURE__ */ new Set();
|
|
4709
|
+
const additionalDeletedFiles = /* @__PURE__ */ new Set();
|
|
4710
|
+
const processor = new StormReleaseGroupProcessor(
|
|
4711
|
+
this.tree,
|
|
4712
|
+
this.workspaceConfig,
|
|
4713
|
+
this.projectGraph,
|
|
4714
|
+
this.normalizedConfig,
|
|
4715
|
+
releaseGraph$1,
|
|
4716
|
+
options
|
|
4717
|
+
);
|
|
4718
|
+
try {
|
|
4719
|
+
await processor.processGroups();
|
|
4720
|
+
if (options.deleteVersionPlans) {
|
|
4721
|
+
processor.deleteProcessedVersionPlanFiles();
|
|
4722
|
+
}
|
|
4723
|
+
} catch (err) {
|
|
4724
|
+
processor.flushAllProjectLoggers();
|
|
4725
|
+
throw err;
|
|
4726
|
+
}
|
|
4727
|
+
await formatChangedFiles(this.tree);
|
|
4728
|
+
printChanges_js.printAndFlushChanges(this.tree, !!options.dryRun);
|
|
4729
|
+
const { changedFiles: changed, deletedFiles: deleted } = await processor.afterAllProjectsVersioned({
|
|
4730
|
+
...this.normalizedConfig.version.versionActionsOptions,
|
|
4731
|
+
...options.versionActionsOptionsOverrides ?? {}
|
|
4732
|
+
});
|
|
4733
|
+
changed.forEach((f) => additionalChangedFiles.add(f));
|
|
4734
|
+
deleted.forEach((f) => additionalDeletedFiles.add(f));
|
|
4735
|
+
if (this.normalizedConfig.docker && typeof this.normalizedConfig.docker === "object" && this.normalizedConfig.docker?.preVersionCommand) {
|
|
4736
|
+
chunk4ILBJTRR_cjs.writeDebug(
|
|
4737
|
+
`Executing the docker pre-version command:
|
|
4738
|
+
` + this.normalizedConfig.docker.preVersionCommand,
|
|
4739
|
+
this.workspaceConfig
|
|
4740
|
+
);
|
|
4741
|
+
try {
|
|
4742
|
+
const childProcess2 = chunkMTAYUS7E_cjs.runAsync(
|
|
4743
|
+
this.workspaceConfig,
|
|
4744
|
+
this.normalizedConfig.docker.preVersionCommand,
|
|
4745
|
+
this.workspaceConfig.workspaceRoot,
|
|
4746
|
+
{
|
|
4747
|
+
...process.env,
|
|
4748
|
+
NX_DRY_RUN: options.dryRun ? "true" : "false"
|
|
4749
|
+
}
|
|
4750
|
+
);
|
|
4751
|
+
if (options.verbose) {
|
|
4752
|
+
childProcess2.stdout?.pipe(process.stdout);
|
|
4753
|
+
childProcess2.stderr?.pipe(process.stderr);
|
|
4754
|
+
}
|
|
4755
|
+
await childProcess2;
|
|
4756
|
+
} catch (e) {
|
|
4757
|
+
throw new Error(
|
|
4758
|
+
formatNxLog({
|
|
4759
|
+
title: `The docker pre-version command failed. See the full output above.`,
|
|
4760
|
+
bodyLines: [this.normalizedConfig.docker.preVersionCommand, e]
|
|
4761
|
+
})
|
|
4762
|
+
);
|
|
4763
|
+
}
|
|
4764
|
+
}
|
|
4765
|
+
for (const groupName of releaseGraph$1.sortedReleaseGroups) {
|
|
4766
|
+
const releaseGroup = releaseGraph$1.releaseGroups.find(
|
|
4767
|
+
(g) => g.name === groupName
|
|
4768
|
+
);
|
|
4769
|
+
if (!releaseGroup) {
|
|
4770
|
+
continue;
|
|
4771
|
+
}
|
|
4772
|
+
if (releaseGroup.docker?.groupPreVersionCommand) {
|
|
4773
|
+
chunk4ILBJTRR_cjs.writeDebug(
|
|
4774
|
+
`Executing the ${releaseGroup.name} release group's docker pre-version command:
|
|
4775
|
+
` + releaseGroup.docker?.groupPreVersionCommand,
|
|
4776
|
+
this.workspaceConfig
|
|
4777
|
+
);
|
|
4778
|
+
try {
|
|
4779
|
+
const childProcess2 = chunkMTAYUS7E_cjs.runAsync(
|
|
4780
|
+
this.workspaceConfig,
|
|
4781
|
+
releaseGroup.docker?.groupPreVersionCommand,
|
|
4782
|
+
this.workspaceConfig.workspaceRoot,
|
|
4783
|
+
{
|
|
4784
|
+
...process.env,
|
|
4785
|
+
NX_DRY_RUN: options.dryRun ? "true" : "false"
|
|
4786
|
+
}
|
|
4787
|
+
);
|
|
4788
|
+
if (options.verbose) {
|
|
4789
|
+
childProcess2.stdout?.pipe(process.stdout);
|
|
4790
|
+
childProcess2.stderr?.pipe(process.stderr);
|
|
4791
|
+
}
|
|
4792
|
+
await childProcess2;
|
|
4793
|
+
} catch (e) {
|
|
4794
|
+
throw new Error(
|
|
4795
|
+
formatNxLog({
|
|
4796
|
+
title: `The ${releaseGroup.name} release group's docker pre-version command failed. See the full output above.`,
|
|
4797
|
+
bodyLines: [releaseGroup.docker?.groupPreVersionCommand, e]
|
|
4798
|
+
})
|
|
4799
|
+
);
|
|
4800
|
+
}
|
|
4801
|
+
}
|
|
4802
|
+
}
|
|
4803
|
+
if (this.normalizedConfig.docker || releaseGraph$1.releaseGroups.some((rg) => rg.docker)) {
|
|
4804
|
+
chunk4ILBJTRR_cjs.writeWarning(
|
|
4805
|
+
formatNxLog({
|
|
4806
|
+
title: "Warning",
|
|
4807
|
+
bodyLines: [
|
|
4808
|
+
`Docker support is experimental. Breaking changes may occur and not adhere to semver versioning.`
|
|
4809
|
+
]
|
|
4810
|
+
})
|
|
4811
|
+
);
|
|
4812
|
+
}
|
|
4813
|
+
await processor.processDockerProjects(
|
|
4814
|
+
options.dockerVersionScheme,
|
|
4815
|
+
options.dockerVersion
|
|
4816
|
+
);
|
|
4817
|
+
const versionData = processor.getVersionData();
|
|
4818
|
+
const gitTagValues = options.gitTag ?? this.normalizedConfig.version?.git?.tag ? shared.createGitTagValues(
|
|
4819
|
+
releaseGraph$1.releaseGroups,
|
|
4820
|
+
releaseGraph$1.releaseGroupToFilteredProjects,
|
|
4821
|
+
versionData
|
|
4822
|
+
) : [];
|
|
4823
|
+
shared.handleDuplicateGitTags(gitTagValues);
|
|
4824
|
+
let workspaceVersion = void 0;
|
|
4825
|
+
if (releaseGraph$1.releaseGroups.length === 1) {
|
|
4826
|
+
const releaseGroup = releaseGraph$1.releaseGroups[0];
|
|
4827
|
+
if (releaseGroup?.projectsRelationship === "fixed") {
|
|
4828
|
+
const releaseGroupProjectNames = Array.from(
|
|
4829
|
+
releaseGraph$1.releaseGroupToFilteredProjects.get(releaseGroup)
|
|
4830
|
+
);
|
|
4831
|
+
workspaceVersion = versionData[releaseGroupProjectNames[0]].newVersion;
|
|
4832
|
+
}
|
|
4833
|
+
}
|
|
4834
|
+
const changedFiles = [
|
|
4835
|
+
...this.tree.listChanges().map((f) => f.path),
|
|
4836
|
+
...additionalChangedFiles
|
|
4837
|
+
];
|
|
4838
|
+
const deletedFiles = Array.from(additionalDeletedFiles);
|
|
4839
|
+
if (!changedFiles.length && !deletedFiles.length) {
|
|
4840
|
+
return {
|
|
4841
|
+
workspaceVersion,
|
|
4842
|
+
projectsVersionData: versionData,
|
|
4843
|
+
releaseGraph: releaseGraph$1
|
|
4844
|
+
};
|
|
4845
|
+
}
|
|
4846
|
+
if (options.gitCommit ?? this.normalizedConfig.version?.git?.commit) {
|
|
4847
|
+
await commitChanges({
|
|
4848
|
+
changedFiles,
|
|
4849
|
+
deletedFiles,
|
|
4850
|
+
isDryRun: !!options.dryRun,
|
|
4851
|
+
isVerbose: !!options.verbose,
|
|
4852
|
+
gitCommitMessages: shared.createCommitMessageValues(
|
|
4853
|
+
releaseGraph$1.releaseGroups,
|
|
4854
|
+
releaseGraph$1.releaseGroupToFilteredProjects,
|
|
4855
|
+
versionData,
|
|
4856
|
+
commitMessage
|
|
4857
|
+
),
|
|
4858
|
+
gitCommitArgs: options.gitCommitArgs || this.normalizedConfig.version?.git?.commitArgs
|
|
4859
|
+
});
|
|
4860
|
+
} else if (options.stageChanges ?? this.normalizedConfig.version?.git?.stageChanges) {
|
|
4861
|
+
chunk4ILBJTRR_cjs.writeDebug(`Staging changed files with git`);
|
|
4862
|
+
await git.gitAdd({
|
|
4863
|
+
changedFiles,
|
|
4864
|
+
deletedFiles,
|
|
4865
|
+
dryRun: options.dryRun,
|
|
4866
|
+
verbose
|
|
4867
|
+
});
|
|
4868
|
+
}
|
|
4869
|
+
if (options.gitTag ?? this.normalizedConfig.version?.git?.tag) {
|
|
4870
|
+
chunk4ILBJTRR_cjs.writeDebug(`Tagging commit with git`);
|
|
4871
|
+
for (const tag of gitTagValues) {
|
|
4872
|
+
await gitTag({
|
|
4873
|
+
tag,
|
|
4874
|
+
message: options.gitTagMessage || this.normalizedConfig.version?.git?.tagMessage,
|
|
4875
|
+
additionalArgs: options.gitTagArgs || this.normalizedConfig.version?.git?.tagArgs,
|
|
4876
|
+
dryRun: options.dryRun,
|
|
4877
|
+
verbose: options.verbose
|
|
4878
|
+
});
|
|
4879
|
+
}
|
|
4880
|
+
}
|
|
4881
|
+
if (options.gitPush ?? this.normalizedConfig.version?.git?.push) {
|
|
4882
|
+
chunk4ILBJTRR_cjs.writeDebug(`Pushing to git remote "${options.gitRemote ?? "origin"}"`);
|
|
4883
|
+
await git.gitPush({
|
|
4884
|
+
gitRemote: options.gitRemote,
|
|
4885
|
+
dryRun: options.dryRun,
|
|
4886
|
+
verbose: options.verbose,
|
|
4887
|
+
additionalArgs: options.gitPushArgs || this.normalizedConfig.version?.git?.pushArgs
|
|
4888
|
+
});
|
|
4889
|
+
}
|
|
4890
|
+
return {
|
|
4891
|
+
workspaceVersion,
|
|
4892
|
+
projectsVersionData: versionData,
|
|
4893
|
+
releaseGraph: releaseGraph$1
|
|
4894
|
+
};
|
|
4895
|
+
};
|
|
3755
4896
|
};
|
|
3756
4897
|
|
|
3757
4898
|
// src/release/run.ts
|
|
@@ -3769,7 +4910,7 @@ var runRelease = async (config5, {
|
|
|
3769
4910
|
throw new Error("The `GITHUB_ACTOR` environment variable is not set.");
|
|
3770
4911
|
}
|
|
3771
4912
|
if (!await isUserAnOrganizationMember(process.env.GITHUB_ACTOR, config5)) {
|
|
3772
|
-
|
|
4913
|
+
chunk4ILBJTRR_cjs.writeFatal(
|
|
3773
4914
|
"You must be a member of the Storm Software organization to run the release process.",
|
|
3774
4915
|
config5
|
|
3775
4916
|
);
|
|
@@ -3786,26 +4927,26 @@ var runRelease = async (config5, {
|
|
|
3786
4927
|
process.env.NODE_AUTH_TOKEN = process.env.NPM_TOKEN;
|
|
3787
4928
|
process.env.NPM_AUTH_TOKEN = process.env.NPM_TOKEN;
|
|
3788
4929
|
process.env.NPM_CONFIG_PROVENANCE = "true";
|
|
3789
|
-
|
|
4930
|
+
chunk4ILBJTRR_cjs.writeDebug("Creating Storm release client...", config5);
|
|
3790
4931
|
const releaseClient = await StormReleaseClient.create(
|
|
3791
4932
|
releaseConfig,
|
|
3792
4933
|
ignoreNxJsonConfig,
|
|
3793
4934
|
config5
|
|
3794
4935
|
);
|
|
3795
|
-
|
|
4936
|
+
chunk4ILBJTRR_cjs.writeDebug("Reading in the workspaces release configuration", config5);
|
|
3796
4937
|
const to = head || process.env.NX_HEAD;
|
|
3797
4938
|
const from = base || process.env.NX_BASE;
|
|
3798
|
-
|
|
4939
|
+
chunk4ILBJTRR_cjs.writeDebug(
|
|
3799
4940
|
`Using the following Git SHAs to determine the release content:
|
|
3800
4941
|
- From: ${from}
|
|
3801
4942
|
- To: ${to}
|
|
3802
4943
|
`,
|
|
3803
4944
|
config5
|
|
3804
4945
|
);
|
|
3805
|
-
|
|
4946
|
+
chunk4ILBJTRR_cjs.writeDebug("Determining the current release versions...", config5);
|
|
3806
4947
|
const { workspaceVersion, projectsVersionData, releaseGraph } = await releaseClient.releaseVersion({
|
|
3807
4948
|
dryRun,
|
|
3808
|
-
verbose:
|
|
4949
|
+
verbose: chunk4ILBJTRR_cjs.isVerbose(config5.logLevel),
|
|
3809
4950
|
preid: config5.preid,
|
|
3810
4951
|
stageChanges: true,
|
|
3811
4952
|
gitCommit: false
|
|
@@ -3814,14 +4955,14 @@ var runRelease = async (config5, {
|
|
|
3814
4955
|
version: releaseConfig?.projectsRelationship === "fixed" ? workspaceVersion : void 0,
|
|
3815
4956
|
versionData: projectsVersionData,
|
|
3816
4957
|
dryRun,
|
|
3817
|
-
verbose:
|
|
4958
|
+
verbose: chunk4ILBJTRR_cjs.isVerbose(config5.logLevel),
|
|
3818
4959
|
to,
|
|
3819
4960
|
from,
|
|
3820
4961
|
releaseGraph
|
|
3821
4962
|
});
|
|
3822
|
-
|
|
4963
|
+
chunk4ILBJTRR_cjs.writeDebug("Tagging commit with git", config5);
|
|
3823
4964
|
if (skipPublish) {
|
|
3824
|
-
|
|
4965
|
+
chunk4ILBJTRR_cjs.writeWarning(
|
|
3825
4966
|
"Skipping publishing packages since `skipPublish` was provided as `true` in the release options.",
|
|
3826
4967
|
config5
|
|
3827
4968
|
);
|
|
@@ -3830,7 +4971,7 @@ var runRelease = async (config5, {
|
|
|
3830
4971
|
(key) => projectsVersionData[key]?.newVersion
|
|
3831
4972
|
);
|
|
3832
4973
|
if (changedProjects.length > 0) {
|
|
3833
|
-
|
|
4974
|
+
chunk4ILBJTRR_cjs.writeInfo(
|
|
3834
4975
|
`Publishing release for ${changedProjects.length} ${changedProjects.length === 1 ? "project" : "projects"}:
|
|
3835
4976
|
${changedProjects.map((changedProject) => ` - ${changedProject}`).join("\n")}
|
|
3836
4977
|
`,
|
|
@@ -3839,7 +4980,7 @@ ${changedProjects.map((changedProject) => ` - ${changedProject}`).join("\n")}
|
|
|
3839
4980
|
await updatePackageManifests(projectsVersionData, config5);
|
|
3840
4981
|
const result = await releaseClient.releasePublish({
|
|
3841
4982
|
dryRun,
|
|
3842
|
-
verbose:
|
|
4983
|
+
verbose: chunk4ILBJTRR_cjs.isVerbose(config5.logLevel)
|
|
3843
4984
|
});
|
|
3844
4985
|
const failedProjects = Object.keys(result).filter(
|
|
3845
4986
|
(key) => result[key]?.code && result[key]?.code > 0
|
|
@@ -3854,10 +4995,10 @@ ${failedProjects.map((failedProject) => ` - ${failedProject} (Error Code: ${res
|
|
|
3854
4995
|
);
|
|
3855
4996
|
}
|
|
3856
4997
|
} else {
|
|
3857
|
-
|
|
4998
|
+
chunk4ILBJTRR_cjs.writeWarning("Skipped publishing packages.", config5);
|
|
3858
4999
|
}
|
|
3859
5000
|
}
|
|
3860
|
-
|
|
5001
|
+
chunk4ILBJTRR_cjs.writeSuccess("Completed the Storm workspace release process!", config5);
|
|
3861
5002
|
};
|
|
3862
5003
|
async function updatePackageManifests(projectsVersionData, config5) {
|
|
3863
5004
|
let projectGraph;
|
|
@@ -3872,7 +5013,7 @@ async function updatePackageManifests(projectsVersionData, config5) {
|
|
|
3872
5013
|
Object.keys(projectsVersionData).map(async (node) => {
|
|
3873
5014
|
const projectNode = projectGraph.nodes[node];
|
|
3874
5015
|
if (!projectNode?.data.root) {
|
|
3875
|
-
|
|
5016
|
+
chunk4ILBJTRR_cjs.writeWarning(
|
|
3876
5017
|
`Project node ${node} not found in the project graph. Skipping manifest update.`,
|
|
3877
5018
|
config5
|
|
3878
5019
|
);
|
|
@@ -3880,17 +5021,17 @@ async function updatePackageManifests(projectsVersionData, config5) {
|
|
|
3880
5021
|
}
|
|
3881
5022
|
const versionData = projectsVersionData[node];
|
|
3882
5023
|
if (projectNode?.data.root && versionData && versionData.newVersion !== null) {
|
|
3883
|
-
|
|
5024
|
+
chunk4ILBJTRR_cjs.writeTrace(
|
|
3884
5025
|
`Writing version ${versionData.newVersion} update to manifest file for ${node}
|
|
3885
5026
|
`,
|
|
3886
5027
|
config5
|
|
3887
5028
|
);
|
|
3888
|
-
const projectRoot =
|
|
5029
|
+
const projectRoot = chunk4ILBJTRR_cjs.joinPaths(
|
|
3889
5030
|
config5.workspaceRoot,
|
|
3890
5031
|
projectNode.data.root
|
|
3891
5032
|
);
|
|
3892
|
-
const packageJsonPath =
|
|
3893
|
-
const cargoTomlPath =
|
|
5033
|
+
const packageJsonPath = chunk4ILBJTRR_cjs.joinPaths(projectRoot, "package.json");
|
|
5034
|
+
const cargoTomlPath = chunk4ILBJTRR_cjs.joinPaths(projectRoot, "Cargo.toml");
|
|
3894
5035
|
if (fs$1.existsSync(packageJsonPath)) {
|
|
3895
5036
|
const packageJsonContent = await fs.readFile(packageJsonPath, "utf8");
|
|
3896
5037
|
const packageJson = JSON.parse(packageJsonContent);
|
|
@@ -3908,7 +5049,7 @@ async function updatePackageManifests(projectsVersionData, config5) {
|
|
|
3908
5049
|
})
|
|
3909
5050
|
);
|
|
3910
5051
|
} else {
|
|
3911
|
-
|
|
5052
|
+
chunk4ILBJTRR_cjs.writeWarning("No project nodes found. Skipping manifest updates.", config5);
|
|
3912
5053
|
}
|
|
3913
5054
|
}
|
|
3914
5055
|
|
|
@@ -3916,8 +5057,8 @@ async function updatePackageManifests(projectsVersionData, config5) {
|
|
|
3916
5057
|
var _config = {};
|
|
3917
5058
|
function createProgram(config5) {
|
|
3918
5059
|
_config = config5;
|
|
3919
|
-
|
|
3920
|
-
const root =
|
|
5060
|
+
chunk4ILBJTRR_cjs.writeInfo(`${chunk4ILBJTRR_cjs.brandIcon(_config)} Running Storm Git Tools`, config5);
|
|
5061
|
+
const root = chunk4ILBJTRR_cjs.findWorkspaceRootSafe(process.cwd());
|
|
3921
5062
|
process.env.STORM_WORKSPACE_ROOT ??= root;
|
|
3922
5063
|
process.env.NX_WORKSPACE_ROOT_PATH ??= root;
|
|
3923
5064
|
if (root) {
|
|
@@ -3964,12 +5105,12 @@ async function commitAction({
|
|
|
3964
5105
|
dryRun = false
|
|
3965
5106
|
}) {
|
|
3966
5107
|
try {
|
|
3967
|
-
|
|
3968
|
-
`${
|
|
5108
|
+
chunk4ILBJTRR_cjs.writeInfo(
|
|
5109
|
+
`${chunk4ILBJTRR_cjs.brandIcon(typeof config5 === "string" ? {} : config5)} Preparing to commit your changes. Please provide the requested details below...`,
|
|
3969
5110
|
_config
|
|
3970
5111
|
);
|
|
3971
5112
|
await runCommit(config5, dryRun);
|
|
3972
|
-
|
|
5113
|
+
chunk4ILBJTRR_cjs.writeSuccess(
|
|
3973
5114
|
`\u2714 Storm Commit processing completed successfully!
|
|
3974
5115
|
|
|
3975
5116
|
Note: Please run "pnpm push" to upload these changes to the remote ${_config.name ? _config.name : _config.namespace ? _config.namespace : _config.organization ? _config.organization : "Storm-Software"} Git repository at ${_config.repository}
|
|
@@ -3977,7 +5118,7 @@ Note: Please run "pnpm push" to upload these changes to the remote ${_config.nam
|
|
|
3977
5118
|
_config
|
|
3978
5119
|
);
|
|
3979
5120
|
} catch (error) {
|
|
3980
|
-
|
|
5121
|
+
chunk4ILBJTRR_cjs.writeFatal(
|
|
3981
5122
|
`A fatal error occurred while running commit action:
|
|
3982
5123
|
|
|
3983
5124
|
${error.message}${error.stack ? `
|
|
@@ -3992,17 +5133,17 @@ Please fix any errors and try committing again.`,
|
|
|
3992
5133
|
}
|
|
3993
5134
|
async function readmeAction(options) {
|
|
3994
5135
|
try {
|
|
3995
|
-
|
|
3996
|
-
`${
|
|
5136
|
+
chunk4ILBJTRR_cjs.writeInfo(
|
|
5137
|
+
`${chunk4ILBJTRR_cjs.brandIcon(_config)} Formatting the workspace's README.md files`,
|
|
3997
5138
|
_config
|
|
3998
5139
|
);
|
|
3999
5140
|
await runReadme(options);
|
|
4000
|
-
|
|
5141
|
+
chunk4ILBJTRR_cjs.writeSuccess(
|
|
4001
5142
|
"\u2714 Formatting of the workspace's README.md files is complete\n",
|
|
4002
5143
|
_config
|
|
4003
5144
|
);
|
|
4004
5145
|
} catch (error) {
|
|
4005
|
-
|
|
5146
|
+
chunk4ILBJTRR_cjs.writeFatal(
|
|
4006
5147
|
`A fatal error occurred while running README format action:
|
|
4007
5148
|
|
|
4008
5149
|
${error.message}`
|
|
@@ -4017,8 +5158,8 @@ async function releaseAction({
|
|
|
4017
5158
|
dryRun
|
|
4018
5159
|
}) {
|
|
4019
5160
|
try {
|
|
4020
|
-
|
|
4021
|
-
`${
|
|
5161
|
+
chunk4ILBJTRR_cjs.writeInfo(
|
|
5162
|
+
`${chunk4ILBJTRR_cjs.brandIcon(_config)} Running the Storm Release and Publish process on the workspace`,
|
|
4022
5163
|
_config
|
|
4023
5164
|
);
|
|
4024
5165
|
await runRelease(_config, {
|
|
@@ -4027,9 +5168,9 @@ async function releaseAction({
|
|
|
4027
5168
|
base,
|
|
4028
5169
|
head
|
|
4029
5170
|
});
|
|
4030
|
-
|
|
5171
|
+
chunk4ILBJTRR_cjs.writeSuccess("\u2714 Release completed successfully!\n", _config);
|
|
4031
5172
|
} catch (error) {
|
|
4032
|
-
|
|
5173
|
+
chunk4ILBJTRR_cjs.writeFatal(
|
|
4033
5174
|
`A fatal error occurred while running release action:
|
|
4034
5175
|
|
|
4035
5176
|
${error.message} ${error.stack ? `
|
|
@@ -4043,17 +5184,17 @@ Stacktrace: ${error.stack}` : ""}`,
|
|
|
4043
5184
|
}
|
|
4044
5185
|
async function commitLintAction(options) {
|
|
4045
5186
|
try {
|
|
4046
|
-
|
|
4047
|
-
`${
|
|
5187
|
+
chunk4ILBJTRR_cjs.writeInfo(
|
|
5188
|
+
`${chunk4ILBJTRR_cjs.brandIcon(_config)} Linting the ${_config.repository ? _config.repository : _config.namespace ? _config.namespace : _config.name ? _config.name : typeof _config.organization === "string" ? _config.organization : _config.organization?.name ? _config.organization?.name : "Storm-Software"} repository's commit messages.`,
|
|
4048
5189
|
_config
|
|
4049
5190
|
);
|
|
4050
5191
|
await runCommitLint(_config, options);
|
|
4051
|
-
|
|
5192
|
+
chunk4ILBJTRR_cjs.writeSuccess(
|
|
4052
5193
|
"\u2714 Linting the commit messages completed successfully!\n",
|
|
4053
5194
|
_config
|
|
4054
5195
|
);
|
|
4055
5196
|
} catch (error) {
|
|
4056
|
-
|
|
5197
|
+
chunk4ILBJTRR_cjs.writeFatal(
|
|
4057
5198
|
`A fatal error occurred while linting the commit messages:
|
|
4058
5199
|
|
|
4059
5200
|
${error.message}`,
|
|
@@ -4064,14 +5205,14 @@ ${error.message}`,
|
|
|
4064
5205
|
}
|
|
4065
5206
|
async function postCheckoutAction({ files }) {
|
|
4066
5207
|
try {
|
|
4067
|
-
|
|
4068
|
-
`${
|
|
5208
|
+
chunk4ILBJTRR_cjs.writeInfo(
|
|
5209
|
+
`${chunk4ILBJTRR_cjs.brandIcon(_config)} Running the Storm post-checkout git hook for ${files.length} files in the workspace...`,
|
|
4069
5210
|
_config
|
|
4070
5211
|
);
|
|
4071
|
-
await
|
|
4072
|
-
|
|
5212
|
+
await chunkDPKFBB3S_cjs.postCheckoutHook(_config, files);
|
|
5213
|
+
chunk4ILBJTRR_cjs.writeSuccess("\u2714 Post-checkout hook completed successfully!\n", _config);
|
|
4073
5214
|
} catch (error) {
|
|
4074
|
-
|
|
5215
|
+
chunk4ILBJTRR_cjs.writeFatal(
|
|
4075
5216
|
`A fatal error occurred while running the post-checkout hook:
|
|
4076
5217
|
|
|
4077
5218
|
${error.message}`,
|
|
@@ -4082,14 +5223,14 @@ ${error.message}`,
|
|
|
4082
5223
|
}
|
|
4083
5224
|
async function postCommitAction({ files }) {
|
|
4084
5225
|
try {
|
|
4085
|
-
|
|
4086
|
-
`${
|
|
5226
|
+
chunk4ILBJTRR_cjs.writeInfo(
|
|
5227
|
+
`${chunk4ILBJTRR_cjs.brandIcon(_config)} Running the Storm post-commit git hook for ${files.length} files in the workspace...`,
|
|
4087
5228
|
_config
|
|
4088
5229
|
);
|
|
4089
|
-
await
|
|
4090
|
-
|
|
5230
|
+
await chunkOGGY5I23_cjs.postCommitHook(_config, files);
|
|
5231
|
+
chunk4ILBJTRR_cjs.writeSuccess("\u2714 Post-commit hook completed successfully!\n", _config);
|
|
4091
5232
|
} catch (error) {
|
|
4092
|
-
|
|
5233
|
+
chunk4ILBJTRR_cjs.writeFatal(
|
|
4093
5234
|
`A fatal error occurred while running the post-commit hook:
|
|
4094
5235
|
|
|
4095
5236
|
${error.message}`,
|
|
@@ -4100,14 +5241,14 @@ ${error.message}`,
|
|
|
4100
5241
|
}
|
|
4101
5242
|
async function postMergeAction({ files }) {
|
|
4102
5243
|
try {
|
|
4103
|
-
|
|
4104
|
-
`${
|
|
5244
|
+
chunk4ILBJTRR_cjs.writeInfo(
|
|
5245
|
+
`${chunk4ILBJTRR_cjs.brandIcon(_config)} Running the Storm post-merge git hook for ${files.length} files in the workspace...`,
|
|
4105
5246
|
_config
|
|
4106
5247
|
);
|
|
4107
|
-
await
|
|
4108
|
-
|
|
5248
|
+
await chunkRZNFHUM6_cjs.postMergeHook(_config, files);
|
|
5249
|
+
chunk4ILBJTRR_cjs.writeSuccess("\u2714 Post-merge hook completed successfully!\n", _config);
|
|
4109
5250
|
} catch (error) {
|
|
4110
|
-
|
|
5251
|
+
chunk4ILBJTRR_cjs.writeFatal(
|
|
4111
5252
|
`A fatal error occurred while running the post-merge hook:
|
|
4112
5253
|
|
|
4113
5254
|
${error.message}`,
|
|
@@ -4118,14 +5259,14 @@ ${error.message}`,
|
|
|
4118
5259
|
}
|
|
4119
5260
|
async function preCommitAction({ files }) {
|
|
4120
5261
|
try {
|
|
4121
|
-
|
|
4122
|
-
`${
|
|
5262
|
+
chunk4ILBJTRR_cjs.writeInfo(
|
|
5263
|
+
`${chunk4ILBJTRR_cjs.brandIcon(_config)} Running the Storm pre-commit git hook for ${files.length} files in the workspace...`,
|
|
4123
5264
|
_config
|
|
4124
5265
|
);
|
|
4125
|
-
await
|
|
4126
|
-
|
|
5266
|
+
await chunkAQ5YHZ3Z_cjs.preCommitHook(_config, files);
|
|
5267
|
+
chunk4ILBJTRR_cjs.writeSuccess("\u2714 Pre-commit hook completed successfully!\n", _config);
|
|
4127
5268
|
} catch (error) {
|
|
4128
|
-
|
|
5269
|
+
chunk4ILBJTRR_cjs.writeFatal(
|
|
4129
5270
|
`A fatal error occurred while running the pre-commit hook:
|
|
4130
5271
|
|
|
4131
5272
|
${error.message}`,
|
|
@@ -4136,14 +5277,14 @@ ${error.message}`,
|
|
|
4136
5277
|
}
|
|
4137
5278
|
async function prePushAction({ files }) {
|
|
4138
5279
|
try {
|
|
4139
|
-
|
|
4140
|
-
`${
|
|
5280
|
+
chunk4ILBJTRR_cjs.writeInfo(
|
|
5281
|
+
`${chunk4ILBJTRR_cjs.brandIcon(_config)} Running the Storm pre-push git hook for ${files.length} files in the workspace...`,
|
|
4141
5282
|
_config
|
|
4142
5283
|
);
|
|
4143
|
-
await
|
|
4144
|
-
|
|
5284
|
+
await chunkW5P2IM2W_cjs.prePushHook(_config, files);
|
|
5285
|
+
chunk4ILBJTRR_cjs.writeSuccess("\u2714 Pre-push hook completed successfully!\n", _config);
|
|
4145
5286
|
} catch (error) {
|
|
4146
|
-
|
|
5287
|
+
chunk4ILBJTRR_cjs.writeFatal(
|
|
4147
5288
|
`A fatal error occurred while running the pre-push hook:
|
|
4148
5289
|
|
|
4149
5290
|
${error.message}`,
|
|
@@ -4154,14 +5295,14 @@ ${error.message}`,
|
|
|
4154
5295
|
}
|
|
4155
5296
|
async function prepareAction() {
|
|
4156
5297
|
try {
|
|
4157
|
-
|
|
4158
|
-
`${
|
|
5298
|
+
chunk4ILBJTRR_cjs.writeInfo(
|
|
5299
|
+
`${chunk4ILBJTRR_cjs.brandIcon(_config)} Running the Storm prepare git hook for the workspace...`,
|
|
4159
5300
|
_config
|
|
4160
5301
|
);
|
|
4161
|
-
await
|
|
4162
|
-
|
|
5302
|
+
await chunk4EOHM2UV_cjs.prepareHook(_config);
|
|
5303
|
+
chunk4ILBJTRR_cjs.writeSuccess("\u2714 Prepare hook completed successfully!\n", _config);
|
|
4163
5304
|
} catch (error) {
|
|
4164
|
-
|
|
5305
|
+
chunk4ILBJTRR_cjs.writeFatal(
|
|
4165
5306
|
`A fatal error occurred while running the prepare hook:
|
|
4166
5307
|
|
|
4167
5308
|
${error.message}`,
|
|
@@ -4173,18 +5314,18 @@ ${error.message}`,
|
|
|
4173
5314
|
|
|
4174
5315
|
// bin/git.ts
|
|
4175
5316
|
void (async () => {
|
|
4176
|
-
const config5 = await
|
|
5317
|
+
const config5 = await chunk4ILBJTRR_cjs.getConfig();
|
|
4177
5318
|
try {
|
|
4178
|
-
|
|
5319
|
+
chunk4ILBJTRR_cjs.handleProcess(config5);
|
|
4179
5320
|
const program = createProgram(config5);
|
|
4180
5321
|
await program.parseAsync(process.argv);
|
|
4181
|
-
|
|
5322
|
+
chunk4ILBJTRR_cjs.writeSuccess(
|
|
4182
5323
|
`\u2714 Git ${process.argv && process.argv.length >= 3 && process.argv[2] ? process.argv[2] : "tool"} processing completed successfully!`,
|
|
4183
5324
|
config5
|
|
4184
5325
|
);
|
|
4185
|
-
|
|
5326
|
+
chunk4ILBJTRR_cjs.exitWithSuccess(config5);
|
|
4186
5327
|
} catch (error) {
|
|
4187
|
-
|
|
5328
|
+
chunk4ILBJTRR_cjs.exitWithError(config5);
|
|
4188
5329
|
process.exit(1);
|
|
4189
5330
|
}
|
|
4190
5331
|
})();
|