mirror of
https://github.com/marcogll/TaxHacker_s23.git
synced 2026-01-13 21:35:19 +00:00
feat: invoice generator
This commit is contained in:
27
app/(app)/apps/common.ts
Normal file
27
app/(app)/apps/common.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import fs from "fs/promises"
|
||||
import path from "path"
|
||||
|
||||
export type AppManifest = {
|
||||
name: string
|
||||
description: string
|
||||
icon: string
|
||||
}
|
||||
|
||||
export async function getApps(): Promise<{ id: string; manifest: AppManifest }[]> {
|
||||
const appsDir = path.join(process.cwd(), "app/(app)/apps")
|
||||
const items = await fs.readdir(appsDir, { withFileTypes: true })
|
||||
|
||||
const apps = await Promise.all(
|
||||
items
|
||||
.filter((item) => item.isDirectory() && item.name !== "apps")
|
||||
.map(async (item) => {
|
||||
const manifestModule = await import(`./${item.name}/manifest`)
|
||||
return {
|
||||
id: item.name,
|
||||
manifest: manifestModule.manifest as AppManifest,
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
return apps
|
||||
}
|
||||
Reference in New Issue
Block a user