From bb48ac645c685bdff6eda3e80fb7d03977552481 Mon Sep 17 00:00:00 2001 From: Abhishek Gite Date: Tue, 27 Jun 2023 10:50:38 +0100 Subject: [PATCH 1/4] fix: Alphabetized API Structures sidebar --- sidebars.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sidebars.js b/sidebars.js index ddc55e916..d3178d318 100644 --- a/sidebars.js +++ b/sidebars.js @@ -343,17 +343,22 @@ module.exports = { 'latest/api/structures/mouse-wheel-input-event', 'latest/api/structures/notification-action', 'latest/api/structures/notification-response', + 'latest/api/structures/payment-discount', 'latest/api/structures/point', 'latest/api/structures/post-body', 'latest/api/structures/printer-info', 'latest/api/structures/process-memory-info', 'latest/api/structures/process-metric', 'latest/api/structures/product', + 'latest/api/structures/product-discount', + 'latest/api/structures/product-subscription-period', 'latest/api/structures/protocol-request', 'latest/api/structures/protocol-response', 'latest/api/structures/protocol-response-upload-data', 'latest/api/structures/rectangle', 'latest/api/structures/referrer', + 'latest/api/structures/resolved-endpoint', + 'latest/api/structures/resolved-host', 'latest/api/structures/scrubber-item', 'latest/api/structures/segmented-control-segment', 'latest/api/structures/serial-port', @@ -370,15 +375,10 @@ module.exports = { 'latest/api/structures/upload-data', 'latest/api/structures/upload-file', 'latest/api/structures/upload-raw-data', + 'latest/api/structures/usb-device', 'latest/api/structures/user-default-types', 'latest/api/structures/web-request-filter', 'latest/api/structures/web-source', - 'latest/api/structures/payment-discount', - 'latest/api/structures/product-discount', - 'latest/api/structures/product-subscription-period', - 'latest/api/structures/usb-device', - 'latest/api/structures/resolved-endpoint', - 'latest/api/structures/resolved-host', ], }, ], From 317e7819f72a823dbd93257cce59c77f1357292e Mon Sep 17 00:00:00 2001 From: Abhishek Gite Date: Tue, 27 Jun 2023 20:57:12 +0100 Subject: [PATCH 2/4] Added a function to sort api elements in alphabetical order before they are exported --- sidebars.js | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/sidebars.js b/sidebars.js index d3178d318..d45632cb6 100644 --- a/sidebars.js +++ b/sidebars.js @@ -1,4 +1,18 @@ -module.exports = { +// Sort api sidebar elements alphabetically +const sortSidebarElements = (sidebarConfig) => { + Object.keys(sidebarConfig).forEach((key) => { + if (key === 'api') { + sidebarConfig[key].forEach((element) => { + if (element.items && Array.isArray(element.items)) { + element.items.sort(); + } + }); + } + }); + return sidebarConfig; +}; + +module.exports = sortSidebarElements({ docs: [ { type: 'category', @@ -343,43 +357,33 @@ module.exports = { 'latest/api/structures/mouse-wheel-input-event', 'latest/api/structures/notification-action', 'latest/api/structures/notification-response', - 'latest/api/structures/payment-discount', 'latest/api/structures/point', 'latest/api/structures/post-body', 'latest/api/structures/printer-info', 'latest/api/structures/process-memory-info', 'latest/api/structures/process-metric', 'latest/api/structures/product', - 'latest/api/structures/product-discount', - 'latest/api/structures/product-subscription-period', 'latest/api/structures/protocol-request', 'latest/api/structures/protocol-response', 'latest/api/structures/protocol-response-upload-data', 'latest/api/structures/rectangle', 'latest/api/structures/referrer', - 'latest/api/structures/resolved-endpoint', - 'latest/api/structures/resolved-host', 'latest/api/structures/scrubber-item', 'latest/api/structures/segmented-control-segment', 'latest/api/structures/serial-port', - 'latest/api/structures/service-worker-info', - 'latest/api/structures/shared-worker-info', - 'latest/api/structures/sharing-item', - 'latest/api/structures/shortcut-details', - 'latest/api/structures/size', - 'latest/api/structures/task', - 'latest/api/structures/thumbar-button', - 'latest/api/structures/trace-categories-and-options', - 'latest/api/structures/trace-config', - 'latest/api/structures/transaction', 'latest/api/structures/upload-data', 'latest/api/structures/upload-file', 'latest/api/structures/upload-raw-data', - 'latest/api/structures/usb-device', 'latest/api/structures/user-default-types', 'latest/api/structures/web-request-filter', 'latest/api/structures/web-source', + 'latest/api/structures/payment-discount', + 'latest/api/structures/product-discount', + 'latest/api/structures/product-subscription-period', + 'latest/api/structures/usb-device', + 'latest/api/structures/resolved-endpoint', + 'latest/api/structures/resolved-host', ], }, ], -}; +}); From 7e488277e12c2bd6c0474993a4c574c3abf3e513 Mon Sep 17 00:00:00 2001 From: Abhishek Gite Date: Tue, 27 Jun 2023 21:02:30 +0100 Subject: [PATCH 3/4] Retrieve the changes to thhe items array for label API Structures --- sidebars.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sidebars.js b/sidebars.js index d45632cb6..f85844174 100644 --- a/sidebars.js +++ b/sidebars.js @@ -371,6 +371,16 @@ module.exports = sortSidebarElements({ 'latest/api/structures/scrubber-item', 'latest/api/structures/segmented-control-segment', 'latest/api/structures/serial-port', + 'latest/api/structures/service-worker-info', + 'latest/api/structures/shared-worker-info', + 'latest/api/structures/sharing-item', + 'latest/api/structures/shortcut-details', + 'latest/api/structures/size', + 'latest/api/structures/task', + 'latest/api/structures/thumbar-button', + 'latest/api/structures/trace-categories-and-options', + 'latest/api/structures/trace-config', + 'latest/api/structures/transaction', 'latest/api/structures/upload-data', 'latest/api/structures/upload-file', 'latest/api/structures/upload-raw-data', From bd4c1038c04b4a6def8acf448081bc120c1ca2e9 Mon Sep 17 00:00:00 2001 From: Abhishek Gite Date: Thu, 29 Jun 2023 19:52:18 +0100 Subject: [PATCH 4/4] Reverted back the changes from sidebar.js file and ran yarn pre-build which sorted API Structures alphabetically --- sidebars.js | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/sidebars.js b/sidebars.js index f85844174..d3178d318 100644 --- a/sidebars.js +++ b/sidebars.js @@ -1,18 +1,4 @@ -// Sort api sidebar elements alphabetically -const sortSidebarElements = (sidebarConfig) => { - Object.keys(sidebarConfig).forEach((key) => { - if (key === 'api') { - sidebarConfig[key].forEach((element) => { - if (element.items && Array.isArray(element.items)) { - element.items.sort(); - } - }); - } - }); - return sidebarConfig; -}; - -module.exports = sortSidebarElements({ +module.exports = { docs: [ { type: 'category', @@ -357,17 +343,22 @@ module.exports = sortSidebarElements({ 'latest/api/structures/mouse-wheel-input-event', 'latest/api/structures/notification-action', 'latest/api/structures/notification-response', + 'latest/api/structures/payment-discount', 'latest/api/structures/point', 'latest/api/structures/post-body', 'latest/api/structures/printer-info', 'latest/api/structures/process-memory-info', 'latest/api/structures/process-metric', 'latest/api/structures/product', + 'latest/api/structures/product-discount', + 'latest/api/structures/product-subscription-period', 'latest/api/structures/protocol-request', 'latest/api/structures/protocol-response', 'latest/api/structures/protocol-response-upload-data', 'latest/api/structures/rectangle', 'latest/api/structures/referrer', + 'latest/api/structures/resolved-endpoint', + 'latest/api/structures/resolved-host', 'latest/api/structures/scrubber-item', 'latest/api/structures/segmented-control-segment', 'latest/api/structures/serial-port', @@ -384,16 +375,11 @@ module.exports = sortSidebarElements({ 'latest/api/structures/upload-data', 'latest/api/structures/upload-file', 'latest/api/structures/upload-raw-data', + 'latest/api/structures/usb-device', 'latest/api/structures/user-default-types', 'latest/api/structures/web-request-filter', 'latest/api/structures/web-source', - 'latest/api/structures/payment-discount', - 'latest/api/structures/product-discount', - 'latest/api/structures/product-subscription-period', - 'latest/api/structures/usb-device', - 'latest/api/structures/resolved-endpoint', - 'latest/api/structures/resolved-host', ], }, ], -}); +};