Skip to content

Commit

Permalink
fix(build): remove things that should not be here
Browse files Browse the repository at this point in the history
fixes #0
  • Loading branch information
Idrinth committed May 21, 2024
1 parent 25030b6 commit a431d0a
Show file tree
Hide file tree
Showing 15 changed files with 70 additions and 166 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
/public/assets/profile-*.avif
/public/assets/contributors/*.webp
/public/assets/contributors/*.avif
/public/assets/tools/*.webp
/public/assets/tools/*.avif
/public/assets/*-*.min.css
/dump.txt
/.env
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"scripts": {
"start": "npm run build && npm run serve",
"dev": "irfbrgr && vite",
"build": "npm run drop-dist && npm run routes && npm run language && npm run contributors && vite build && irfbrgf",
"build": "npm run drop-dist && npm run routes && npm run language && npm run contributors && npm run tools && vite build && irfbrgf",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint-fix": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0 --fix",
"preview": "vite preview",
Expand All @@ -31,6 +31,7 @@
"postinstall": "irfbrgr && npm run language && npm run simple-git-hooks",
"routes": "irfbrgr",
"contributors": "node tools/load-contributors.js",
"tools": "node tools/prepare-tools.js",
"language": "itlfy generate",
"check-language": "itlfy check",
"pure-build": "npm run drop-dist && vite build && irfbrgf",
Expand Down
Binary file removed public/assets/contributors/abriel-shipley.avif
Binary file not shown.
Binary file removed public/assets/contributors/abriel-shipley.webp
Binary file not shown.
Binary file removed public/assets/contributors/david-adams.avif
Binary file not shown.
Binary file removed public/assets/contributors/david-adams.webp
Binary file not shown.
Binary file removed public/assets/contributors/julia-furtuna.avif
Binary file not shown.
Binary file removed public/assets/contributors/julia-furtuna.webp
Binary file not shown.
1 change: 0 additions & 1 deletion src/assets/favicon.svg

This file was deleted.

29 changes: 0 additions & 29 deletions src/assets/iab.svg

This file was deleted.

40 changes: 21 additions & 19 deletions src/components/tool.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
import React from 'react';
import Lang from './lang.tsx';
import languageKey from '../locales/language-key.ts';

interface ToolType {
name: string;
imgSrc?: string;
desc: string;
link: string
}

const Tool = ({
name, imgSrc, desc, link,
}: ToolType,) => {

const Image = imgSrc ? <img src={imgSrc} alt={name}/> : '';

return <div>
<a
href={link}
target='_blank'
rel='noreferrer'
>
<h3>{name}</h3>
</a>
{Image}
<p>{desc}</p>
</div>;
};
name,
link,
}: ToolType,) => <div>
<a
href={link}
target='_blank'
rel='noreferrer'
>
<h3><Lang lnkey={`tools.${ name }.title` as languageKey}/></h3>
<picture>
<source srcSet={`/assets/tools/${ name }.avif`} type="image/avif"/>
<source srcSet={`/assets/tools/${ name }.webp`} type="image/webp"/>
<img src={`/assets/tools/${ name }.png`} alt={name}/>
</picture>
</a>
<p>
<Lang lnkey={`tools.${ name }.description` as languageKey}/>
</p>
</div>;

export default Tool;

112 changes: 0 additions & 112 deletions src/routes.tsx

This file was deleted.

5 changes: 3 additions & 2 deletions tools/constants.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
export const EXIT_FAILURE = 1;
export const CONTRIBUTOR_PAGE_SIZE = 30;
const ORGANIZATION_NAME = 'Idrinth-api-bench';
export const ORGANIZATION_REPOS_URL = `https://api.github.com/orgs/${ ORGANIZATION_NAME }/repos`;
export const ORGANIZATION_REPOS_URL = 'https://api.github.com/orgs/idrinth-api-bench/repos';
export const EXIT_SUCCESS = 0;
export const ERROR_FTA_SCORE = 60;
export const WARNING_FTA_SCORE = 60;
export const PADDING_DEFAULT = 1;
export const WEBP_QUALITY = 90;
export const MAX_PROFILE_SIZE = 200;
8 changes: 6 additions & 2 deletions tools/load-contributors.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import {
import crypto from 'crypto';
import {
CONTRIBUTOR_PAGE_SIZE,
MAX_PROFILE_SIZE,
ORGANIZATION_REPOS_URL,
WEBP_QUALITY,
} from './constants.js';
import {
Transformer,
Expand All @@ -18,7 +20,6 @@ import dotenv from 'dotenv';
const defaultBio = 'An awesome person helping others in their time off work, ' +
'but who doesn\'t yet have a personalized bio.';
const MILLISECONDS_PER_DAY = 86400000;
const WEBP_QUALITY = 90;
const users = {};
const FILE = './src/pages/contributing/contributors/code-contributors.json';

Expand Down Expand Up @@ -78,7 +79,9 @@ if (! process.env.CI) {
};
const jpeg = Buffer.from(
new Uint8Array(
await (await fetch(user.avatar_url,)).arrayBuffer(),
await (await fetch(
user.avatar_url + '?s=' + MAX_PROFILE_SIZE,
)).arrayBuffer(),
),
);
const transformer = new Transformer(jpeg,);
Expand Down Expand Up @@ -143,6 +146,7 @@ for (const file of readdirSync('./public/assets/contributors', 'utf8',)) {
const transformer = new Transformer(
readFileSync('./public/assets/contributors/' + file,),
);
transformer.resize(MAX_PROFILE_SIZE, MAX_PROFILE_SIZE,);
writeFileSync(
'./public/assets/contributors/' + file.replace(/jpg$/u, 'webp',),
transformer.webpSync(WEBP_QUALITY,),
Expand Down
Loading

0 comments on commit a431d0a

Please sign in to comment.