File tree Expand file tree Collapse file tree 4 files changed +18
-8
lines changed
Expand file tree Collapse file tree 4 files changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ export const fetchConfig = async () => {
66 if ( configUrl ) {
77 const response = await fetch ( configUrl ) ;
88 const config = await response . json ( ) ;
9- const content = JSON . stringify ( config , null , 2 ) ;
109
10+ const content = JSON . stringify ( config , null , 2 ) ;
1111 fs . writeFileSync ( './public/config.json' , content , 'utf8' ) ;
1212
1313 console . info ( 'Using remote config.json' ) ;
@@ -17,4 +17,7 @@ export const fetchConfig = async () => {
1717 } else {
1818 console . info ( 'Using local config.json' ) ;
1919 }
20+
21+ const data = fs . readFileSync ( './public/config.json' ) ;
22+ return JSON . parse ( data ) ;
2023} ;
Original file line number Diff line number Diff line change 11import fs from 'fs' ;
2- import config from '../public/config.json' with { type : 'json' } ;
32
43const CONTEXT_SEPARATOR = '->' ;
54
@@ -19,9 +18,11 @@ const getLabel = (field) => {
1918/**
2019 * Pull in fields/labels from "/projects/:project_id/descriptors".
2120 *
21+ * @param config
22+ *
2223 * @returns {Promise<void> }
2324 */
24- export const buildUserDefinedFields = async ( ) => {
25+ export const buildUserDefinedFields = async ( config ) => {
2526 const fields = { } ;
2627
2728 for ( const projectId of config . core_data . project_ids ) {
Original file line number Diff line number Diff line change @@ -9,14 +9,14 @@ import { buildSearch } from './build.search.mjs';
99 dotenv . config ( ) ;
1010
1111 console . log ( 'Fetching config.json...' ) ;
12- await fetchConfig ( ) ;
12+ const config = await fetchConfig ( ) ;
1313
1414 console . log ( 'Building userDefinedFields.json from Core Data descriptors...' ) ;
15- await buildUserDefinedFields ( ) ;
15+ await buildUserDefinedFields ( config ) ;
1616
1717 console . log ( 'Fetching content from repository...' ) ;
1818 await fetchContent ( ) ;
1919
2020 console . log ( 'Building search.json from configuration...' ) ;
21- await buildSearch ( ) ;
21+ await buildSearch ( config ) ;
2222} ( ) ) ;
Original file line number Diff line number Diff line change 11import fs from 'fs' ;
2- import config from '../public/config.json' with { type : 'json' } ;
32
4- export const buildSearch = async ( ) => {
3+ /**
4+ * Pulls in the search indexes from `config.json`.
5+ *
6+ * @param config
7+ *
8+ * @returns {Promise<void> }
9+ */
10+ export const buildSearch = async ( config ) => {
511 const searches = { } ;
612
713 for ( const search of config . search ) {
You can’t perform that action at this time.
0 commit comments