@redpanda-data/docs-extensions-and-macros 4.9.0 → 4.10.0
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/bin/doc-tools.js +197 -3
- package/cli-utils/install-test-dependencies.sh +474 -106
- package/package.json +9 -3
- package/tools/bundle-openapi.js +814 -0
- package/tools/redpanda-connect/generate-rpcn-connector-docs.js +96 -2
- package/tools/redpanda-connect/helpers/bloblangExample.js +42 -0
- package/tools/redpanda-connect/helpers/index.js +4 -3
- package/tools/redpanda-connect/helpers/renderConnectFields.js +32 -5
- package/tools/redpanda-connect/report-delta.js +101 -0
- package/tools/redpanda-connect/templates/bloblang-function.hbs +28 -0
|
@@ -1,158 +1,526 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
set -e
|
|
3
3
|
|
|
4
|
-
#
|
|
4
|
+
# Colors for output
|
|
5
|
+
RED='\033[0;31m'
|
|
6
|
+
GREEN='\033[0;32m'
|
|
7
|
+
YELLOW='\033[1;33m'
|
|
8
|
+
NC='\033[0m' # No Color
|
|
9
|
+
|
|
10
|
+
# log_info prints a green "[INFO]"-prefixed message to stdout.
|
|
11
|
+
log_info() { echo -e "${GREEN}[INFO]${NC} $1"; }
|
|
12
|
+
# log_warn prints a warning message prefixed with "[WARN]" in yellow to stdout.
|
|
13
|
+
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
|
|
14
|
+
# log_error echoes the provided message prefixed with a red `[ERROR]` tag.
|
|
15
|
+
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
|
|
16
|
+
|
|
17
|
+
# command_exists checks whether the specified command is available on PATH.
|
|
18
|
+
command_exists() {
|
|
19
|
+
command -v "$1" &>/dev/null
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
# install_node checks for Node.js and enforces a minimum version of 22.20.0; if Node.js is missing or below the required version it logs upgrade/install instructions and returns non-zero.
|
|
5
23
|
install_node() {
|
|
6
|
-
|
|
7
|
-
|
|
24
|
+
local required_version="22.20.0"
|
|
25
|
+
|
|
26
|
+
if command_exists node; then
|
|
27
|
+
local current_version=$(node -v | sed 's/v//')
|
|
28
|
+
log_info "Node.js is already installed. Version: v$current_version"
|
|
29
|
+
|
|
30
|
+
# Check if current version meets minimum requirement
|
|
31
|
+
if [ "$(printf '%s\n' "$required_version" "$current_version" | sort -V | head -n1)" = "$required_version" ]; then
|
|
32
|
+
log_info "Node.js version meets minimum requirement (>= v$required_version)"
|
|
33
|
+
return 0
|
|
34
|
+
else
|
|
35
|
+
log_warn "Node.js version v$current_version is below minimum required v$required_version"
|
|
36
|
+
log_warn "Please upgrade Node.js manually to v$required_version or later"
|
|
37
|
+
log_info "You can:"
|
|
38
|
+
log_info " 1. Use fnm: curl -fsSL https://fnm.vercel.app/install | bash && fnm install 22 && fnm use 22"
|
|
39
|
+
log_info " 2. Use nvm: nvm install 22 && nvm use 22"
|
|
40
|
+
log_info " 3. Use Homebrew: brew install node@22"
|
|
41
|
+
log_info " 4. Download from: https://nodejs.org/"
|
|
42
|
+
log_warn "Some CLI features (like @redocly/cli 2.2.2) require Node.js >= v22.20.0"
|
|
43
|
+
return 1
|
|
44
|
+
fi
|
|
8
45
|
else
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
echo "Node.js version: $(node -v)"
|
|
46
|
+
log_warn "Node.js is not installed"
|
|
47
|
+
log_info "Please install Node.js v$required_version or later manually:"
|
|
48
|
+
log_info " 1. Use fnm: curl -fsSL https://fnm.vercel.app/install | bash && fnm install 22 && fnm use 22"
|
|
49
|
+
log_info " 2. Use nvm: nvm install 22 && nvm use 22"
|
|
50
|
+
log_info " 3. Use Homebrew: brew install node@22"
|
|
51
|
+
log_info " 4. Download from: https://nodejs.org/"
|
|
52
|
+
return 1
|
|
17
53
|
fi
|
|
18
54
|
}
|
|
19
55
|
|
|
20
|
-
#
|
|
56
|
+
# install_rust ensures the Rust toolchain is installed and configures the current shell environment.
|
|
21
57
|
install_rust() {
|
|
22
|
-
if
|
|
23
|
-
|
|
58
|
+
if command_exists rustc; then
|
|
59
|
+
log_info "Rust is already installed. Version: $(rustc --version)"
|
|
24
60
|
else
|
|
25
|
-
|
|
26
|
-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y || {
|
|
27
|
-
source $HOME/.cargo/env || {
|
|
28
|
-
|
|
61
|
+
log_info "Installing Rust..."
|
|
62
|
+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y || { log_error "Failed to install Rust"; exit 1; }
|
|
63
|
+
source $HOME/.cargo/env || { log_error "Failed to load Rust environment"; exit 1; }
|
|
64
|
+
log_info "Rust version: $(rustc --version)"
|
|
29
65
|
fi
|
|
30
66
|
}
|
|
31
67
|
|
|
32
|
-
#
|
|
33
|
-
|
|
68
|
+
# install_git installs Git if it is not present, using apt/yum on Linux or Homebrew on macOS. It logs the installed version on success and logs an error and exits with a non-zero status if the OS is unsupported or installation fails.
|
|
69
|
+
install_git() {
|
|
70
|
+
if command_exists git; then
|
|
71
|
+
log_info "Git is already installed. Version: $(git --version)"
|
|
72
|
+
else
|
|
73
|
+
log_info "Installing Git..."
|
|
74
|
+
case "$(uname -s)" in
|
|
75
|
+
Linux)
|
|
76
|
+
sudo apt-get update && sudo apt-get install git -y || sudo yum install git -y || { log_error "Failed to install Git"; exit 1; }
|
|
77
|
+
;;
|
|
78
|
+
Darwin)
|
|
79
|
+
if command_exists brew; then
|
|
80
|
+
brew install git || { log_error "Failed to install Git"; exit 1; }
|
|
81
|
+
else
|
|
82
|
+
log_error "Homebrew not found. Please install Git manually: https://git-scm.com/downloads"
|
|
83
|
+
exit 1
|
|
84
|
+
fi
|
|
85
|
+
;;
|
|
86
|
+
*)
|
|
87
|
+
log_error "Unsupported OS. Please install Git manually: https://git-scm.com/downloads"
|
|
88
|
+
exit 1
|
|
89
|
+
;;
|
|
90
|
+
esac
|
|
91
|
+
log_info "Git installed. Version: $(git --version)"
|
|
92
|
+
fi
|
|
93
|
+
}
|
|
34
94
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
95
|
+
# install_buf installs the buf Protocol Buffer CLI tool when it is not already available.
|
|
96
|
+
# On Linux it places a released buf binary into /usr/local/bin; on macOS it uses Homebrew if present.
|
|
97
|
+
install_buf() {
|
|
98
|
+
if command_exists buf; then
|
|
99
|
+
log_info "buf is already installed. Version: $(buf --version)"
|
|
100
|
+
else
|
|
101
|
+
log_info "Installing buf..."
|
|
102
|
+
case "$(uname -s)" in
|
|
103
|
+
Linux)
|
|
104
|
+
# Download and install buf for Linux
|
|
105
|
+
BIN="/usr/local/bin/buf"
|
|
106
|
+
VERSION="1.28.1"
|
|
107
|
+
curl -sSL "https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m)" -o "${BIN}" || { log_error "Failed to download buf"; exit 1; }
|
|
108
|
+
chmod +x "${BIN}" || { log_error "Failed to make buf executable"; exit 1; }
|
|
109
|
+
;;
|
|
110
|
+
Darwin)
|
|
111
|
+
if command_exists brew; then
|
|
112
|
+
brew install bufbuild/buf/buf || { log_error "Failed to install buf"; exit 1; }
|
|
113
|
+
else
|
|
114
|
+
log_error "Homebrew not found. Please install buf manually: https://buf.build/docs/installation"
|
|
115
|
+
exit 1
|
|
116
|
+
fi
|
|
117
|
+
;;
|
|
118
|
+
*)
|
|
119
|
+
log_error "Unsupported OS. Please install buf manually: https://buf.build/docs/installation"
|
|
120
|
+
exit 1
|
|
121
|
+
;;
|
|
122
|
+
esac
|
|
123
|
+
log_info "buf installed. Version: $(buf --version)"
|
|
124
|
+
fi
|
|
125
|
+
}
|
|
38
126
|
|
|
39
|
-
|
|
127
|
+
# install_docker checks whether Docker is installed; logs the installed version and warns if the Docker daemon is not running. If Docker is not found, logs the manual installation URL and notes that Docker is required for the metrics-docs and rpk-docs commands.
|
|
128
|
+
install_docker() {
|
|
129
|
+
if command_exists docker; then
|
|
130
|
+
log_info "Docker is already installed. Version: $(docker --version)"
|
|
131
|
+
# Check if Docker daemon is running
|
|
132
|
+
if ! docker info &>/dev/null; then
|
|
133
|
+
log_warn "Docker is installed but daemon is not running. Please start Docker."
|
|
134
|
+
fi
|
|
135
|
+
else
|
|
136
|
+
log_warn "Docker is not installed. Please install Docker manually: https://docs.docker.com/get-docker/"
|
|
137
|
+
log_warn "Docker is required for: metrics-docs, rpk-docs commands"
|
|
138
|
+
fi
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
# install_make ensures `make` is available, installing build-essential (or Development Tools) on Linux or the Xcode Command Line Tools on macOS, and exits with an error for unsupported OS or failed installation.
|
|
142
|
+
install_make() {
|
|
143
|
+
if command_exists make; then
|
|
144
|
+
log_info "make is already installed. Version: $(make --version | head -1)"
|
|
145
|
+
else
|
|
146
|
+
log_info "Installing make..."
|
|
147
|
+
case "$(uname -s)" in
|
|
148
|
+
Linux)
|
|
149
|
+
sudo apt-get update && sudo apt-get install build-essential -y || sudo yum groupinstall "Development Tools" -y || { log_error "Failed to install make"; exit 1; }
|
|
150
|
+
;;
|
|
151
|
+
Darwin)
|
|
152
|
+
if ! xcode-select -p &>/dev/null; then
|
|
153
|
+
xcode-select --install || { log_error "Failed to install Xcode Command Line Tools"; exit 1; }
|
|
154
|
+
fi
|
|
155
|
+
;;
|
|
156
|
+
*)
|
|
157
|
+
log_error "Unsupported OS. Please install make manually."
|
|
158
|
+
exit 1
|
|
159
|
+
;;
|
|
160
|
+
esac
|
|
161
|
+
log_info "make installed successfully"
|
|
162
|
+
fi
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
# install_python ensures Python3 and pip are available. It logs an existing python/python3 version if present; otherwise installs `python3` and `python3-pip` on Linux (apt-get or yum) or via Homebrew on macOS, and exits with an error for unsupported systems or failed installations.
|
|
166
|
+
install_python() {
|
|
167
|
+
if command_exists python3; then
|
|
168
|
+
log_info "Python3 is already installed. Version: $(python3 --version)"
|
|
169
|
+
elif command_exists python; then
|
|
170
|
+
log_info "Python is already installed. Version: $(python --version)"
|
|
171
|
+
else
|
|
172
|
+
log_info "Installing Python3..."
|
|
173
|
+
case "$(uname -s)" in
|
|
174
|
+
Linux)
|
|
175
|
+
sudo apt-get update && sudo apt-get install python3 python3-pip -y || sudo yum install python3 python3-pip -y || { log_error "Failed to install Python3"; exit 1; }
|
|
176
|
+
;;
|
|
177
|
+
Darwin)
|
|
178
|
+
if command_exists brew; then
|
|
179
|
+
brew install python || { log_error "Failed to install Python3"; exit 1; }
|
|
180
|
+
else
|
|
181
|
+
log_error "Homebrew not found. Please install Python3 manually: https://python.org"
|
|
182
|
+
exit 1
|
|
183
|
+
fi
|
|
184
|
+
;;
|
|
185
|
+
*)
|
|
186
|
+
log_error "Unsupported OS. Please install Python3 manually: https://python.org"
|
|
187
|
+
exit 1
|
|
188
|
+
;;
|
|
189
|
+
esac
|
|
190
|
+
log_info "Python3 installed successfully"
|
|
191
|
+
fi
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
# install_openapi_bundlers ensures an OpenAPI bundler (Redocly CLI or swagger-cli) is available by installing `@redocly/cli` globally and falling back to `swagger-cli` if needed. It exits with a non-zero status if neither bundler can be installed.
|
|
195
|
+
install_openapi_bundlers() {
|
|
196
|
+
local bundler_found=false
|
|
197
|
+
|
|
198
|
+
# Check for swagger-cli
|
|
199
|
+
if command_exists swagger-cli; then
|
|
200
|
+
log_info "swagger-cli is already installed"
|
|
201
|
+
bundler_found=true
|
|
202
|
+
fi
|
|
203
|
+
|
|
204
|
+
# Check for redocly
|
|
205
|
+
if command_exists redocly; then
|
|
206
|
+
log_info "redocly is already installed"
|
|
207
|
+
bundler_found=true
|
|
208
|
+
fi
|
|
209
|
+
|
|
210
|
+
# Check for @redocly/cli via npx
|
|
211
|
+
if npx @redocly/cli --version &>/dev/null; then
|
|
212
|
+
log_info "@redocly/cli is available via npx"
|
|
213
|
+
bundler_found=true
|
|
214
|
+
fi
|
|
215
|
+
|
|
216
|
+
if ! $bundler_found; then
|
|
217
|
+
log_info "Installing @redocly/cli..."
|
|
218
|
+
npm install -g @redocly/cli || {
|
|
219
|
+
log_warn "Failed to install @redocly/cli globally. Installing swagger-cli as fallback..."
|
|
220
|
+
npm install -g swagger-cli || {
|
|
221
|
+
log_error "Failed to install OpenAPI bundler. Please install manually:
|
|
222
|
+
npm install -g @redocly/cli
|
|
223
|
+
or
|
|
224
|
+
npm install -g swagger-cli"
|
|
225
|
+
exit 1
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
fi
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
# install_pandoc ensures pandoc is available on the system, installing it via apt/yum on Linux or Homebrew on macOS, and exits with an error message on failure.
|
|
232
|
+
install_pandoc() {
|
|
233
|
+
if command_exists pandoc; then
|
|
234
|
+
log_info "pandoc is already installed. Version: $(pandoc --version | head -1)"
|
|
235
|
+
else
|
|
236
|
+
log_info "Installing pandoc..."
|
|
237
|
+
case "$(uname -s)" in
|
|
238
|
+
Linux)
|
|
239
|
+
sudo apt-get update && sudo apt-get install pandoc -y || sudo yum install pandoc -y || { log_error "Failed to install pandoc"; exit 1; }
|
|
240
|
+
;;
|
|
241
|
+
Darwin)
|
|
242
|
+
if command_exists brew; then
|
|
243
|
+
brew install pandoc || { log_error "Failed to install pandoc"; exit 1; }
|
|
244
|
+
else
|
|
245
|
+
log_error "Homebrew not found. Please install pandoc manually: https://pandoc.org"
|
|
246
|
+
exit 1
|
|
247
|
+
fi
|
|
248
|
+
;;
|
|
249
|
+
*)
|
|
250
|
+
log_error "Unsupported OS. Please install pandoc manually: https://pandoc.org"
|
|
251
|
+
exit 1
|
|
252
|
+
;;
|
|
253
|
+
esac
|
|
254
|
+
log_info "pandoc installed successfully"
|
|
255
|
+
fi
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
# install_helm_docs checks for helm-docs and, if missing, logs installation instructions and macOS/Homebrew guidance for the helm-spec command.
|
|
259
|
+
install_helm_docs() {
|
|
260
|
+
if command_exists helm-docs; then
|
|
261
|
+
log_info "helm-docs is already installed. Version: $(helm-docs --version)"
|
|
262
|
+
else
|
|
263
|
+
log_warn "helm-docs is not installed. Required for: helm-spec command"
|
|
264
|
+
log_info "Please install manually: https://github.com/norwoodj/helm-docs"
|
|
265
|
+
case "$(uname -s)" in
|
|
266
|
+
Darwin)
|
|
267
|
+
if command_exists brew; then
|
|
268
|
+
log_info "You can install with: brew install norwoodj/tap/helm-docs"
|
|
269
|
+
fi
|
|
270
|
+
;;
|
|
271
|
+
esac
|
|
272
|
+
fi
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
# install_crd_ref_docs checks for the `crd-ref-docs` tool and logs whether it is installed or provides a manual install URL required by the `crd-spec` command.
|
|
276
|
+
install_crd_ref_docs() {
|
|
277
|
+
if command_exists crd-ref-docs; then
|
|
278
|
+
log_info "crd-ref-docs is already installed"
|
|
279
|
+
else
|
|
280
|
+
log_warn "crd-ref-docs is not installed. Required for: crd-spec command"
|
|
281
|
+
log_info "Please install manually: https://github.com/elastic/crd-ref-docs"
|
|
282
|
+
fi
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
# install_go checks whether Go is installed and logs its version; if missing, it logs OS-specific installation guidance and a download URL for use by the crd-spec command.
|
|
286
|
+
install_go() {
|
|
287
|
+
if command_exists go; then
|
|
288
|
+
log_info "Go is already installed. Version: $(go version)"
|
|
289
|
+
else
|
|
290
|
+
log_warn "Go is not installed. Required for: crd-spec command"
|
|
291
|
+
case "$(uname -s)" in
|
|
292
|
+
Linux)
|
|
293
|
+
log_info "You can install with: sudo apt install golang-go (Ubuntu/Debian) or sudo yum install golang (RHEL/CentOS)"
|
|
294
|
+
;;
|
|
295
|
+
Darwin)
|
|
296
|
+
if command_exists brew; then
|
|
297
|
+
log_info "You can install with: brew install go"
|
|
298
|
+
fi
|
|
299
|
+
;;
|
|
300
|
+
esac
|
|
301
|
+
log_info "Or download from: https://golang.org/dl/"
|
|
302
|
+
fi
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
# install_basic_tools ensures `curl` and `tar` are present; installs them on Linux using `apt-get` or `yum`, and on macOS uses Homebrew for `curl` (noting that `tar` is typically preinstalled). Exits with a non-zero status if an attempted automatic installation fails.
|
|
306
|
+
install_basic_tools() {
|
|
307
|
+
if ! command_exists curl; then
|
|
308
|
+
log_info "Installing curl..."
|
|
309
|
+
case "$(uname -s)" in
|
|
310
|
+
Linux)
|
|
311
|
+
sudo apt-get update && sudo apt-get install curl -y || sudo yum install curl -y || { log_error "Failed to install curl"; exit 1; }
|
|
312
|
+
;;
|
|
313
|
+
Darwin)
|
|
314
|
+
if command_exists brew; then
|
|
315
|
+
brew install curl || { log_error "Failed to install curl"; exit 1; }
|
|
316
|
+
fi
|
|
317
|
+
;;
|
|
318
|
+
esac
|
|
319
|
+
else
|
|
320
|
+
log_info "curl is already installed"
|
|
321
|
+
fi
|
|
322
|
+
|
|
323
|
+
if ! command_exists tar; then
|
|
324
|
+
log_info "Installing tar..."
|
|
325
|
+
case "$(uname -s)" in
|
|
326
|
+
Linux)
|
|
327
|
+
sudo apt-get update && sudo apt-get install tar -y || sudo yum install tar -y || { log_error "Failed to install tar"; exit 1; }
|
|
328
|
+
;;
|
|
329
|
+
Darwin)
|
|
330
|
+
log_info "tar is typically pre-installed on macOS"
|
|
331
|
+
;;
|
|
332
|
+
esac
|
|
333
|
+
else
|
|
334
|
+
log_info "tar is already installed"
|
|
335
|
+
fi
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
# ensure_dependencies_installed checks for `expect` and `jq`, installs them if missing, and orchestrates verification and installation of core and optional tooling required by the doc-tools CLI.
|
|
339
|
+
# It runs installers for Node.js, Rust, Git, buf, Docker, make, Python, basic tools, OpenAPI bundlers, pandoc, and optional helpers (helm-docs, crd-ref-docs, Go), and will emit a warning if the Node.js version requirement is not met.
|
|
340
|
+
ensure_dependencies_installed() {
|
|
341
|
+
if ! command_exists expect; then
|
|
342
|
+
log_info "Installing expect..."
|
|
40
343
|
case "$(uname -s)" in
|
|
41
344
|
Linux)
|
|
42
|
-
|
|
43
|
-
sudo apt-get update && sudo apt-get install expect -y || sudo yum install expect -y || { echo "Failed to install expect"; exit 1; }
|
|
345
|
+
sudo apt-get update && sudo apt-get install expect -y || sudo yum install expect -y || { log_error "Failed to install expect"; exit 1; }
|
|
44
346
|
;;
|
|
45
347
|
Darwin)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if ! command -v brew &> /dev/null; then
|
|
49
|
-
echo "Homebrew not found."
|
|
348
|
+
if ! command_exists brew; then
|
|
349
|
+
log_error "Homebrew not found."
|
|
50
350
|
exit 1
|
|
51
351
|
fi
|
|
52
|
-
brew install expect || {
|
|
352
|
+
brew install expect || { log_error "Failed to install expect"; exit 1; }
|
|
53
353
|
;;
|
|
54
354
|
*)
|
|
55
|
-
|
|
355
|
+
log_error "Unsupported operating system. Please install expect manually."
|
|
56
356
|
exit 1
|
|
57
357
|
;;
|
|
58
358
|
esac
|
|
359
|
+
else
|
|
360
|
+
log_info "expect is already installed"
|
|
59
361
|
fi
|
|
60
362
|
|
|
61
|
-
if !
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
# Install jq based on OS
|
|
363
|
+
if ! command_exists jq; then
|
|
364
|
+
log_info "Installing jq..."
|
|
65
365
|
case "$(uname -s)" in
|
|
66
366
|
Linux)
|
|
67
|
-
sudo apt-get install jq -y || sudo yum install jq -y || {
|
|
367
|
+
sudo apt-get update && sudo apt-get install jq -y || sudo yum install jq -y || { log_error "Failed to install jq"; exit 1; }
|
|
68
368
|
;;
|
|
69
369
|
Darwin)
|
|
70
|
-
|
|
370
|
+
if command_exists brew; then
|
|
371
|
+
brew install jq || { log_error "Failed to install jq"; exit 1; }
|
|
372
|
+
else
|
|
373
|
+
log_error "Homebrew not found."
|
|
374
|
+
exit 1
|
|
375
|
+
fi
|
|
71
376
|
;;
|
|
72
377
|
*)
|
|
73
|
-
|
|
378
|
+
log_error "Unsupported operating system. Please install jq manually."
|
|
74
379
|
exit 1
|
|
75
380
|
;;
|
|
76
381
|
esac
|
|
382
|
+
else
|
|
383
|
+
log_info "jq is already installed"
|
|
77
384
|
fi
|
|
78
385
|
|
|
79
|
-
|
|
386
|
+
# Install core dependencies
|
|
387
|
+
local node_ok=true
|
|
388
|
+
install_node || node_ok=false
|
|
80
389
|
install_rust
|
|
390
|
+
install_git
|
|
391
|
+
install_buf
|
|
392
|
+
install_docker
|
|
393
|
+
install_make
|
|
394
|
+
install_python
|
|
395
|
+
install_basic_tools
|
|
396
|
+
install_openapi_bundlers
|
|
397
|
+
install_pandoc
|
|
398
|
+
|
|
399
|
+
# Optional dependencies (warn if missing)
|
|
400
|
+
install_helm_docs
|
|
401
|
+
install_crd_ref_docs
|
|
402
|
+
install_go
|
|
403
|
+
|
|
404
|
+
if [ "$node_ok" = false ]; then
|
|
405
|
+
log_warn "⚠️ Node.js version requirement not met. Some CLI features may not work properly."
|
|
406
|
+
fi
|
|
81
407
|
}
|
|
82
408
|
|
|
83
|
-
# Ensure
|
|
409
|
+
# Ensure all dependencies are installed
|
|
410
|
+
log_info "Installing/checking dependencies for doc-tools CLI commands..."
|
|
84
411
|
ensure_dependencies_installed
|
|
85
412
|
|
|
86
|
-
#
|
|
87
|
-
|
|
88
|
-
if
|
|
89
|
-
|
|
413
|
+
# install_rpk installs Redpanda's rpk CLI into ~/.local/bin by downloading the appropriate release for the current OS and architecture, adding it to PATH for the current and future sessions, and verifying the installation; returns 0 on success and non-zero on failure.
|
|
414
|
+
install_rpk() {
|
|
415
|
+
if command_exists rpk; then
|
|
416
|
+
log_info "rpk is already installed. Version information:"
|
|
90
417
|
rpk --version
|
|
91
418
|
return 0
|
|
419
|
+
fi
|
|
420
|
+
|
|
421
|
+
log_info "Installing rpk..."
|
|
422
|
+
|
|
423
|
+
# Detect OS and architecture
|
|
424
|
+
local os_name=$(uname -s)
|
|
425
|
+
local arch_name=$(uname -m)
|
|
426
|
+
|
|
427
|
+
# Map OS name to rpk release format
|
|
428
|
+
local rpk_os=""
|
|
429
|
+
case "$os_name" in
|
|
430
|
+
"Darwin")
|
|
431
|
+
rpk_os="darwin"
|
|
432
|
+
;;
|
|
433
|
+
"Linux")
|
|
434
|
+
rpk_os="linux"
|
|
435
|
+
;;
|
|
436
|
+
*)
|
|
437
|
+
log_warn "Unsupported operating system: $os_name"
|
|
438
|
+
log_warn "Please install rpk manually:"
|
|
439
|
+
log_warn "https://docs.redpanda.com/current/get-started/rpk-install/"
|
|
440
|
+
return 1
|
|
441
|
+
;;
|
|
442
|
+
esac
|
|
443
|
+
|
|
444
|
+
# Map architecture to rpk release format
|
|
445
|
+
local rpk_arch=""
|
|
446
|
+
case "$arch_name" in
|
|
447
|
+
"x86_64" | "amd64")
|
|
448
|
+
rpk_arch="amd64"
|
|
449
|
+
;;
|
|
450
|
+
"arm64" | "aarch64")
|
|
451
|
+
rpk_arch="arm64"
|
|
452
|
+
;;
|
|
453
|
+
*)
|
|
454
|
+
log_warn "Unsupported architecture: $arch_name"
|
|
455
|
+
log_warn "Please install rpk manually:"
|
|
456
|
+
log_warn "https://docs.redpanda.com/current/get-started/rpk-install/"
|
|
457
|
+
return 1
|
|
458
|
+
;;
|
|
459
|
+
esac
|
|
460
|
+
|
|
461
|
+
# Construct download URL and filename
|
|
462
|
+
local rpk_filename="rpk-${rpk_os}-${rpk_arch}.zip"
|
|
463
|
+
local rpk_url="https://github.com/redpanda-data/redpanda/releases/latest/download/${rpk_filename}"
|
|
464
|
+
|
|
465
|
+
log_info "Detected ${os_name} ${arch_name}, downloading ${rpk_filename}..."
|
|
466
|
+
|
|
467
|
+
# Try to download and install rpk
|
|
468
|
+
if curl -LO "$rpk_url"; then
|
|
469
|
+
if unzip "$rpk_filename" 2>/dev/null; then
|
|
470
|
+
mkdir -p ~/.local/bin
|
|
471
|
+
if mv rpk ~/.local/bin/ 2>/dev/null; then
|
|
472
|
+
rm "$rpk_filename"
|
|
473
|
+
|
|
474
|
+
# Add to PATH for current session
|
|
475
|
+
export PATH=$HOME/.local/bin:$PATH
|
|
476
|
+
|
|
477
|
+
# Add the target directory to PATH for future sessions
|
|
478
|
+
if ! grep -q 'export PATH=$HOME/.local/bin:$PATH' ~/.bashrc 2>/dev/null; then
|
|
479
|
+
echo 'export PATH=$HOME/.local/bin:$PATH' >> ~/.bashrc
|
|
480
|
+
fi
|
|
481
|
+
|
|
482
|
+
# Verify installation
|
|
483
|
+
if command_exists rpk; then
|
|
484
|
+
log_info "rpk has been installed successfully. Version information:"
|
|
485
|
+
rpk --version
|
|
486
|
+
return 0
|
|
487
|
+
else
|
|
488
|
+
log_warn "rpk installation may have failed. Please install manually:"
|
|
489
|
+
log_warn "https://docs.redpanda.com/current/get-started/rpk-install/"
|
|
490
|
+
return 1
|
|
491
|
+
fi
|
|
492
|
+
else
|
|
493
|
+
log_warn "Failed to move rpk binary to ~/.local/bin/"
|
|
494
|
+
rm -f "$rpk_filename" rpk 2>/dev/null
|
|
495
|
+
log_warn "Please install rpk manually:"
|
|
496
|
+
log_warn "https://docs.redpanda.com/current/get-started/rpk-install/"
|
|
497
|
+
return 1
|
|
498
|
+
fi
|
|
499
|
+
else
|
|
500
|
+
log_warn "Failed to unzip $rpk_filename (may not exist for ${rpk_os}-${rpk_arch})"
|
|
501
|
+
rm -f "$rpk_filename" 2>/dev/null
|
|
502
|
+
log_warn "Please install rpk manually:"
|
|
503
|
+
log_warn "https://docs.redpanda.com/current/get-started/rpk-install/"
|
|
504
|
+
return 1
|
|
505
|
+
fi
|
|
92
506
|
else
|
|
507
|
+
log_warn "Failed to download $rpk_url"
|
|
508
|
+
log_warn "Please install rpk manually:"
|
|
509
|
+
log_warn "https://docs.redpanda.com/current/get-started/rpk-install/"
|
|
93
510
|
return 1
|
|
94
511
|
fi
|
|
95
512
|
}
|
|
96
513
|
|
|
97
|
-
#
|
|
98
|
-
|
|
99
|
-
ARCH="$(uname -m)"
|
|
100
|
-
|
|
101
|
-
# Check if rpk is already installed
|
|
102
|
-
if check_rpk_installed; then
|
|
103
|
-
exit 0
|
|
104
|
-
fi
|
|
105
|
-
|
|
106
|
-
# Check if running on macOS and use Homebrew to install rpk
|
|
107
|
-
if [ "${OS}" == "Darwin" ]; then
|
|
108
|
-
echo "Detected macOS. Attempting to install rpk using Homebrew..."
|
|
109
|
-
|
|
110
|
-
# Check if Homebrew is installed
|
|
111
|
-
if ! command -v brew &>/dev/null; then
|
|
112
|
-
echo "Homebrew not found."
|
|
113
|
-
exit 1
|
|
114
|
-
fi
|
|
115
|
-
|
|
116
|
-
# Install rpk
|
|
117
|
-
brew install redpanda-data/tap/redpanda || { echo "Failed to install rpk via Homebrew"; exit 1; }
|
|
118
|
-
|
|
119
|
-
# Verify installation
|
|
120
|
-
echo "rpk has been installed. Version information:"
|
|
121
|
-
rpk --version
|
|
122
|
-
exit 0
|
|
123
|
-
fi
|
|
124
|
-
|
|
125
|
-
# For Linux systems
|
|
126
|
-
if [ "${OS}" == "Linux" ]; then
|
|
127
|
-
FILENAME="rpk-linux-amd64.zip"
|
|
128
|
-
URL_BASE="https://github.com/redpanda-data/redpanda/releases"
|
|
129
|
-
|
|
130
|
-
# Download latest version of rpk
|
|
131
|
-
echo "Downloading ${FILENAME}..."
|
|
132
|
-
curl -Lf --retry 3 -O "${URL_BASE}/latest/download/${FILENAME}" \
|
|
133
|
-
|| { echo "Failed to download rpk"; exit 1; }
|
|
134
|
-
|
|
135
|
-
# Ensure the target directory exists
|
|
136
|
-
mkdir -p $HOME/.local/bin || { echo "Failed to create directory"; exit 1; }
|
|
137
|
-
|
|
138
|
-
# Unzip the rpk binary to the target directory
|
|
139
|
-
unzip -o "${FILENAME}" -d $HOME/.local/bin || { echo "Failed to unzip rpk"; exit 1; }
|
|
140
|
-
|
|
141
|
-
# Remove the downloaded archive
|
|
142
|
-
rm "${FILENAME}" || { echo "Failed to remove downloaded archive"; exit 1; }
|
|
143
|
-
|
|
144
|
-
# Add the target directory to PATH for the current session
|
|
145
|
-
export PATH=$HOME/.local/bin:$PATH
|
|
146
|
-
|
|
147
|
-
# Add the target directory to PATH for future sessions
|
|
148
|
-
echo 'export PATH=$HOME/.local/bin:$PATH' >> ~/.bashrc
|
|
149
|
-
source ~/.bashrc
|
|
150
|
-
|
|
151
|
-
# Verify installation
|
|
152
|
-
echo "rpk has been installed. Version information:"
|
|
153
|
-
rpk --version
|
|
154
|
-
exit 0
|
|
155
|
-
fi
|
|
514
|
+
# Install rpk for rpcn-connector-docs command
|
|
515
|
+
install_rpk
|
|
156
516
|
|
|
157
|
-
|
|
158
|
-
|
|
517
|
+
log_info "✅ All dependencies installation/check completed!"
|
|
518
|
+
log_info ""
|
|
519
|
+
log_info "📋 Summary of installed tools:"
|
|
520
|
+
log_info "Core tools: Node.js (>= v22.20.0), Git, buf, curl, tar, jq, expect"
|
|
521
|
+
log_info "OpenAPI bundlers: @redocly/cli or swagger-cli"
|
|
522
|
+
log_info "Build tools: make, Python3"
|
|
523
|
+
log_info "Optional tools: Docker, pandoc, helm-docs, crd-ref-docs, Go, rpk"
|
|
524
|
+
log_info ""
|
|
525
|
+
log_info "🚀 You can now use all doc-tools CLI commands!"
|
|
526
|
+
log_info "📚 Run 'doc-tools --help' to see available commands"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redpanda-data/docs-extensions-and-macros",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.10.0",
|
|
4
4
|
"description": "Antora extensions and macros developed for Redpanda documentation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antora",
|
|
@@ -21,7 +21,10 @@
|
|
|
21
21
|
"get-console-version": "doc-tools get-console-version",
|
|
22
22
|
"build": "antora --to-dir docs --fetch local-antora-playbook.yml",
|
|
23
23
|
"serve": "wds --node-resolve --open preview/test/ --watch --root-dir docs",
|
|
24
|
-
"test": "jest"
|
|
24
|
+
"test": "jest",
|
|
25
|
+
"bundle:admin": "doc-tools generate bundle-openapi --surface admin",
|
|
26
|
+
"bundle:connect": "doc-tools generate bundle-openapi --surface connect",
|
|
27
|
+
"bundle:both": "doc-tools generate bundle-openapi --surface both"
|
|
25
28
|
},
|
|
26
29
|
"contributors": [
|
|
27
30
|
{
|
|
@@ -78,6 +81,7 @@
|
|
|
78
81
|
},
|
|
79
82
|
"dependencies": {
|
|
80
83
|
"@asciidoctor/tabs": "^1.0.0-beta.6",
|
|
84
|
+
"@bufbuild/buf": "^1.28.1",
|
|
81
85
|
"@octokit/core": "^6.1.2",
|
|
82
86
|
"@octokit/plugin-retry": "^7.1.1",
|
|
83
87
|
"@octokit/rest": "^21.0.1",
|
|
@@ -99,7 +103,9 @@
|
|
|
99
103
|
"sync-request": "^6.1.0",
|
|
100
104
|
"tar": "^7.4.3",
|
|
101
105
|
"tree-sitter": "^0.22.4",
|
|
102
|
-
"yaml": "^2.7.1"
|
|
106
|
+
"yaml": "^2.7.1",
|
|
107
|
+
"yargs": "^17.7.2",
|
|
108
|
+
"@redocly/cli": "^2.2.0"
|
|
103
109
|
},
|
|
104
110
|
"devDependencies": {
|
|
105
111
|
"@antora/cli": "3.1.4",
|