-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Pooya Parsa <[email protected]>
- Loading branch information
Showing
2 changed files
with
147 additions
and
4 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
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,73 @@ | ||
import { $fetch } from 'ofetch' | ||
|
||
export const categories = [ | ||
'Analytics', | ||
'CMS', | ||
'CSS', | ||
'Database', | ||
'Date', | ||
'Deployment', | ||
'Devtools', | ||
'Extensions', | ||
'Ecommerce', | ||
'Fonts', | ||
'Images', | ||
'Libraries', | ||
'Monitoring', | ||
'Payment', | ||
'Performance', | ||
'Request', | ||
'SEO', | ||
'Security', | ||
'UI', | ||
] | ||
|
||
export interface ModuleCompatibility { | ||
nuxt: string | ||
requires: { bridge?: boolean | 'optional' } | ||
} | ||
|
||
export interface MaintainerInfo { | ||
name: string | ||
github: string | ||
twitter?: string | ||
} | ||
|
||
export interface GithubContributor { | ||
username: string | ||
name?: string | ||
avatar_url?: string | ||
} | ||
|
||
export type CompatibilityStatus = 'working' | 'wip' | 'unknown' | 'not-working' | ||
export type ModuleType = 'community' | 'official' | '3rd-party' | ||
|
||
export interface NuxtModule { | ||
name: string | ||
description: string | ||
repo: string | ||
npm: string | ||
icon?: string | ||
github: string | ||
website: string | ||
learn_more: string | ||
category: (typeof categories)[number] | ||
type: ModuleType | ||
maintainers: MaintainerInfo[] | ||
contributors?: GithubContributor[] | ||
compatibility: ModuleCompatibility | ||
|
||
// Fetched in realtime API for modules.nuxt.org | ||
downloads?: number | ||
tags?: string[] | ||
stars?: number | ||
publishedAt?: number | ||
createdAt?: number | ||
} | ||
|
||
export async function fetchModules(): Promise<NuxtModule[]> { | ||
const data = await $fetch<NuxtModule[]>( | ||
'https://cdn.jsdelivr.net/npm/@nuxt/modules@latest/modules.json' | ||
) | ||
return data | ||
} |