You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Docstrings generation was requested by @JakeSCahill.
* #103 (comment)
The following files were modified:
* `bin/doc-tools.js`
* `cli-utils/convert-doc-links.js`
* `cli-utils/self-managed-docs-branch.js`
* Searches upward from a starting directory to locate the repository root.
15
+
*
16
+
* Traverses parent directories from the specified start path, returning the first directory containing either a `.git` folder or a `package.json` file. Exits the process with an error if no such directory is found.
17
+
*
18
+
* @param {string} [start] - The directory to begin the search from. Defaults to the current working directory.
19
+
* @returns {string} The absolute path to the repository root directory.
20
+
*/
13
21
functionfindRepoRoot(start=process.cwd()){
14
22
letdir=start;
15
23
while(dir!==path.parse(dir).root){
@@ -26,19 +34,25 @@ function findRepoRoot(start = process.cwd()) {
* Prints an error message to stderr and exits the process with a non-zero status.
39
+
*
40
+
* @param {string} msg - The error message to display before exiting.
41
+
*/
30
42
functionfail(msg){
31
43
console.error(`❌ ${msg}`);
32
44
process.exit(1);
33
45
}
34
46
35
47
/**
36
-
* Ensure a tool is installed (and optionally that it responds to a version flag).
48
+
* Ensures that a specified command-line tool is installed and operational.
49
+
*
50
+
* Attempts to execute the tool with a version flag to verify its presence. If the tool is missing or fails to run, the process exits with an error message and optional installation hint.
37
51
*
38
-
* @param {string} cmd The binary name (such as 'docker', 'helm-docs')
39
-
* @param {object} [opts]
40
-
* @param {string} [opts.versionFlag='--version'] What to append to check it runs
41
-
* @param {string} [opts.help] A one-liner hint (URL or install command)
52
+
* @param {string} cmd - The name of the tool to check (e.g., 'docker', 'helm-docs').
53
+
* @param {object} [opts] - Optional settings.
54
+
* @param {string} [opts.versionFlag='--version'] - The flag used to test the tool's execution.
55
+
* @param {string} [opts.help] - An optional hint or installation instruction shown on failure.
42
56
*/
43
57
functionrequireTool(cmd,{ versionFlag ='--version', help =''}={}){
44
58
try{
@@ -49,14 +63,28 @@ function requireTool(cmd, { versionFlag = '--version', help = '' } = {}) {
49
63
}
50
64
}
51
65
52
-
// Simple existence only (no version flag)
66
+
/**
67
+
* Ensures that a command-line tool is installed by checking if it responds to the `--help` flag.
68
+
*
69
+
* @param {string} cmd - The name of the command-line tool to check.
70
+
* @param {string} [help] - Optional help text to display if the tool is not found.
71
+
*
72
+
* @throws {Error} If the specified command is not found or does not respond to `--help`.
* Ensures that Python with a minimum required version is installed and available in the system PATH.
82
+
*
83
+
* Checks for either `python3` or `python` executables and verifies that the version is at least the specified minimum (default: 3.10). Exits the process with an error message if the requirement is not met.
84
+
*
85
+
* @param {number} [minMajor=3] - Minimum required major version of Python.
86
+
* @param {number} [minMinor=10] - Minimum required minor version of Python.
* Ensures that required dependencies for generating CRD documentation are installed.
126
+
*
127
+
* Verifies the presence of the {@link git} and {@link crd-ref-docs} command-line tools, exiting the process with an error message if either is missing.
* Ensures all dependencies required for generating property documentation are installed.
148
+
*
149
+
* Checks for the presence of `make`, Python 3.10 or newer, and at least one C++ compiler (`gcc` or `clang`). Exits the process with an error message if any dependency is missing.
150
+
*/
104
151
functionverifyPropertyDependencies(){
105
152
requireCmd('make','your OS package manager');
106
153
requirePython();
@@ -112,6 +159,13 @@ function verifyPropertyDependencies() {
112
159
}
113
160
}
114
161
162
+
/**
163
+
* Ensures all required dependencies for generating Redpanda metrics documentation are installed.
164
+
*
165
+
* Verifies that Python 3.10+, `curl`, and `tar` are available, and that the Docker daemon is running.
166
+
*
167
+
* @throws {Error} If any required dependency is missing or the Docker daemon is not running.
@@ -32,10 +35,14 @@ function fetchRemoteAntoraVersion() {
32
35
}
33
36
34
37
/**
35
-
* Given an operator tag (such as "operator/v25.1.2" or "v25.1.2") and
36
-
* the remote Antora version (such as "25.1"), decide which docs branch to use.
38
+
* Determines the appropriate documentation branch for a given operator tag based on the remote Antora version.
39
+
*
40
+
* Normalizes the input tag, extracts the major.minor version, and applies version-specific logic to select the correct branch. Verifies that the chosen branch exists in the remote repository.
41
+
*
42
+
* @param {string} operatorTag - The operator tag to evaluate (e.g., "operator/v25.1.2" or "v25.1.2").
43
+
* @returns {Promise<string>} The name of the documentation branch to use.
37
44
*
38
-
* Throws if the chosen branch does not exist on origin.
45
+
* @throws {Error} If the tag cannot be parsed or if the determined branch does not exist in the remote repository.
0 commit comments