nx 21.3.0-beta.2 → 21.3.0-beta.4

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.
Files changed (61) hide show
  1. package/package.json +11 -11
  2. package/release/changelog-renderer/index.js +10 -2
  3. package/src/command-line/affected/affected.js +1 -1
  4. package/src/command-line/format/command-object.js +12 -6
  5. package/src/command-line/init/implementation/add-nx-to-monorepo.js +1 -1
  6. package/src/command-line/init/implementation/add-nx-to-nest.js +1 -1
  7. package/src/command-line/init/implementation/add-nx-to-npm-repo.js +1 -1
  8. package/src/command-line/init/implementation/angular/index.js +1 -1
  9. package/src/command-line/init/implementation/angular/legacy-angular-versions.js +1 -1
  10. package/src/command-line/init/implementation/utils.js +1 -1
  11. package/src/command-line/init/init-v2.js +1 -1
  12. package/src/command-line/migrate/migrate.js +1 -1
  13. package/src/command-line/{connect → nx-cloud/connect}/command-object.js +4 -4
  14. package/src/command-line/{connect → nx-cloud/connect}/connect-to-nx-cloud.d.ts +4 -4
  15. package/src/command-line/{connect → nx-cloud/connect}/connect-to-nx-cloud.js +10 -10
  16. package/src/command-line/{connect → nx-cloud/connect}/view-logs.js +6 -6
  17. package/src/command-line/nx-cloud/fix-ci/command-object.d.ts +2 -0
  18. package/src/command-line/nx-cloud/fix-ci/command-object.js +12 -0
  19. package/src/command-line/nx-cloud/fix-ci/fix-ci.d.ts +4 -0
  20. package/src/command-line/nx-cloud/fix-ci/fix-ci.js +7 -0
  21. package/src/command-line/{login → nx-cloud/login}/command-object.js +1 -1
  22. package/src/command-line/nx-cloud/login/login.js +10 -0
  23. package/src/command-line/{logout → nx-cloud/logout}/command-object.js +1 -1
  24. package/src/command-line/nx-cloud/logout/logout.js +7 -0
  25. package/src/command-line/nx-cloud/record/command-object.d.ts +2 -0
  26. package/src/command-line/nx-cloud/record/command-object.js +12 -0
  27. package/src/command-line/nx-cloud/record/record.d.ts +4 -0
  28. package/src/command-line/nx-cloud/record/record.js +7 -0
  29. package/src/command-line/nx-cloud/start-ci-run/command-object.d.ts +2 -0
  30. package/src/command-line/nx-cloud/start-ci-run/command-object.js +12 -0
  31. package/src/command-line/nx-cloud/start-ci-run/start-ci-run.d.ts +4 -0
  32. package/src/command-line/nx-cloud/start-ci-run/start-ci-run.js +7 -0
  33. package/src/command-line/nx-cloud/utils.d.ts +1 -0
  34. package/src/command-line/{logout/logout.js → nx-cloud/utils.js} +4 -4
  35. package/src/command-line/nx-commands.js +12 -6
  36. package/src/command-line/release/changelog.js +3 -13
  37. package/src/command-line/release/config/config.js +12 -0
  38. package/src/command-line/release/utils/git.d.ts +1 -1
  39. package/src/command-line/release/utils/git.js +18 -10
  40. package/src/command-line/release/utils/shared.js +7 -1
  41. package/src/command-line/release/version/release-group-processor.js +1 -1
  42. package/src/command-line/run/run-one.js +1 -1
  43. package/src/command-line/run-many/run-many.js +1 -1
  44. package/src/config/nx-json.d.ts +14 -0
  45. package/src/core/graph/main.js +1 -1
  46. package/src/core/graph/styles.js +1 -1
  47. package/src/native/nx.wasm32-wasi.wasm +0 -0
  48. package/src/plugins/package-json/create-nodes.js +4 -1
  49. package/src/tasks-runner/run-command.js +0 -2
  50. package/src/utils/project-graph-utils.d.ts +6 -1
  51. package/src/utils/project-graph-utils.js +11 -6
  52. package/src/utils/workspace-context.js +1 -1
  53. package/src/command-line/login/login.js +0 -19
  54. package/src/tasks-runner/life-cycles/nx-cloud-ci-message-life-cycle.d.ts +0 -7
  55. package/src/tasks-runner/life-cycles/nx-cloud-ci-message-life-cycle.js +0 -49
  56. /package/src/command-line/{connect → nx-cloud/connect}/command-object.d.ts +0 -0
  57. /package/src/command-line/{connect → nx-cloud/connect}/view-logs.d.ts +0 -0
  58. /package/src/command-line/{login → nx-cloud/login}/command-object.d.ts +0 -0
  59. /package/src/command-line/{login → nx-cloud/login}/login.d.ts +0 -0
  60. /package/src/command-line/{logout → nx-cloud/logout}/command-object.d.ts +0 -0
  61. /package/src/command-line/{logout → nx-cloud/logout}/logout.d.ts +0 -0
@@ -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
@@ -4,7 +4,7 @@ exports.runOne = runOne;
4
4
  exports.parseRunOneOptions = parseRunOneOptions;
5
5
  const run_command_1 = require("../../tasks-runner/run-command");
6
6
  const command_line_utils_1 = require("../../utils/command-line-utils");
7
- const connect_to_nx_cloud_1 = require("../connect/connect-to-nx-cloud");
7
+ const connect_to_nx_cloud_1 = require("../nx-cloud/connect/connect-to-nx-cloud");
8
8
  const project_graph_1 = require("../../project-graph/project-graph");
9
9
  const workspace_root_1 = require("../../utils/workspace-root");
10
10
  const split_target_1 = require("../../utils/split-target");
@@ -5,7 +5,7 @@ exports.projectsToRun = projectsToRun;
5
5
  const run_command_1 = require("../../tasks-runner/run-command");
6
6
  const command_line_utils_1 = require("../../utils/command-line-utils");
7
7
  const project_graph_utils_1 = require("../../utils/project-graph-utils");
8
- const connect_to_nx_cloud_1 = require("../connect/connect-to-nx-cloud");
8
+ const connect_to_nx_cloud_1 = require("../nx-cloud/connect/connect-to-nx-cloud");
9
9
  const perf_hooks_1 = require("perf_hooks");
10
10
  const project_graph_1 = require("../../project-graph/project-graph");
11
11
  const configuration_1 = require("../../config/configuration");
@@ -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
  */