File tree 3 files changed +33
-7
lines changed 3 files changed +33
-7
lines changed Original file line number Diff line number Diff line change @@ -17,10 +17,6 @@ steps:
17
17
env :
18
18
- ' NODE_OPTIONS="--max_old_space_size=8192"' # https://github.com/GoogleChrome/developer.chrome.com/issues/2439
19
19
20
- - name : node:16.14.2
21
- entrypoint : npm
22
- args : ['run', 'algolia']
23
-
24
20
- name : ' gcr.io/cloud-builders/gcloud'
25
21
entrypoint : ' bash'
26
22
args :
Original file line number Diff line number Diff line change
1
+ timeout : 600s # set build timeout to 10 mins
2
+ steps :
3
+ - name : node:16.14.2
4
+ entrypoint : npm
5
+ args : ['ci']
6
+
7
+ - name : node:16.14.2
8
+ entrypoint : npm
9
+ args : ['run', 'cloud-secrets']
10
+
11
+ - name : node:16.14.2
12
+ entrypoint : npm
13
+ args : ['run', 'algolia']
14
+
15
+ substitutions :
16
+ _EXTRA_GCLOUD_ARGS : # default empty
17
+
18
+ options :
19
+ machineType : ' E2_HIGHCPU_32'
20
+ env :
21
+ - ' PROJECT_ID=$PROJECT_ID'
Original file line number Diff line number Diff line change 14
14
* limitations under the License.
15
15
*/
16
16
require ( 'dotenv' ) . config ( ) ;
17
+
17
18
const { default : algoliasearch } = require ( 'algoliasearch' ) ;
18
- const fs = require ( 'fs ' ) ;
19
+ const { default : fetch } = require ( 'node-fetch ' ) ;
19
20
const { sizeof} = require ( 'sizeof' ) ;
20
21
22
+ const algoliaIndexSource = 'https://developers.chrome.com/algolia.json' ;
23
+
21
24
const maxChunkSizeInBytes = 10000000 ; // 10,000,000
22
25
23
26
/**
@@ -53,8 +56,14 @@ async function index() {
53
56
return ;
54
57
}
55
58
56
- const raw = fs . readFileSync ( 'dist/algolia.json' , 'utf-8' ) ;
57
- const algoliaData = JSON . parse ( raw ) ;
59
+ let algoliaData = [ ] ;
60
+ try {
61
+ const raw = await fetch ( algoliaIndexSource ) ;
62
+ algoliaData = await raw . json ( ) ;
63
+ } catch ( err ) {
64
+ console . error ( 'Could not load algolia index from prod.' , err ) ;
65
+ return ;
66
+ }
58
67
59
68
// Set date of when object is being added to algolia
60
69
algoliaData . map ( e => {
You can’t perform that action at this time.
0 commit comments