File tree Expand file tree Collapse file tree 4 files changed +26
-27
lines changed Expand file tree Collapse file tree 4 files changed +26
-27
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ const safeJsonStringify = require('safe-json-stringify');
77const lodash = require ( 'lodash' ) ;
88
99// Helper function to find spec files with fallback
10+ // once spec files are put in assets on a regular cadence replace this with a simple array of paths
1011const findSpecFiles = ( ) => {
1112 const versions = [ 'v1' , 'v2' ] ;
1213 const specs = [ ] ;
Original file line number Diff line number Diff line change @@ -1016,9 +1016,33 @@ const processSpecs = (specs) => {
10161016 updateMenu ( specData , specs , supportedLangs ) ;
10171017} ;
10181018
1019+ // Helper function to find spec files with fallback
1020+ // once spec files are put in assets on a regular cadence replace this with a simple array of paths
1021+ const findSpecFiles = ( ) => {
1022+ const versions = [ 'v1' , 'v2' ] ;
1023+ const specs = [ ] ;
1024+
1025+ versions . forEach ( version => {
1026+ const assetsPath = `./assets/api/${ version } /full_spec.yaml` ;
1027+ const dataPath = `./data/api/${ version } /full_spec.yaml` ;
1028+
1029+ // Try assets first, fallback to data
1030+ if ( fs . existsSync ( assetsPath ) ) {
1031+ specs . push ( assetsPath ) ;
1032+ console . log ( `Found spec at ${ assetsPath } ` ) ;
1033+ } else if ( fs . existsSync ( dataPath ) ) {
1034+ specs . push ( dataPath ) ;
1035+ console . log ( `Fallback to spec at ${ dataPath } ` ) ;
1036+ } else {
1037+ console . warn ( `Warning: Could not find spec file for ${ version } in either assets or data directories` ) ;
1038+ }
1039+ } ) ;
1040+
1041+ return specs ;
1042+ } ;
10191043
10201044const init = ( ) => {
1021- const specs = [ './data/api/v1/full_spec.yaml' , './data/api/v2/full_spec.yaml' ] ;
1045+ const specs = findSpecFiles ( ) ;
10221046 processSpecs ( specs ) ;
10231047} ;
10241048
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 2323 "deploy:live" : " customhugo deploy --target live -e live --maxDeletes -1 --workers 100 --logLevel info" ,
2424 "build:apiPages" : " node -e 'require(\" ./assets/scripts/build-api-pages.js\" ).init()'" ,
2525 "build:apiDerefs" : " node ./assets/scripts/build-api-derefs.js" ,
26- "dereference" : " node ./assets/scripts/dereference.js" ,
2726 "jest-test" : " ./node_modules/.bin/jest ./assets/scripts/tests" ,
2827 "postinstall" : " husky" ,
2928 "prepack" : " pinst --disable" ,
You can’t perform that action at this time.
0 commit comments