nx 21.3.0-canary.20250704-e92cbee → 21.3.0-canary.20250708-ea5cd30

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "21.3.0-canary.20250704-e92cbee",
3
+ "version": "21.3.0-canary.20250708-ea5cd30",
4
4
  "private": false,
5
5
  "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
6
6
  "repository": {
@@ -83,16 +83,16 @@
83
83
  }
84
84
  },
85
85
  "optionalDependencies": {
86
- "@nx/nx-darwin-arm64": "21.3.0-canary.20250704-e92cbee",
87
- "@nx/nx-darwin-x64": "21.3.0-canary.20250704-e92cbee",
88
- "@nx/nx-freebsd-x64": "21.3.0-canary.20250704-e92cbee",
89
- "@nx/nx-linux-arm-gnueabihf": "21.3.0-canary.20250704-e92cbee",
90
- "@nx/nx-linux-arm64-gnu": "21.3.0-canary.20250704-e92cbee",
91
- "@nx/nx-linux-arm64-musl": "21.3.0-canary.20250704-e92cbee",
92
- "@nx/nx-linux-x64-gnu": "21.3.0-canary.20250704-e92cbee",
93
- "@nx/nx-linux-x64-musl": "21.3.0-canary.20250704-e92cbee",
94
- "@nx/nx-win32-arm64-msvc": "21.3.0-canary.20250704-e92cbee",
95
- "@nx/nx-win32-x64-msvc": "21.3.0-canary.20250704-e92cbee"
86
+ "@nx/nx-darwin-arm64": "21.3.0-canary.20250708-ea5cd30",
87
+ "@nx/nx-darwin-x64": "21.3.0-canary.20250708-ea5cd30",
88
+ "@nx/nx-freebsd-x64": "21.3.0-canary.20250708-ea5cd30",
89
+ "@nx/nx-linux-arm-gnueabihf": "21.3.0-canary.20250708-ea5cd30",
90
+ "@nx/nx-linux-arm64-gnu": "21.3.0-canary.20250708-ea5cd30",
91
+ "@nx/nx-linux-arm64-musl": "21.3.0-canary.20250708-ea5cd30",
92
+ "@nx/nx-linux-x64-gnu": "21.3.0-canary.20250708-ea5cd30",
93
+ "@nx/nx-linux-x64-musl": "21.3.0-canary.20250708-ea5cd30",
94
+ "@nx/nx-win32-arm64-msvc": "21.3.0-canary.20250708-ea5cd30",
95
+ "@nx/nx-win32-x64-msvc": "21.3.0-canary.20250708-ea5cd30"
96
96
  },
97
97
  "nx-migrations": {
98
98
  "migrations": "./migrations.json",
@@ -132,8 +132,16 @@ class DefaultChangelogRenderer {
132
132
  return '';
133
133
  }
134
134
  renderVersionTitle() {
135
- const isMajorVersion = `${(0, semver_1.major)(this.changelogEntryVersion)}.0.0` ===
136
- this.changelogEntryVersion.replace(/^v/, '');
135
+ let isMajorVersion = true;
136
+ try {
137
+ isMajorVersion =
138
+ `${(0, semver_1.major)(this.changelogEntryVersion)}.0.0` ===
139
+ this.changelogEntryVersion.replace(/^v/, '');
140
+ }
141
+ catch {
142
+ // Do nothing with the error
143
+ // Prevent non-semver versions from erroring out
144
+ }
137
145
  let maybeDateStr = '';
138
146
  if (this.changelogRenderOptions.versionTitleDate) {
139
147
  const dateStr = new Date().toISOString().slice(0, 10);
@@ -5,7 +5,6 @@ exports.createAPI = createAPI;
5
5
  const chalk = require("chalk");
6
6
  const enquirer_1 = require("enquirer");
7
7
  const node_fs_1 = require("node:fs");
8
- const semver_1 = require("semver");
9
8
  const tmp_1 = require("tmp");
10
9
  const nx_json_1 = require("../../config/nx-json");
11
10
  const tree_1 = require("../../generators/tree");
@@ -192,7 +191,7 @@ function createAPI(overrideReleaseConfig) {
192
191
  }
193
192
  else {
194
193
  let workspaceChangelogFromRef = args.from ||
195
- (await (0, git_1.getLatestGitTagForPattern)(nxReleaseConfig.releaseTagPattern, {}, nxReleaseConfig.releaseTagPatternCheckAllBranchesWhen))?.tag;
194
+ (await (0, git_1.getLatestGitTagForPattern)(nxReleaseConfig.releaseTagPattern, {}, nxReleaseConfig.releaseTagPatternCheckAllBranchesWhen, nxReleaseConfig.releaseTagPatternRequireSemver))?.tag;
196
195
  if (!workspaceChangelogFromRef) {
197
196
  if (useAutomaticFromRef) {
198
197
  workspaceChangelogFromRef = await (0, git_1.getFirstGitCommit)();
@@ -327,7 +326,7 @@ function createAPI(overrideReleaseConfig) {
327
326
  (await (0, git_1.getLatestGitTagForPattern)(releaseGroup.releaseTagPattern, {
328
327
  projectName: project.name,
329
328
  releaseGroupName: releaseGroup.name,
330
- }, releaseGroup.releaseTagPatternCheckAllBranchesWhen))?.tag;
329
+ }, releaseGroup.releaseTagPatternCheckAllBranchesWhen, releaseGroup.releaseTagPatternRequireSemver))?.tag;
331
330
  if (!fromRef && useAutomaticFromRef) {
332
331
  const firstCommit = await (0, git_1.getFirstGitCommit)();
333
332
  commits = await filterProjectCommits({
@@ -437,7 +436,7 @@ function createAPI(overrideReleaseConfig) {
437
436
  }
438
437
  else {
439
438
  let fromRef = args.from ||
440
- (await (0, git_1.getLatestGitTagForPattern)(releaseGroup.releaseTagPattern, {}, releaseGroup.releaseTagPatternCheckAllBranchesWhen))?.tag;
439
+ (await (0, git_1.getLatestGitTagForPattern)(releaseGroup.releaseTagPattern, {}, releaseGroup.releaseTagPatternCheckAllBranchesWhen, releaseGroup.releaseTagPatternRequireSemver))?.tag;
441
440
  if (!fromRef) {
442
441
  if (useAutomaticFromRef) {
443
442
  fromRef = await (0, git_1.getFirstGitCommit)();
@@ -502,15 +501,6 @@ function resolveChangelogVersions(args, releaseGroups, releaseGroupToFilteredPro
502
501
  if (!args.version && !args.versionData) {
503
502
  throw new Error(`You must provide a version string and/or a versionData object.`);
504
503
  }
505
- /**
506
- * TODO: revaluate this assumption holistically in a dedicated PR when we add support for calver
507
- * (e.g. the Release class also uses semver utils to check if prerelease).
508
- *
509
- * Right now, the given version must be valid semver in order to proceed
510
- */
511
- if (args.version && !(0, semver_1.valid)(args.version)) {
512
- throw new Error(`The given version "${args.version}" is not a valid semver version. Please provide your version in the format "1.0.0", "1.0.0-beta.1" etc`);
513
- }
514
504
  const versionData = releaseGroups.reduce((versionData, releaseGroup) => {
515
505
  const releaseGroupProjectNames = Array.from(releaseGroupToFilteredProjects.get(releaseGroup));
516
506
  for (const projectName of releaseGroupProjectNames) {
@@ -118,6 +118,7 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
118
118
  */
119
119
  const defaultFixedGroupReleaseTagPattern = '{releaseGroupName}-v{version}';
120
120
  const defaultIndependentReleaseTagPattern = '{projectName}@{version}';
121
+ const defaultReleaseTagPatternRequireSemver = true;
121
122
  const workspaceProjectsRelationship = userConfig.projectsRelationship || 'fixed';
122
123
  const defaultGeneratorOptions = {};
123
124
  if (userConfig.version?.conventionalCommits) {
@@ -200,11 +201,15 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
200
201
  ? defaultIndependentReleaseTagPattern
201
202
  : defaultFixedReleaseTagPattern),
202
203
  releaseTagPatternCheckAllBranchesWhen: userConfig.releaseTagPatternCheckAllBranchesWhen ?? undefined,
204
+ releaseTagPatternRequireSemver: userConfig.releaseTagPatternRequireSemver ??
205
+ defaultReleaseTagPatternRequireSemver,
203
206
  conventionalCommits: conventional_commits_1.DEFAULT_CONVENTIONAL_COMMITS_CONFIG,
204
207
  versionPlans: (userConfig.versionPlans ||
205
208
  false),
206
209
  };
207
210
  const groupProjectsRelationship = userConfig.projectsRelationship || WORKSPACE_DEFAULTS.projectsRelationship;
211
+ const groupReleaseTagPatternRequireSemver = userConfig.releaseTagPatternRequireSemver ??
212
+ WORKSPACE_DEFAULTS.releaseTagPatternRequireSemver;
208
213
  const GROUP_DEFAULTS = {
209
214
  projectsRelationship: groupProjectsRelationship,
210
215
  version: USE_LEGACY_VERSIONING
@@ -238,6 +243,7 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
238
243
  ? defaultIndependentReleaseTagPattern
239
244
  : WORKSPACE_DEFAULTS.releaseTagPattern,
240
245
  releaseTagPatternCheckAllBranchesWhen: userConfig.releaseTagPatternCheckAllBranchesWhen ?? undefined,
246
+ releaseTagPatternRequireSemver: groupReleaseTagPatternRequireSemver,
241
247
  versionPlans: false,
242
248
  };
243
249
  /**
@@ -339,6 +345,8 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
339
345
  version: deepMergeDefaults([GROUP_DEFAULTS.version], rootVersionWithoutGlobalOptions),
340
346
  // If the user has set something custom for releaseTagPattern at the top level, respect it for the implicit default group
341
347
  releaseTagPattern: userConfig.releaseTagPattern || GROUP_DEFAULTS.releaseTagPattern,
348
+ releaseTagPatternRequireSemver: userConfig.releaseTagPatternRequireSemver ??
349
+ GROUP_DEFAULTS.releaseTagPatternRequireSemver,
342
350
  // Directly inherit the root level config for projectChangelogs, if set
343
351
  changelog: rootChangelogConfig.projectChangelogs || false,
344
352
  versionPlans: rootVersionPlansConfig || GROUP_DEFAULTS.versionPlans,
@@ -418,6 +426,9 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
418
426
  releaseTagPatternCheckAllBranchesWhen: releaseGroup.releaseTagPatternCheckAllBranchesWhen ??
419
427
  userConfig.releaseTagPatternCheckAllBranchesWhen ??
420
428
  undefined,
429
+ releaseTagPatternRequireSemver: releaseGroup.releaseTagPatternRequireSemver ??
430
+ userConfig.releaseTagPatternRequireSemver ??
431
+ defaultReleaseTagPatternRequireSemver,
421
432
  versionPlans: releaseGroup.versionPlans ?? rootVersionPlansConfig,
422
433
  };
423
434
  const finalReleaseGroup = deepMergeDefaults([groupDefaults], {
@@ -491,6 +502,7 @@ async function createNxReleaseConfig(projectGraph, projectFileMap, userConfig =
491
502
  projectsRelationship: WORKSPACE_DEFAULTS.projectsRelationship,
492
503
  releaseTagPattern: WORKSPACE_DEFAULTS.releaseTagPattern,
493
504
  releaseTagPatternCheckAllBranchesWhen: WORKSPACE_DEFAULTS.releaseTagPatternCheckAllBranchesWhen,
505
+ releaseTagPatternRequireSemver: WORKSPACE_DEFAULTS.releaseTagPatternRequireSemver,
494
506
  git: rootGitConfig,
495
507
  version: rootVersionConfig,
496
508
  changelog: rootChangelogConfig,
@@ -22,7 +22,7 @@ export interface GitCommit extends RawGitCommit {
22
22
  affectedFiles: string[];
23
23
  revertedHashes: string[];
24
24
  }
25
- export declare function getLatestGitTagForPattern(releaseTagPattern: string, additionalInterpolationData?: {}, checkAllBranchesWhen?: boolean | string[]): Promise<{
25
+ export declare function getLatestGitTagForPattern(releaseTagPattern: string, additionalInterpolationData?: {}, checkAllBranchesWhen?: boolean | string[], releaseTagPatternRequireSemver?: boolean): Promise<{
26
26
  tag: string;
27
27
  extractedVersion: string;
28
28
  } | null>;
@@ -26,7 +26,7 @@ function escapeRegExp(string) {
26
26
  }
27
27
  // https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
28
28
  const SEMVER_REGEX = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/g;
29
- async function getLatestGitTagForPattern(releaseTagPattern, additionalInterpolationData = {}, checkAllBranchesWhen) {
29
+ async function getLatestGitTagForPattern(releaseTagPattern, additionalInterpolationData = {}, checkAllBranchesWhen, releaseTagPatternRequireSemver = true) {
30
30
  /**
31
31
  * By default, we will try and resolve the latest match for the releaseTagPattern from the current branch,
32
32
  * falling back to all branches if no match is found on the current branch.
@@ -105,17 +105,25 @@ async function getLatestGitTagForPattern(releaseTagPattern, additionalInterpolat
105
105
  const tagRegexp = `^${escapeRegExp(interpolatedTagPattern)
106
106
  .replace('%v%', '(.+)')
107
107
  .replace('%p%', '(.+)')}`;
108
- const matchingSemverTags = tags.filter((tag) =>
109
- // Do the match against SEMVER_REGEX to ensure that we skip tags that aren't valid semver versions
110
- !!tag.match(tagRegexp) &&
111
- tag.match(tagRegexp).some((r) => r.match(SEMVER_REGEX)));
112
- if (!matchingSemverTags.length) {
108
+ const matchingTags = tags.filter((tag) => {
109
+ if (releaseTagPatternRequireSemver) {
110
+ // Match against Semver Regex when using semverVersioning to ensure only valid semver tags are matched
111
+ return (!!tag.match(tagRegexp) &&
112
+ tag.match(tagRegexp).some((r) => r.match(SEMVER_REGEX)));
113
+ }
114
+ else {
115
+ return !!tag.match(tagRegexp);
116
+ }
117
+ });
118
+ if (!matchingTags.length) {
113
119
  return null;
114
120
  }
115
- const [latestMatchingTag, ...rest] = matchingSemverTags[0].match(tagRegexp);
116
- const version = rest.filter((r) => {
117
- return r.match(SEMVER_REGEX);
118
- })[0];
121
+ const [latestMatchingTag, ...rest] = matchingTags[0].match(tagRegexp);
122
+ const version = releaseTagPatternRequireSemver
123
+ ? rest.filter((r) => {
124
+ return r.match(SEMVER_REGEX);
125
+ })[0]
126
+ : rest[0];
119
127
  return {
120
128
  tag: latestMatchingTag,
121
129
  extractedVersion: version,
@@ -15,7 +15,13 @@ const git_1 = require("./git");
15
15
  exports.noDiffInChangelogMessage = chalk.yellow(`NOTE: There was no diff detected for the changelog entry. Maybe you intended to pass alternative git references via --from and --to?`);
16
16
  function isPrerelease(version) {
17
17
  // prerelease returns an array of matching prerelease "components", or null if the version is not a prerelease
18
- return (0, semver_1.prerelease)(version) !== null;
18
+ try {
19
+ return (0, semver_1.prerelease)(version) !== null;
20
+ }
21
+ catch {
22
+ // If non-semver, prerelease will error. Prevent this from erroring the command
23
+ return false;
24
+ }
19
25
  }
20
26
  class ReleaseVersion {
21
27
  constructor({ version, // short form version string with no prefixes or patterns, e.g. 1.0.0
@@ -198,7 +198,7 @@ class ReleaseGroupProcessor {
198
198
  if (finalConfigForProject.currentVersionResolver === 'git-tag') {
199
199
  latestMatchingGitTag = await (0, git_1.getLatestGitTagForPattern)(releaseTagPattern, {
200
200
  projectName: projectGraphNode.name,
201
- }, releaseGroupNode.group.releaseTagPatternCheckAllBranchesWhen);
201
+ }, releaseGroupNode.group.releaseTagPatternCheckAllBranchesWhen, releaseGroupNode.group.releaseTagPatternRequireSemver);
202
202
  this.cachedLatestMatchingGitTag.set(projectName, latestMatchingGitTag);
203
203
  }
204
204
  // Cache the current version for the project
@@ -342,6 +342,13 @@ export interface NxReleaseConfiguration {
342
342
  * - Setting it to an array of strings will cause us to check all branches WHEN the current branch matches one of the strings in the array. Glob patterns are supported.
343
343
  */
344
344
  releaseTagPatternCheckAllBranchesWhen?: boolean | string[];
345
+ /**
346
+ * By default, we will use semver when searching through the tags to find the latest matching tag.
347
+ *
348
+ * - Setting this to true will cause us to use semver to match the version
349
+ * - Setting this to false will cause us to not use semver to match the version allowing for non-semver versions
350
+ */
351
+ releaseTagPatternRequireSemver?: boolean;
345
352
  /**
346
353
  * Enables using version plans as a specifier source for versioning and
347
354
  * to determine changes for changelog generation.
@@ -410,6 +417,13 @@ export interface NxReleaseConfiguration {
410
417
  * - Setting it to an array of strings will cause us to check all branches WHEN the current branch matches one of the strings in the array. Glob patterns are supported.
411
418
  */
412
419
  releaseTagPatternCheckAllBranchesWhen?: boolean | string[];
420
+ /**
421
+ * By default, we will use semver when searching through the tags to find the latest matching tag.
422
+ *
423
+ * - Setting this to true will cause us to use semver to match the version
424
+ * - Setting this to false will cause us to not use semver to match the version allowing for non-semver versions
425
+ */
426
+ releaseTagPatternRequireSemver?: boolean;
413
427
  /**
414
428
  * Enable and configure automatic git operations as part of the release
415
429
  */
Binary file
@@ -44,7 +44,7 @@ function globWithWorkspaceContextSync(workspaceRoot, globs, exclude) {
44
44
  return workspaceContext.glob(globs, exclude);
45
45
  }
46
46
  async function globWithWorkspaceContext(workspaceRoot, globs, exclude) {
47
- if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
47
+ if (workspaceRoot === '/virtual' || (0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
48
48
  ensureContextAvailable(workspaceRoot);
49
49
  return workspaceContext.glob(globs, exclude);
50
50
  }