@redpanda-data/docs-extensions-and-macros 3.1.1 → 3.1.3
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.
|
@@ -8,6 +8,7 @@ module.exports.register = function ({ config }) {
|
|
|
8
8
|
const yaml = require('js-yaml');
|
|
9
9
|
const logger = this.getLogger('global-attributes-extension');
|
|
10
10
|
const chalk = require('chalk')
|
|
11
|
+
const _ = require('lodash');
|
|
11
12
|
|
|
12
13
|
this.on('contentAggregated', ({ siteCatalog, contentAggregate }) => {
|
|
13
14
|
let attributeFile;
|
|
@@ -28,4 +29,17 @@ module.exports.register = function ({ config }) {
|
|
|
28
29
|
logger.error(`Error loading attributes: ${error.message}`);
|
|
29
30
|
}
|
|
30
31
|
})
|
|
32
|
+
.on('contentClassified', async ({ siteCatalog,contentCatalog }) => {
|
|
33
|
+
const components = await contentCatalog.getComponents();
|
|
34
|
+
for (let i = 0; i < components.length; i++) {
|
|
35
|
+
let component = components[i];
|
|
36
|
+
if (component.name !== 'ROOT' && component.name !== 'preview') continue
|
|
37
|
+
|
|
38
|
+
component.versions.forEach(({asciidoc}) => {
|
|
39
|
+
if (siteCatalog.attributeFile) {
|
|
40
|
+
asciidoc.attributes = _.merge({}, siteCatalog.attributeFile, asciidoc.attributes);
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
})
|
|
31
45
|
}
|
|
@@ -67,6 +67,7 @@ function register({
|
|
|
67
67
|
|
|
68
68
|
let totalObjectsToUpdate = 0
|
|
69
69
|
let totalObjectsToAdd = 0
|
|
70
|
+
const objectsToDelete = []
|
|
70
71
|
|
|
71
72
|
for (const c of Object.keys(algolia)) {
|
|
72
73
|
for (const v of Object.keys(algolia[c])) {
|
|
@@ -81,6 +82,7 @@ function register({
|
|
|
81
82
|
objectsToUpdate.push(obj)
|
|
82
83
|
totalObjectsToUpdate++
|
|
83
84
|
}
|
|
85
|
+
existingObjectsMap.delete(obj.objectID)
|
|
84
86
|
} else {
|
|
85
87
|
objectsToAdd.push(obj)
|
|
86
88
|
totalObjectsToAdd++
|
|
@@ -111,14 +113,24 @@ function register({
|
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
115
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
for (const [objectID, obj] of existingObjectsMap) {
|
|
117
|
+
if (obj.type === 'Doc' && !obj._tags.includes('apis') || !obj.type) {
|
|
118
|
+
objectsToDelete.push(objectID)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (objectsToDelete.length > 0) {
|
|
122
|
+
console.log(objectsToDelete)
|
|
123
|
+
await index.deleteObjects(objectsToDelete).then(() => {
|
|
124
|
+
console.log(`Deleted ${objectsToDelete.length} outdated records`);
|
|
125
|
+
}).catch(error => {
|
|
126
|
+
logger.error(`Error deleting records from Algolia: ${error.message}`);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
117
129
|
|
|
118
130
|
console.log(chalk.green('Updated records:' + totalObjectsToUpdate))
|
|
119
131
|
console.log(chalk.green('New records:' + totalObjectsToAdd))
|
|
120
132
|
|
|
121
|
-
totalObjectsToAdd === 0 && totalObjectsToUpdate === 0 && console.log(chalk.green('No
|
|
133
|
+
totalObjectsToAdd === 0 && totalObjectsToUpdate === 0 && console.log(chalk.green('No new records uploaded or existing records updated'))
|
|
122
134
|
})
|
|
123
135
|
|
|
124
136
|
process.on('exit', () => {
|
|
@@ -7,7 +7,6 @@ antora:
|
|
|
7
7
|
const GetLatestRedpandaVersion = require('./getLatestRedpandaVersion');
|
|
8
8
|
const GetLatestConsoleVersion = require('./getLatestConsoleVersion');
|
|
9
9
|
const chalk = require('chalk')
|
|
10
|
-
const _ = require('lodash');
|
|
11
10
|
|
|
12
11
|
|
|
13
12
|
module.exports.register = function ({ config }) {
|
|
@@ -32,9 +31,6 @@ module.exports.register = function ({ config }) {
|
|
|
32
31
|
if (component.name !== 'ROOT' && component.name !== 'preview') continue
|
|
33
32
|
|
|
34
33
|
component.versions.forEach(({name, version, asciidoc}) => {
|
|
35
|
-
if (siteCatalog.attributeFile) {
|
|
36
|
-
asciidoc.attributes = _.merge(asciidoc.attributes, siteCatalog.attributeFile);
|
|
37
|
-
}
|
|
38
34
|
if (LatestConsoleVersion) {
|
|
39
35
|
asciidoc.attributes['latest-console-version'] = `${LatestConsoleVersion}`;
|
|
40
36
|
console.log(`${chalk.green('Set Redpanda Console version to')} ${chalk.bold(LatestConsoleVersion)} in ${name} ${version}`);
|