Skip to content

Commit

Permalink
feat(projects): add new projects, add tech stacks
Browse files Browse the repository at this point in the history
  • Loading branch information
uncenter committed May 8, 2024
1 parent 1e438fd commit 40ef9ca
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 51 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
"simple-icons": "^11.13.0",
"tailwindcss": "^3.4.3",
"terser": "^5.30.4",
"yaml": "^2.4.1",
"zod": "^3.23.0"
},
"devDependencies": {
Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

77 changes: 36 additions & 41 deletions src/_data/projects.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import YAML from 'yaml';
import EleventyFetch from '@11ty/eleventy-fetch';

const projects = {
Expand All @@ -7,69 +6,87 @@ const projects = {
name: 'kittysay',
link: 'https://github.com/uncenter/kittysay',
featured: true,
stack: ['rust'],
},
{
name: 'octotree',
link: 'https://github.com/uncenter/octotree',
featured: true,
stack: ['typescript', 'solid', 'tailwindcss'],
},
{
name: 'npm-on-github',
link: 'https://github.com/uncenter/npm-on-github',
featured: true,
stack: ['typescript', 'mockserviceworker', 'vitest'],
},
{
name: 'ascii-to-lua-table',
link: 'https://github.com/uncenter/ascii-to-lua-table',
featured: true,
stack: ['typescript', 'vuedotjs'],
},
{
name: 'eleventy-plugin-icons',
link: 'https://github.com/uncenter/eleventy-plugin-icons',
stack: ['typescript', 'vitest'],
},
{
name: 'eleventy-plugin-validate',
link: 'https://github.com/uncenter/eleventy-plugin-validate',
stack: ['typescript'],
},
{
name: 'gh-stats',
link: 'https://github.com/uncenter/gh-stats',
name: 'mailtolink',
link: 'https://github.com/uncenter/mailtolink',
stack: ['javascript', 'eleventy', 'tailwindcss'],
},
{
name: 'loogu',
link: 'https://github.com/uncenter/loogu',
name: 'json-to-nix',
link: 'https://github.com/uncenter/json-to-nix',
stack: ['typescript', 'vuedotjs'],
},
{
name: 'mailtolink',
link: 'https://github.com/uncenter/mailtolink',
name: 'icnsify',
link: 'https://github.com/uncenter/icnsify',
stack: ['rust'],
},
{
name: 'sttr-rs',
link: 'https://github.com/uncenter/sttr-rs',
stack: ['rust'],
},
],
old: [
{
name: 'phonetic-alphabet',
link: 'https://github.com/uncenter/phonetic-alphabet',
stack: ['typescript', 'solid'],
},
{
name: 'canvas-grade-calculator',
link: 'https://github.com/uncenter/canvas-grade-calculator',
stack: ['javascript'],
},
{
name: 'fn',
link: 'https://github.com/uncenter/fn',
stack: ['gnubash'],
},
{
name: 'gh-stats',
link: 'https://github.com/uncenter/gh-stats',
stack: ['python'],
},
],
other: [
{
name: 'create-eleventy-app',
link: 'https://github.com/uncenter/create-eleventy-app',
stack: ['javascript'],
},
{
name: 'learn-eleventy',
link: 'https://github.com/uncenter/learn-eleventy',
},
{
name: 'phonetic-alphabet',
link: 'https://github.com/uncenter/phonetic-alphabet',
},
{
name: 'chemic',
description:
'A Python library, GUI, and CLI for chemical formulas and equations.',
link: 'https://github.com/uncenter/chemic',
stack: ['eleventy'],
},
],
};
Expand All @@ -90,20 +107,6 @@ async function fetchRepository(username, repository, fetchOptions) {
};
}

async function getLanguageColors(languages) {
const response = await EleventyFetch(
'https://raw.githubusercontent.com/github/linguist/master/lib/linguist/languages.yml',
{
duration: '90d',
type: 'text',
},
);
const data = YAML.parse(response);
return Object.fromEntries(
[...languages].map((language) => [language, data[language]?.color]),
);
}

export default async function () {
const headers = {};
if (process.env.GITHUB_TOKEN) {
Expand All @@ -112,7 +115,6 @@ export default async function () {
console.warn('GITHUB_TOKEN environment variable is not set');
}

const languages = new Set();
for (const category in projects) {
for (const project of projects[category]) {
let [username, repository] = new URL(project.link).pathname
Expand All @@ -124,15 +126,8 @@ export default async function () {
});
project.description = project.description || data.description;
project.language = data.language;
languages.add(data.language);
if (data.homepage) project.live = data.homepage;
}
}
const languagesWithColors = await getLanguageColors(languages);
for (const category in projects) {
for (const project of projects[category]) {
project.color = languagesWithColors[project.language];
}
}
return projects;
}
11 changes: 7 additions & 4 deletions src/_includes/projectslist.njk
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,22 @@
<p class="mx-0 my-1">{{ project.description }}</p>
</div>
<div class="flex flex-row justify-between items-center ">
<div class="flex flex-row gap-2">
<svg xmlns="http://www.w3.org/2000/svg" style="fill:{{ project.color }}" viewBox="0 0 16 16" width="16" height="16"><circle cx="8" cy="9" r="5"/></svg>
{{ project.language }}
<div class="flex flex-row gap-4">
{% for item in project.stack %}
{%- icon "si:" + item, class='block w-5 h-5 text-text align-baseline' -%}
{% endfor %}
</div>
<div class="flex flex-row gap-4">
<div>
{%- icon "si:github", class='block w-5 h-5 text-text align-baseline' -%}
</div>
{% if project.live %}
{% if project.live and not project.live.startsWith("https://crates.io") %}
{%- if project.live.startsWith("https://discord.gg") -%}
{%- set liveIcon = 'si:discord' -%}
{%- elif project.live.startsWith("https://npmjs.com") or project.live.startsWith("https://www.npmjs.com") -%}
{%- set liveIcon = 'si:npm' -%}
{% elif project.live.startsWith("https://chrome.google.com/webstore") or project.live.startsWith("https://chromewebstore.google.com") %}
{%- set liveIcon = 'si:googlechrome' -%}
{%- else -%}
{%- set liveIcon = 'lucide:globe' -%}
{%- endif -%}
Expand Down
4 changes: 2 additions & 2 deletions src/projects.njk
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ description: A list of projects I've worked on.

<hr>

<h2>Other</h2>
<h2>Older</h2>

{% set projectslist = projects.other %}
{% set projectslist = projects.old %}
{% include "projectslist.njk" %}

0 comments on commit 40ef9ca

Please sign in to comment.