@@ -6,14 +6,15 @@ import { markdownTable } from "markdown-table";
6
6
const discourseGithubRepoBase =
7
7
"https://github.com/discourse/discourse/blob/main" ;
8
8
const emptyValuePlaceholder = "-" ;
9
+ const miscEventGroup = "other events" ;
9
10
10
11
function extractEventGroup ( eventId ) {
11
12
if ( eventId . startsWith ( "LIGHTBOX" ) ) {
12
13
return "lightbox" ;
13
14
} else if ( eventId . startsWith ( "this.composerEventPrefix" ) ) {
14
15
return "composer" ;
15
16
} else if ( eventId . split ( ":" ) . length === 1 ) {
16
- return "other events" ;
17
+ return miscEventGroup ;
17
18
}
18
19
return eventId . split ( ":" ) [ 0 ] ;
19
20
}
@@ -29,6 +30,7 @@ function createDocumentationForEventGroup(eventGroup, details) {
29
30
return (
30
31
markdown +
31
32
Object . entries ( detailsByEventId )
33
+ . sort ( ( [ a ] , [ b ] ) => a . localeCompare ( b ) )
32
34
. map ( ( [ eventId , appEvents ] ) => {
33
35
return createDocumentationForAppEvent ( eventId , appEvents ) ;
34
36
} )
@@ -134,14 +136,14 @@ function consolidateAppEventCalls(appEventCalls) {
134
136
135
137
// Add to count map that will be used to determine isAlwaysPresent later for the arg
136
138
argCountMap [ position ] ||= 0 ;
137
- argCountMap [ position ] ++ ;
139
+ argCountMap [ position ] ++ ;
138
140
139
141
if ( arg . argType === "object" ) {
140
142
arg . argValue . forEach ( ( nestedArg ) => {
141
143
const key = `objectArg${ position } .${ nestedArg . key } ` ;
142
144
// argCountMap[key] += 1;
143
145
argCountMap [ key ] ||= 0 ;
144
- argCountMap [ key ] ++ ;
146
+ argCountMap [ key ] ++ ;
145
147
} ) ;
146
148
}
147
149
} ) ;
@@ -262,6 +264,14 @@ function createDetailsDocumentation(appEvent, headingLevel = 5) {
262
264
} , { } ) ;
263
265
264
266
const docs = Object . keys ( groupedByEventGroup )
267
+ . sort ( ( a , b ) => {
268
+ if ( a === miscEventGroup ) {
269
+ return 1 ;
270
+ } else if ( b === miscEventGroup ) {
271
+ return - 1 ;
272
+ }
273
+ return a . localeCompare ( b ) ;
274
+ } )
265
275
. map ( ( eventGroup ) => {
266
276
return createDocumentationForEventGroup (
267
277
eventGroup ,
0 commit comments