@@ -216,7 +216,12 @@ async function update() {
216216 const m = pattern . exec ( issue . body ) ;
217217
218218 if ( m ) {
219- const id = m [ 1 ] ;
219+ let id = m [ 1 ] ;
220+ // If the feature has been moved, change the ID to the new ID so that this
221+ // issue will be found when iterating all features.
222+ if ( features [ id ] ?. kind === "moved" ) {
223+ id = features [ id ] . redirect_target ;
224+ }
220225 if ( openIssues . has ( id ) ) {
221226 throw new Error (
222227 `Multiple issues for ${ id } : ${ openIssues . get ( id ) . html_url } and ${ issue . html_url } ` ,
@@ -230,6 +235,22 @@ async function update() {
230235 // dates as tie breakers. Features that aren't shipped in any browser come last.
231236 const sortKeys = new Map < string , string > ( ) ;
232237 for ( const [ id , data ] of Object . entries ( features ) ) {
238+ switch ( data . kind ) {
239+ case "feature" :
240+ // Normal feature, handled below.
241+ break ;
242+ case "moved" :
243+ // Moves are handled when populating the openIssues map.
244+ continue ;
245+ case "split" :
246+ // TODO: Handle split features. The new features will be automatically
247+ // created, but we should close the original feature with a comment
248+ // pointing to the new ones.
249+ continue ;
250+ default :
251+ throw new Error ( `Unknown feature kind: ${ data . kind } ` ) ;
252+ }
253+
233254 const dates : string [ ] = [ ] ;
234255 for ( const [ browser , version ] of Object . entries ( data . status . support ) ) {
235256 const v = version . replace ( "≤" , "" ) ;
@@ -247,7 +268,7 @@ async function update() {
247268 dates . sort ( ) ;
248269 sortKeys . set ( id , dates . join ( "+" ) ) ;
249270 }
250- const sortedIds = Object . keys ( features ) . sort ( ( a , b ) => {
271+ const sortedIds = Array . from ( sortKeys . keys ( ) ) . sort ( ( a , b ) => {
251272 return sortKeys . get ( a ) ! . localeCompare ( sortKeys . get ( b ) ! ) ;
252273 } ) ;
253274
0 commit comments