mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-07-03 17:46:39 -04:00
compile typescript before hitting babel
This commit is contained in:
@ -1,3 +1,6 @@
|
||||
require("./counter");
|
||||
require("./projects");
|
||||
require("./vendor/twemoji");
|
||||
|
||||
// see TS1208.
|
||||
export {};
|
@ -1,4 +1,4 @@
|
||||
const fetch = require("node-fetch");
|
||||
import fetch from "node-fetch";
|
||||
|
||||
// don't continue if there isn't a span#meta-hits element on this page
|
||||
const wrapper = document.getElementById("meta-hits");
|
||||
@ -9,7 +9,7 @@ if (wrapper) {
|
||||
|
||||
// deduce a consistent identifier for this page, no matter the URL
|
||||
const canonical = document.createElement("a");
|
||||
canonical.href = document.querySelector("link[rel='canonical']").href;
|
||||
canonical.href = (document.querySelector("link[rel='canonical']") as HTMLAnchorElement).href;
|
||||
|
||||
// strip beginning and ending forward slash
|
||||
const slug = canonical.pathname.slice(1, -1);
|
||||
@ -22,15 +22,15 @@ if (wrapper) {
|
||||
const spinner = document.getElementById("hit-spinner");
|
||||
const counter = document.getElementById("hit-counter");
|
||||
|
||||
spinner.style.display = "none";
|
||||
if (spinner) spinner.style.display = "none";
|
||||
if (counter) counter.appendChild(document.createTextNode(data.pretty_hits));
|
||||
wrapper.title = data.pretty_hits + " " + data.pretty_unit;
|
||||
counter.appendChild(document.createTextNode(data.pretty_hits));
|
||||
} else {
|
||||
// something went horribly wrong, initiate coverup
|
||||
wrapper.style.display = "none";
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch(() => {
|
||||
// something went horribly wrong, initiate coverup
|
||||
wrapper.style.display = "none";
|
||||
});
|
@ -1,4 +1,4 @@
|
||||
const fetch = require("node-fetch");
|
||||
import fetch from "node-fetch";
|
||||
|
||||
// don't continue if there isn't a span#meta-hits element on this page
|
||||
const wrapper = document.getElementById("github-cards");
|
||||
@ -7,12 +7,28 @@ if (wrapper) {
|
||||
fetch("/api/projects/?top")
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
data.forEach((repo) => {
|
||||
type Repository = {
|
||||
name: string;
|
||||
url: string;
|
||||
description: string;
|
||||
primaryLanguage?: {
|
||||
color: string;
|
||||
name: string;
|
||||
};
|
||||
stargazerCount: number;
|
||||
stargazerCount_pretty?: string;
|
||||
forkCount: number;
|
||||
forkCount_pretty?: string;
|
||||
pushedAt: string;
|
||||
pushedAt_relative?: string;
|
||||
};
|
||||
|
||||
data.forEach((repo: Repository) => {
|
||||
let html = `
|
||||
<a class="repo-name" href="${repo.url}" target="_blank" rel="noopener">${repo.name}</a>
|
||||
<p class="repo-description">${repo.description}</p>`;
|
||||
|
||||
if (repo.primaryLanguage !== null) {
|
||||
if (repo.primaryLanguage) {
|
||||
html += `
|
||||
<div class="repo-meta">
|
||||
<span class="repo-language-color" style="background-color: ${repo.primaryLanguage.color}"></span>
|
||||
@ -47,7 +63,7 @@ if (wrapper) {
|
||||
wrapper.appendChild(div);
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch(() => {
|
||||
// something went horribly wrong, initiate coverup
|
||||
wrapper.style.display = "none";
|
||||
});
|
Reference in New Issue
Block a user