File tree 5 files changed +50
-0
lines changed
5 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -169,6 +169,9 @@ jobs:
169
169
yarn tool whatsdeployed $CONTENT_ROOT --output client/build/_whatsdeployed/content.json
170
170
yarn tool whatsdeployed $CONTENT_TRANSLATED_ROOT --output client/build/_whatsdeployed/translated-content.json
171
171
172
+ # Sort DE search index by en-US popularity.
173
+ node scripts/reorder-search-index.mjs client/build/en-us/search-index.json client/build/de/search-index.json
174
+
172
175
- name : Deploy with deployer
173
176
env :
174
177
# Set the CONTENT_ROOT first
Original file line number Diff line number Diff line change @@ -312,6 +312,9 @@ jobs:
312
312
yarn tool whatsdeployed $CONTENT_ROOT --output client/build/_whatsdeployed/content.json
313
313
yarn tool whatsdeployed $CONTENT_TRANSLATED_ROOT --output client/build/_whatsdeployed/translated-content.json
314
314
315
+ # Sort DE search index by en-US popularity.
316
+ node scripts/reorder-search-index.mjs client/build/en-us/search-index.json client/build/de/search-index.json
317
+
315
318
- name : Update search index
316
319
if : ${{ ! vars.SKIP_BUILD }}
317
320
env :
Original file line number Diff line number Diff line change @@ -314,6 +314,9 @@ jobs:
314
314
315
315
yarn rari build --issues client/build/issues.json --templ-stats
316
316
317
+ # Sort DE search index by en-US popularity.
318
+ node scripts/reorder-search-index.mjs client/build/en-us/search-index.json client/build/de/search-index.json
319
+
317
320
# SSR all pages
318
321
yarn render:html
319
322
@@ -322,6 +325,9 @@ jobs:
322
325
yarn tool whatsdeployed $CONTENT_ROOT --output client/build/_whatsdeployed/content.json
323
326
yarn tool whatsdeployed $CONTENT_TRANSLATED_ROOT --output client/build/_whatsdeployed/translated-content.json
324
327
328
+ # Sort DE search index by en-US popularity.
329
+ node scripts/reorder-search-index.mjs client/build/en-us/search-index.json client/build/de/search-index.json
330
+
325
331
- name : Update search index
326
332
if : ${{ ! vars.SKIP_BUILD }}
327
333
env :
Original file line number Diff line number Diff line change @@ -213,6 +213,9 @@ jobs:
213
213
yarn tool whatsdeployed $CONTENT_ROOT --output client/build/_whatsdeployed/content.json
214
214
yarn tool whatsdeployed $CONTENT_TRANSLATED_ROOT --output client/build/_whatsdeployed/translated-content.json
215
215
216
+ # Sort DE search index by en-US popularity.
217
+ node scripts/reorder-search-index.mjs client/build/en-us/search-index.json client/build/de/search-index.json
218
+
216
219
- name : Authenticate with GCP
217
220
uses : google-github-actions/auth@v2
218
221
with :
Original file line number Diff line number Diff line change
1
+ import { readFileSync , writeFileSync } from "node:fs" ;
2
+
3
+ async function main ( ) {
4
+ const [ refPath , inputPath , outputPath = null ] = process . argv . slice ( 2 ) ;
5
+
6
+ const readJson = ( path ) => JSON . parse ( readFileSync ( path , "utf-8" ) ) ;
7
+ const getSlug = ( { url } ) => url . replace ( / ^ \/ [ ^ / ] + \/ d o c s \/ / , "" ) ;
8
+
9
+ // Read reference (e.g. "client/build/en-us/search-index.json").
10
+ const ref = readJson ( refPath ) . map ( getSlug ) ;
11
+
12
+ // Read index (e.g. "client/build/de/search-index.json").
13
+ const input = readJson ( inputPath ) ;
14
+
15
+ const getIndex = ( slug ) => ref . indexOf ( slug ) ;
16
+
17
+ const result = [ ] ;
18
+ for ( const [ fromIndex , toIndex ] of input
19
+ . map ( getSlug )
20
+ . map ( getIndex )
21
+ . entries ( ) ) {
22
+ result [ toIndex ] = input [ fromIndex ] ;
23
+ }
24
+
25
+ writeFileSync ( outputPath ?? inputPath , JSON . stringify ( result ) , "utf-8" ) ;
26
+ }
27
+
28
+ try {
29
+ main ( ) ;
30
+ } catch ( e ) {
31
+ console . error ( e ) ;
32
+ if ( process . env . GITHUB_ACTIONS ) {
33
+ console . log ( `::error::${ e . toString ( ) } ` ) ;
34
+ }
35
+ }
You can’t perform that action at this time.
0 commit comments