@kbn/telemetry-tools ensures alphabetical order (#140970)

This commit is contained in:
Alejandro Fernández Haro 2022-09-19 18:32:23 +02:00 committed by GitHub
parent a9bcb41377
commit 299ff11fc9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3696 additions and 3690 deletions

View file

@ -15,6 +15,12 @@ export function writeToFileTask({ roots }: TaskContext) {
task: async () => {
const fullPath = path.resolve(process.cwd(), root.config.output);
if (root.mapping && Object.keys(root.mapping.properties).length > 0) {
// Sort first-level properties alphabetically
root.mapping.properties = Object.fromEntries(
Object.entries(root.mapping.properties).sort(([a], [b]) => {
return a > b ? 1 : -1;
})
);
const serializedMapping = JSON.stringify(root.mapping, null, 2).concat('\n');
await writeFileAsync(fullPath, serializedMapping);
}

File diff suppressed because it is too large Load diff