mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
17 lines
494 B
TypeScript
17 lines
494 B
TypeScript
export type DependencyVersion = 'latest' | 'next' | 'pre' | string
|
|
|
|
const api = 'https://api.pengzhanbo.cn/npm/dependencies/version'
|
|
|
|
export async function getDependenciesVersion(
|
|
dependencies: string[],
|
|
version: DependencyVersion = 'latest',
|
|
): Promise<Record<string, string>> {
|
|
const result = await fetch(api, {
|
|
method: 'POST',
|
|
headers: { 'content-type': 'application/json' },
|
|
body: JSON.stringify({ dependencies, version }),
|
|
}).then(res => res.json())
|
|
|
|
return result
|
|
}
|