-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: build (previous it was working in dev mode)
- Loading branch information
1 parent
21f2b45
commit 74f3cfa
Showing
12 changed files
with
57 additions
and
227 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -1,17 +1,31 @@ | ||
import fs from 'node:fs/promises'; | ||
import __dirname from '../../__dirname'; | ||
import path from 'path'; | ||
export interface SocialLink { | ||
icon: string; | ||
url: string; | ||
tooltip: string; | ||
} | ||
|
||
export interface FileCommunity { | ||
name: string; | ||
shortDescription: string; | ||
image: string | null; | ||
patternsGoogleCalendar: string[]; | ||
socialLinks: SocialLink[]; | ||
} | ||
|
||
export interface Community extends FileCommunity { | ||
key: string; | ||
} | ||
|
||
const keyPattern = /([^\/]+?)(\.[^.]*$|$)/; | ||
|
||
export async function getList() { | ||
const dataDir = path.join(__dirname, 'data'); | ||
const communityFiles = await fs.readdir(dataDir); | ||
return await Promise.all(communityFiles | ||
.filter(f => f.endsWith('.json') && f != 'conferences.json') | ||
.map(async (f) => { | ||
const content = await fs.readFile(path.join(dataDir, f)); | ||
const json = JSON.parse(content); | ||
json.key = f.substring(0, f.length - '.json'.length); | ||
return json; | ||
}) | ||
); | ||
export function getList(): Community[] { | ||
const files: Record<string, FileCommunity> = | ||
import.meta.glob(['../../data/*.json', '!**/conferences.json'], { eager: true }); | ||
return Object.keys(files) | ||
.map((path: string) => { | ||
return { | ||
key: (path.match(keyPattern) ?? [path, path])[1], | ||
...files[path] | ||
}; | ||
}); | ||
} |
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
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
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
Oops, something went wrong.