diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2021-08-25 09:02:22 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-25 09:02:22 -0400 |
commit | dce70d32a47801025b3b67a97ec9ebed90dfc8a2 (patch) | |
tree | f08176bdad18f931956f24cd7d3b92ba313c4493 /tools/release/helpers/crates_io.ts | |
parent | dccf4cbe36d66140f9e35a6ee755c3c440d745f9 (diff) |
chore: add scripts for helping with a release (#11832)
Diffstat (limited to 'tools/release/helpers/crates_io.ts')
-rw-r--r-- | tools/release/helpers/crates_io.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/release/helpers/crates_io.ts b/tools/release/helpers/crates_io.ts new file mode 100644 index 000000000..b26539964 --- /dev/null +++ b/tools/release/helpers/crates_io.ts @@ -0,0 +1,22 @@ +// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. + +export interface CratesIoMetadata { + crate: { + id: string; + name: string; + }; + versions: { + crate: string; + num: string; + }[]; +} + +export async function getCratesIoMetadata(crateName: string) { + // rate limit + await new Promise((resolve) => setTimeout(resolve, 100)); + + const response = await fetch(`https://crates.io/api/v1/crates/${crateName}`); + const data = await response.json(); + + return data as CratesIoMetadata; +} |