@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 +1 -1
- package/tools/bundle-openapi.js +8 -16
package/package.json
CHANGED
package/tools/bundle-openapi.js
CHANGED
|
@@ -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 (
|
|
42
|
-
|
|
35
|
+
if (semverPattern.test(normalized)) {
|
|
36
|
+
return normalized;
|
|
43
37
|
}
|
|
44
|
-
|
|
45
|
-
return
|
|
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 (
|
|
63
|
-
|
|
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
|
|