forked from enricoros/big-AGI
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nico Ramirez
committed
Nov 19, 2023
1 parent
482a81a
commit 921bc77
Showing
3 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,4 +37,6 @@ yarn-error.log* | |
next-env.d.ts | ||
|
||
# other | ||
.idea/ | ||
.idea/ | ||
|
||
src/modules/aifn/bigquery/symb-message.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// generate-config.js | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const fetch = require('node-fetch'); | ||
|
||
const outputPath = path.join('src', 'modules', 'aifn', 'bigquery', 'symb-message.ts'); | ||
|
||
async function fetchGistContent(gistUrl) { | ||
const response = await fetch(gistUrl); | ||
if (!response.ok) { | ||
throw new Error(`Gist fetch failed: ${response.statusText}`); | ||
} | ||
return response.text(); | ||
} | ||
|
||
async function generateConfig() { | ||
let content; | ||
|
||
// When running on Netlify, fetch the content from the Gist | ||
const gistUrl = process.env.SYMB_MESSAGE_GIST_URL; | ||
if (!gistUrl) { | ||
console.warn('\nWARNING: Environment variable SYMB_MESSAGE_GIST_URL is not set. Skipping generation of symb-message.ts.\n'); | ||
return; | ||
} | ||
content = await fetchGistContent(gistUrl); | ||
|
||
// Write the content to the file used in the build | ||
fs.writeFileSync(outputPath, content); | ||
} | ||
|
||
generateConfig().catch((error) => { | ||
console.error(error); | ||
process.exit(1); // Exit with a failure code | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters