@redpanda-data/docs-extensions-and-macros 4.10.2 ā 4.10.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.
- package/bin/doc-tools.js +92 -99
- package/package.json +1 -1
- package/tools/property-extractor/compare-properties.js +4 -4
- package/tools/property-extractor/generate-handlebars-docs.js +131 -441
- package/tools/property-extractor/helpers/anchorName.js +7 -0
- package/tools/property-extractor/helpers/index.js +1 -0
- package/tools/property-extractor/property_extractor.py +69 -6
- package/tools/property-extractor/templates/deprecated-property.hbs +1 -7
- package/tools/property-extractor/templates/property.hbs +54 -20
- package/tools/property-extractor/templates/topic-property-mappings.hbs +13 -0
- package/tools/property-extractor/templates/topic-property.hbs +41 -6
- package/tools/property-extractor/templates/property-cloud.hbs +0 -104
- package/tools/property-extractor/templates/property-page-with-includes.hbs +0 -17
- package/tools/property-extractor/templates/property-page.hbs +0 -22
- package/tools/property-extractor/templates/topic-property-cloud.hbs +0 -97
package/bin/doc-tools.js
CHANGED
|
@@ -502,11 +502,11 @@ function generatePropertyComparisonReport(oldTag, newTag, outputDir) {
|
|
|
502
502
|
try {
|
|
503
503
|
console.log(`\nš Generating detailed property comparison report...`);
|
|
504
504
|
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
505
|
+
// Look for the property JSON files in outputDir/examples
|
|
506
|
+
const repoRoot = findRepoRoot();
|
|
507
|
+
const examplesDir = path.join(repoRoot, outputDir, 'examples');
|
|
508
|
+
const oldJsonPath = path.join(examplesDir, `${oldTag}-properties.json`);
|
|
509
|
+
const newJsonPath = path.join(examplesDir, `${newTag}-properties.json`);
|
|
510
510
|
|
|
511
511
|
// Check if JSON files exist
|
|
512
512
|
if (!fs.existsSync(oldJsonPath)) {
|
|
@@ -1031,28 +1031,31 @@ automation
|
|
|
1031
1031
|
});
|
|
1032
1032
|
|
|
1033
1033
|
automation
|
|
1034
|
-
|
|
1035
|
-
.description(
|
|
1034
|
+
.command('property-docs')
|
|
1035
|
+
.description(
|
|
1036
|
+
'Generate JSON and consolidated AsciiDoc partials for Redpanda configuration properties. ' +
|
|
1037
|
+
'By default, only extracts properties to JSON. Use --generate-partials to create consolidated ' +
|
|
1038
|
+
'AsciiDoc partials (including deprecated properties).'
|
|
1039
|
+
)
|
|
1036
1040
|
.option('--tag <tag>', 'Git tag or branch to extract from', 'dev')
|
|
1037
1041
|
.option('--diff <oldTag>', 'Also diff autogenerated properties from <oldTag> to <tag>')
|
|
1038
1042
|
.option('--overrides <path>', 'Optional JSON file with property description overrides')
|
|
1039
1043
|
.option('--output-dir <dir>', 'Where to write all generated files', 'modules/reference')
|
|
1040
1044
|
.option('--cloud-support', 'Add AsciiDoc tags to generated property docs to indicate which ones are supported in Redpanda Cloud. This data is fetched from the cloudv2 repository so requires a GitHub token with repo permissions. Set the token as an environment variable using GITHUB_TOKEN, GH_TOKEN, or REDPANDA_GITHUB_TOKEN')
|
|
1041
|
-
.option('--template-property-page <path>', 'Custom Handlebars template for property page layout')
|
|
1042
1045
|
.option('--template-property <path>', 'Custom Handlebars template for individual property sections')
|
|
1043
1046
|
.option('--template-topic-property <path>', 'Custom Handlebars template for individual topic property sections')
|
|
1047
|
+
.option('--template-topic-property-mappings <path>', 'Custom Handlebars template for topic property mappings table')
|
|
1044
1048
|
.option('--template-deprecated <path>', 'Custom Handlebars template for deprecated properties page')
|
|
1045
1049
|
.option('--template-deprecated-property <path>', 'Custom Handlebars template for individual deprecated property sections')
|
|
1046
1050
|
.option('--generate-partials', 'Generate consolidated property partials (cluster-properties.adoc, topic-properties.adoc, etc.) in the partials directory')
|
|
1047
1051
|
.option('--partials-dir <path>', 'Directory for property partials (relative to output-dir)', 'partials')
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
verifyPropertyDependencies();
|
|
1052
|
+
.action((options) => {
|
|
1053
|
+
verifyPropertyDependencies();
|
|
1051
1054
|
|
|
1052
1055
|
// Validate cloud support dependencies if requested
|
|
1053
1056
|
if (options.cloudSupport) {
|
|
1054
1057
|
console.log('š Validating cloud support dependencies...');
|
|
1055
|
-
|
|
1058
|
+
|
|
1056
1059
|
// Check for GITHUB_TOKEN, GH_TOKEN, or REDPANDA_GITHUB_TOKEN
|
|
1057
1060
|
const token = process.env.GITHUB_TOKEN || process.env.GH_TOKEN || process.env.REDPANDA_GITHUB_TOKEN;
|
|
1058
1061
|
if (!token) {
|
|
@@ -1065,7 +1068,7 @@ automation
|
|
|
1065
1068
|
console.error(' Or: export REDPANDA_GITHUB_TOKEN=your_token_here');
|
|
1066
1069
|
process.exit(1);
|
|
1067
1070
|
}
|
|
1068
|
-
|
|
1071
|
+
|
|
1069
1072
|
console.log('š¦ Cloud support enabled - Python dependencies will be validated during execution');
|
|
1070
1073
|
if (process.env.VIRTUAL_ENV) {
|
|
1071
1074
|
console.log(` Using virtual environment: ${process.env.VIRTUAL_ENV}`);
|
|
@@ -1074,97 +1077,87 @@ automation
|
|
|
1074
1077
|
console.log('ā
GitHub token validated');
|
|
1075
1078
|
}
|
|
1076
1079
|
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
// Set property files to go to properties subdirectory
|
|
1119
|
-
env.OUTPUT_ASCIIDOC_DIR = path.resolve(outputDir, 'pages', 'properties');
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1122
|
-
// Set partials generation options
|
|
1123
|
-
if (options.generatePartials) {
|
|
1124
|
-
env.GENERATE_PARTIALS = '1';
|
|
1125
|
-
env.OUTPUT_PARTIALS_DIR = path.resolve(outputDir, options.partialsDir || 'partials');
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1128
|
-
// Set page generation options
|
|
1129
|
-
if (options.generatePages) {
|
|
1130
|
-
env.GENERATE_PAGES = '1';
|
|
1131
|
-
if (templates.propertyPage) {
|
|
1132
|
-
env.TEMPLATE_PROPERTY_PAGE_WITH_INCLUDES = env.TEMPLATE_PROPERTY_PAGE;
|
|
1080
|
+
const newTag = options.tag;
|
|
1081
|
+
const oldTag = options.diff;
|
|
1082
|
+
const overridesPath = options.overrides;
|
|
1083
|
+
const outputDir = options.outputDir;
|
|
1084
|
+
const cwd = path.resolve(__dirname, '../tools/property-extractor');
|
|
1085
|
+
|
|
1086
|
+
const make = (tag, overrides, templates = {}, outDir = 'modules/reference/', tempDir = null) => {
|
|
1087
|
+
console.log(`ā³ Building property docs for ${tag}${tempDir ? ' (for diff)' : ''}ā¦`);
|
|
1088
|
+
const args = ['build', `TAG=${tag}`];
|
|
1089
|
+
|
|
1090
|
+
// Pass all paths as environment variables for consistency
|
|
1091
|
+
const env = { ...process.env };
|
|
1092
|
+
|
|
1093
|
+
if (overrides) {
|
|
1094
|
+
env.OVERRIDES = path.resolve(overrides);
|
|
1095
|
+
}
|
|
1096
|
+
if (options.cloudSupport) {
|
|
1097
|
+
env.CLOUD_SUPPORT = '1';
|
|
1098
|
+
}
|
|
1099
|
+
if (templates.property) {
|
|
1100
|
+
env.TEMPLATE_PROPERTY = path.resolve(templates.property);
|
|
1101
|
+
}
|
|
1102
|
+
if (templates.topicProperty) {
|
|
1103
|
+
env.TEMPLATE_TOPIC_PROPERTY = path.resolve(templates.topicProperty);
|
|
1104
|
+
}
|
|
1105
|
+
if (templates.topicPropertyMappings) {
|
|
1106
|
+
env.TEMPLATE_TOPIC_PROPERTY_MAPPINGS = path.resolve(templates.topicPropertyMappings);
|
|
1107
|
+
}
|
|
1108
|
+
if (templates.deprecated) {
|
|
1109
|
+
env.TEMPLATE_DEPRECATED = path.resolve(templates.deprecated);
|
|
1110
|
+
}
|
|
1111
|
+
if (templates.deprecatedProperty) {
|
|
1112
|
+
env.TEMPLATE_DEPRECATED_PROPERTY = path.resolve(templates.deprecatedProperty);
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
if (tempDir) {
|
|
1116
|
+
env.OUTPUT_JSON_DIR = path.resolve(tempDir, 'examples');
|
|
1117
|
+
env.OUTPUT_AUTOGENERATED_DIR = path.resolve(tempDir);
|
|
1118
|
+
} else {
|
|
1119
|
+
env.OUTPUT_JSON_DIR = path.resolve(outDir, 'examples');
|
|
1120
|
+
env.OUTPUT_AUTOGENERATED_DIR = path.resolve(outDir);
|
|
1133
1121
|
}
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
const r = spawnSync('make', args, { cwd, stdio: 'inherit', env });
|
|
1137
|
-
if (r.error) {
|
|
1138
|
-
console.error(`ā ${r.error.message}`);
|
|
1139
|
-
process.exit(1);
|
|
1140
|
-
}
|
|
1141
|
-
if (r.status !== 0) process.exit(r.status);
|
|
1142
|
-
};
|
|
1143
1122
|
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
deprecated: options.templateDeprecated,
|
|
1150
|
-
deprecatedProperty: options.templateDeprecatedProperty
|
|
1151
|
-
};
|
|
1123
|
+
// Partials generation options
|
|
1124
|
+
if (options.generatePartials) {
|
|
1125
|
+
env.GENERATE_PARTIALS = '1';
|
|
1126
|
+
env.OUTPUT_PARTIALS_DIR = path.resolve(outDir, options.partialsDir || 'partials');
|
|
1127
|
+
}
|
|
1152
1128
|
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1129
|
+
const r = spawnSync('make', args, { cwd, stdio: 'inherit', env });
|
|
1130
|
+
if (r.error) {
|
|
1131
|
+
console.error(`ā ${r.error.message}`);
|
|
1132
|
+
process.exit(1);
|
|
1133
|
+
}
|
|
1134
|
+
if (r.status !== 0) process.exit(r.status);
|
|
1135
|
+
};
|
|
1136
|
+
|
|
1137
|
+
// Collect template options
|
|
1138
|
+
const templates = {
|
|
1139
|
+
property: options.templateProperty,
|
|
1140
|
+
topicProperty: options.templateTopicProperty,
|
|
1141
|
+
topicPropertyMappings: options.templateTopicPropertyMappings,
|
|
1142
|
+
deprecated: options.templateDeprecated,
|
|
1143
|
+
deprecatedProperty: options.templateDeprecatedProperty,
|
|
1144
|
+
};
|
|
1145
|
+
|
|
1146
|
+
if (oldTag) {
|
|
1147
|
+
// Build old version first so its JSON exists for the diff step
|
|
1148
|
+
make(oldTag, overridesPath, templates, outputDir, null);
|
|
1149
|
+
}
|
|
1157
1150
|
|
|
1158
|
-
|
|
1159
|
-
|
|
1151
|
+
// Build new version
|
|
1152
|
+
make(newTag, overridesPath, templates, outputDir, null);
|
|
1160
1153
|
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1154
|
+
if (oldTag) {
|
|
1155
|
+
// Generate property comparison report using the JSON now in outputDir/examples
|
|
1156
|
+
generatePropertyComparisonReport(oldTag, newTag, outputDir);
|
|
1157
|
+
}
|
|
1165
1158
|
|
|
1166
|
-
|
|
1167
|
-
|
|
1159
|
+
process.exit(0);
|
|
1160
|
+
});
|
|
1168
1161
|
|
|
1169
1162
|
automation
|
|
1170
1163
|
.command('rpk-docs')
|
|
@@ -1563,7 +1556,7 @@ automation
|
|
|
1563
1556
|
automation
|
|
1564
1557
|
.command('bundle-openapi')
|
|
1565
1558
|
.description('Bundle Redpanda OpenAPI fragments for admin and connect APIs into complete OpenAPI 3.1 documents')
|
|
1566
|
-
.requiredOption('-t, --tag <tag>', '
|
|
1559
|
+
.requiredOption('-t, --tag <tag>', 'Branch or tag to clone from the repository (for example v24.3.2 or 24.3.2 or dev)')
|
|
1567
1560
|
.option('--repo <url>', 'Repository URL', 'https://github.com/redpanda-data/redpanda.git')
|
|
1568
1561
|
.addOption(new Option('-s, --surface <surface>', 'Which API surface(s) to bundle').choices(['admin', 'connect', 'both']).makeOptionMandatory())
|
|
1569
1562
|
.option('--out-admin <path>', 'Output path for admin API', 'admin/redpanda-admin-api.yaml')
|
package/package.json
CHANGED
|
@@ -148,7 +148,7 @@ function compareProperties(oldData, newData, oldVersion, newVersion) {
|
|
|
148
148
|
name,
|
|
149
149
|
type: prop.type,
|
|
150
150
|
default: prop.default,
|
|
151
|
-
description: prop.description
|
|
151
|
+
description: prop.description || 'No description'
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
154
|
}
|
|
@@ -185,8 +185,8 @@ function compareProperties(oldData, newData, oldVersion, newVersion) {
|
|
|
185
185
|
if (oldProp.description !== newProp.description) {
|
|
186
186
|
report.changedDescriptions.push({
|
|
187
187
|
name,
|
|
188
|
-
oldDescription: oldProp.description
|
|
189
|
-
newDescription: newProp.description
|
|
188
|
+
oldDescription: oldProp.description || 'No description',
|
|
189
|
+
newDescription: newProp.description || 'No description'
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
192
|
|
|
@@ -203,7 +203,7 @@ function compareProperties(oldData, newData, oldVersion, newVersion) {
|
|
|
203
203
|
report.removedProperties.push({
|
|
204
204
|
name,
|
|
205
205
|
type: oldProp.type,
|
|
206
|
-
description: oldProp.description
|
|
206
|
+
description: oldProp.description || 'No description'
|
|
207
207
|
});
|
|
208
208
|
}
|
|
209
209
|
}
|