import { Octokit } from "https://cdn.skypack.dev/@octokit/rest"; const octokit = new Octokit({ userAgent: "MetacatUI docs" }); var markdownConverter = new showdown.Converter({ emoji: true }); export async function getLatestRelease(){ var releaseTemplate = '
'; var tag = await octokit.rest.repos.getLatestRelease({ owner: "NCEAS", repo: "metacatui" }); let releaseHTML = ""; let releaseNotes = markdownConverter.makeHtml(tag.data.body), date = new Date(tag.data.published_at); releaseHTML += releaseTemplate.replace(/{{release-notes}}/g, releaseNotes) .replace(/{{tag-name}}/g, tag.data.tag_name) .replace(/{{download-url}}/g, tag.data.zipball_url) .replace(/{{github-url}}/g, tag.data.html_url) .replace(/{{date}}/g, date.toLocaleDateString(undefined, { year: "numeric", month: "long", day: "numeric" })); document.getElementById("releaseContainer").innerHTML = releaseHTML; } export async function getReleases(){ var releaseListItemTemplate = ''; var { data: releases } = await octokit.rest.repos.listReleases({ owner: "NCEAS", repo: "metacatui" }); console.log(releases) var listHTML = ""; for( let i=0; i