@redpanda-data/docs-extensions-and-macros 4.12.2 โ†’ 4.12.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.
@@ -27,7 +27,10 @@ TREE_SITTER := npx tree-sitter
27
27
  # Output directory configuration (can be overridden by environment variables)
28
28
  OUTPUT_AUTOGENERATED_DIR ?= $(REPO_ROOT)/modules/reference
29
29
  OUTPUT_ASCIIDOC_DIR ?= $(OUTPUT_AUTOGENERATED_DIR)/pages
30
- OUTPUT_JSON_DIR ?= $(OUTPUT_AUTOGENERATED_DIR)/examples
30
+ # Always save versioned JSON files to attachments directory
31
+ OUTPUT_JSON_DIR ?= $(OUTPUT_AUTOGENERATED_DIR)/attachments
32
+ # Diff JSON files are saved to overrides directory (if OVERRIDES is specified)
33
+ OUTPUT_DIFF_DIR ?= $(if $(OVERRIDES),$(or $(dir $(OVERRIDES)),$(OUTPUT_AUTOGENERATED_DIR)/attachments),$(OUTPUT_AUTOGENERATED_DIR)/attachments)
31
34
  OUTPUT_PARTIALS_DIR ?= $(OUTPUT_AUTOGENERATED_DIR)/partials
32
35
 
33
36
  # --- Main build: venv, fetch code, build parser, extract & docgen ---
@@ -61,7 +64,7 @@ venv: $(TOOL_ROOT)/requirements.txt
61
64
  fi; \
62
65
  echo "๐Ÿ”„ Upgrading pip and installing requirements..."; \
63
66
  $(VENV)/bin/pip install --upgrade pip --quiet; \
64
- $(VENV)/bin/pip install --no-cache-dir -r $<;
67
+ $(VENV)/bin/pip install --no-cache-dir -r $< --quiet;
65
68
 
66
69
  # --- Clean out all generated state ---
67
70
  clean:
@@ -120,20 +123,70 @@ generate-docs: node-deps
120
123
  @echo "๐Ÿ“„ Copying properties JSON files to $(OUTPUT_JSON_DIR)โ€ฆ"
121
124
  @if [ -f "$(TOOL_ROOT)/gen/$(TAG)-properties.json" ]; then \
122
125
  echo " Source: $(TOOL_ROOT)/gen/$(TAG)-properties.json"; \
123
- echo " Target: $(OUTPUT_JSON_DIR)/$(TAG)-properties.json"; \
124
- cp "$(TOOL_ROOT)/gen/$(TAG)-properties.json" "$(OUTPUT_JSON_DIR)/" && \
125
- echo " โœ… Successfully copied $(TAG)-properties.json" || \
126
- { echo " โŒ Failed to copy $(TAG)-properties.json"; exit 1; }; \
127
- if [ -f "$(OUTPUT_JSON_DIR)/$(TAG)-properties.json" ]; then \
128
- echo " ๐Ÿ“Š Verification: Target file exists and has $$(wc -c < "$(OUTPUT_JSON_DIR)/$(TAG)-properties.json") bytes"; \
126
+ echo " Target: $(OUTPUT_JSON_DIR)/redpanda-properties-$(TAG).json"; \
127
+ cp "$(TOOL_ROOT)/gen/$(TAG)-properties.json" "$(OUTPUT_JSON_DIR)/redpanda-properties-$(TAG).json" && \
128
+ echo " โœ… Successfully copied redpanda-properties-$(TAG).json" || \
129
+ { echo " โŒ Failed to copy redpanda-properties-$(TAG).json"; exit 1; }; \
130
+ if [ -f "$(OUTPUT_JSON_DIR)/redpanda-properties-$(TAG).json" ]; then \
131
+ echo " ๐Ÿ“Š Verification: Target file exists and has $$(wc -c < "$(OUTPUT_JSON_DIR)/redpanda-properties-$(TAG).json") bytes"; \
129
132
  else \
130
133
  echo " โŒ Verification failed: Target file does not exist"; exit 1; \
131
134
  fi; \
132
135
  else \
133
136
  echo " โš ๏ธ Source file $(TOOL_ROOT)/gen/$(TAG)-properties.json not found, skipping copy"; \
134
137
  fi
138
+ @echo "๐Ÿงน Cleaning up old versioned JSON files (keeping only 2 most recent)โ€ฆ"
139
+ @cd "$(OUTPUT_JSON_DIR)" && \
140
+ ls -t redpanda-properties-*.json 2>/dev/null | tail -n +3 | while read file; do \
141
+ echo " Removing old file: $$file"; \
142
+ rm -f "$$file"; \
143
+ done || true
135
144
  @echo "โœ… Docs generated at $(OUTPUT_AUTOGENERATED_DIR)"
136
145
 
146
+ # --- Compare two property files and generate a diff report ---
147
+ # Usage: make compare OLD_TAG=v25.2.1 NEW_TAG=v25.2.9 OVERRIDES=path/to/overrides.json
148
+ # This will compare the two versions and save the diff to the overrides directory
149
+ compare:
150
+ @if [ -z "$(OLD_TAG)" ] || [ -z "$(NEW_TAG)" ]; then \
151
+ echo "โŒ Error: Both OLD_TAG and NEW_TAG must be specified"; \
152
+ echo " Usage: make compare OLD_TAG=v25.2.1 NEW_TAG=v25.2.9 OVERRIDES=path/to/overrides.json"; \
153
+ exit 1; \
154
+ fi
155
+ @if [ -z "$(OVERRIDES)" ]; then \
156
+ echo "โŒ Error: OVERRIDES must be specified to determine where to save the diff"; \
157
+ echo " Usage: make compare OLD_TAG=v25.2.1 NEW_TAG=v25.2.9 OVERRIDES=path/to/overrides.json"; \
158
+ exit 1; \
159
+ fi
160
+ @if [ ! -f "$(OUTPUT_JSON_DIR)/redpanda-properties-$(OLD_TAG).json" ]; then \
161
+ echo "โŒ Error: Old properties file not found: $(OUTPUT_JSON_DIR)/redpanda-properties-$(OLD_TAG).json"; \
162
+ exit 1; \
163
+ fi
164
+ @if [ ! -f "$(OUTPUT_JSON_DIR)/redpanda-properties-$(NEW_TAG).json" ]; then \
165
+ echo "โŒ Error: New properties file not found: $(OUTPUT_JSON_DIR)/redpanda-properties-$(NEW_TAG).json"; \
166
+ exit 1; \
167
+ fi
168
+ @echo "Comparing $(OLD_TAG) โ†’ $(NEW_TAG)"
169
+ @echo " Diff will be saved to: $(OUTPUT_DIFF_DIR)"
170
+ @cd $(TOOL_ROOT) && \
171
+ node compare-properties.js \
172
+ "$(OUTPUT_JSON_DIR)/redpanda-properties-$(OLD_TAG).json" \
173
+ "$(OUTPUT_JSON_DIR)/redpanda-properties-$(NEW_TAG).json" \
174
+ $(OLD_TAG) \
175
+ $(NEW_TAG) \
176
+ "$(OUTPUT_DIFF_DIR)" \
177
+ "redpanda-property-changes-$(OLD_TAG)-to-$(NEW_TAG).json"
178
+ @echo "โœ… Diff saved to $(OUTPUT_DIFF_DIR)/redpanda-property-changes-$(OLD_TAG)-to-$(NEW_TAG).json"
179
+ @$(MAKE) cleanup-diffs OVERRIDES="$(OVERRIDES)"
180
+
181
+ # --- Helper target to cleanup old diff files ---
182
+ cleanup-diffs:
183
+ @echo "๐Ÿงน Cleaning up old diff JSON files (keeping only 2 most recent)โ€ฆ"
184
+ @cd "$(OUTPUT_DIFF_DIR)" && \
185
+ ls -t redpanda-property-changes-*.json 2>/dev/null | tail -n +3 | while read file; do \
186
+ echo " Removing old file: $$file"; \
187
+ rm -f "$$file"; \
188
+ done || true
189
+
137
190
  # --- Debug helper to print all the key paths/vars ---
138
191
  check:
139
192
  @echo "MODULE_ROOT: $(MODULE_ROOT)"
@@ -142,6 +195,8 @@ check:
142
195
  @echo "TREESITTER: $(TREESITTER_DIR)"
143
196
  @echo "VENV: $(VENV)"
144
197
  @echo "PYTHON: $(PYTHON)"
198
+ @echo "OVERRIDES: $(OVERRIDES)"
145
199
  @echo "OUTPUT_ASCIIDOC_DIR: $(OUTPUT_ASCIIDOC_DIR)"
146
200
  @echo "OUTPUT_JSON_DIR: $(OUTPUT_JSON_DIR)"
201
+ @echo "OUTPUT_DIFF_DIR: $(OUTPUT_DIFF_DIR)"
147
202
  @echo "OUTPUT_AUTOGENERATED_DIR: $(OUTPUT_AUTOGENERATED_DIR)"