Skip to content

Commit 27b0d5b

Browse files
committed
update
1 parent 7b4e713 commit 27b0d5b

File tree

4 files changed

+26
-27
lines changed

4 files changed

+26
-27
lines changed

assets/scripts/build-api-derefs.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const safeJsonStringify = require('safe-json-stringify');
77
const 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
1011
const findSpecFiles = () => {
1112
const versions = ['v1', 'v2'];
1213
const specs = [];

assets/scripts/build-api-pages.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff 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

10201044
const 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

assets/scripts/dereference.js

Lines changed: 0 additions & 25 deletions
This file was deleted.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
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",

0 commit comments

Comments
 (0)