Skip to content

Commit

Permalink
Fix langtags.json error on first compile
Browse files Browse the repository at this point in the history
  • Loading branch information
7dev7urandom committed Aug 26, 2024
1 parent 5286f0f commit 90f1c4b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions source/SIL.AppBuilder.Portal/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@ export default defineConfig({
name: 'fetch-langtags',
async buildStart() {
// Only update langtags if they are a day old
if (
Date.now() - (await stat('src/lib/langtags.json')).mtimeMs >
/* One day */ 1000 * 60 * 60 * 24
) {
let needToRefresh = true;
try {
needToRefresh =
Date.now() - (await stat('src/lib/langtags.json')).mtimeMs >
/* One day */ 1000 * 60 * 60 * 24;
} catch {
/* empty */
}
if (needToRefresh) {
const langtags: {
tag: string;
full: string;
Expand Down

0 comments on commit 90f1c4b

Please sign in to comment.