Update package versions and improve code handling

Multiple package versions have been updated to their latest versions for better compatibility and stability. In addition, modifications were made to the `getGitHash` function in `route.ts` to handle potential failures more gracefully.
This commit is contained in:
gbuomprisco
2024-07-17 18:43:57 +08:00
parent fb04be4d26
commit 35717c79f7
19 changed files with 530 additions and 655 deletions

View File

@@ -21,14 +21,20 @@ export const GET = async () => {
});
};
function getGitHash() {
async function getGitHash() {
for (const envVar of KNOWN_GIT_ENV_VARS) {
if (process.env[envVar]) {
return process.env[envVar];
}
}
return getHashFromProcess();
try {
return await getHashFromProcess();
} catch (error) {
console.warn(`[WARN] Could not find git hash: ${JSON.stringify(error)}. You may want to provide a fallback.`);
return '';
}
}
async function getHashFromProcess() {