@redpanda-data/docs-extensions-and-macros 4.10.5 → 4.10.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redpanda-data/docs-extensions-and-macros",
3
- "version": "4.10.5",
3
+ "version": "4.10.6",
4
4
  "description": "Antora extensions and macros developed for Redpanda documentation.",
5
5
  "keywords": [
6
6
  "antora",
@@ -28,21 +28,15 @@ function normalizeTag(tag) {
28
28
  throw new Error('Invalid version format: tag cannot be empty');
29
29
  }
30
30
 
31
- // Handle dev branch
32
- if (tag === 'dev') {
33
- return 'dev';
34
- }
35
-
36
31
  // Remove 'v' prefix if present
37
32
  const normalized = tag.startsWith('v') ? tag.slice(1) : tag;
38
-
39
33
  // Validate semantic version format
40
34
  const semverPattern = /^\d+\.\d+\.\d+(-[\w\.-]+)?(\+[\w\.-]+)?$/;
41
- if (!semverPattern.test(normalized) && normalized !== 'dev') {
42
- throw new Error(`Invalid version format: ${tag}. Expected format like v25.1.1 or 25.1.1`);
35
+ if (semverPattern.test(normalized)) {
36
+ return normalized;
43
37
  }
44
-
45
- return normalized;
38
+ // If not a valid semver, treat as branch name and return as-is
39
+ return tag;
46
40
  }
47
41
 
48
42
  /**
@@ -59,22 +53,20 @@ function getMajorMinor(version) {
59
53
  throw new Error('Version must be a non-empty string');
60
54
  }
61
55
 
62
- if (version === 'dev') {
63
- return 'dev';
56
+ // Only process if valid semver, else return as-is (branch name)
57
+ const semverPattern = /^\d+\.\d+\.\d+(-[\w\.-]+)?(\+[\w\.-]+)?$/;
58
+ if (!semverPattern.test(version)) {
59
+ return version;
64
60
  }
65
-
66
61
  const parts = version.split('.');
67
62
  if (parts.length < 2) {
68
63
  throw new Error(`Invalid version format: ${version}. Expected X.Y.Z format`);
69
64
  }
70
-
71
65
  const major = parseInt(parts[0], 10);
72
66
  const minor = parseInt(parts[1], 10);
73
-
74
67
  if (isNaN(major) || isNaN(minor)) {
75
68
  throw new Error(`Major and minor versions must be numbers: ${version}`);
76
69
  }
77
-
78
70
  return `${major}.${minor}`;
79
71
  }
80
72