Skip to content

Commit

Permalink
feat: remove unused scripts and upgrade dependencies and added theme …
Browse files Browse the repository at this point in the history
…switch
  • Loading branch information
prisis committed Aug 8, 2023
1 parent b1cb450 commit fcee341
Show file tree
Hide file tree
Showing 27 changed files with 7,430 additions and 4,442 deletions.
42 changes: 0 additions & 42 deletions .eslintrc.cjs

This file was deleted.

63 changes: 63 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/** @ts-check */
const globals = require("@anolilab/eslint-config/globals");
const { defineConfig } = require("@anolilab/eslint-config/define-config");

module.exports = defineConfig({
env: {
// Your environments (which contains several predefined global variables)
// Most environments are loaded automatically if our rules are added
},
extends: ["@anolilab/eslint-config", "@anolilab/eslint-config/typescript-type-checking"],
globals: {
...globals.es2021,
// Your global variables (setting to false means it's not allowed to be reassigned)
// myGlobal: false
},
ignorePatterns: ["!**/*"],
overrides: [
{
files: ["*.ts", "*.tsx", "*.mts", "*.cts", "*.js", "*.jsx"],
// Set parserOptions.project for the project to allow TypeScript to create the type-checker behind the scenes when we run linting
parserOptions: {},
rules: {},
},
{
files: ["*.ts", "*.tsx", "*.mts", "*.cts"],
// Set parserOptions.project for the project to allow TypeScript to create the type-checker behind the scenes when we run linting
parserOptions: {},
rules: {
"import/no-cycle": "off",
"no-use-before-define": "off",
},
settings: {
tailwindcss: {
config: "./tailwind.config.js",
whitelist: [],
},
},
},
{
files: ["*.js", "*.jsx"],
rules: {
"global-require": "off",
},
},
{
files: ["*.mdx"],
rules: {
"jsx-a11y/anchor-has-content": "off",
// @see https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/917
"jsx-a11y/heading-has-content": "off",
},
},
],
parserOptions: {
ecmaVersion: 2021,
project: "./tsconfig.json",
sourceType: "module",
},
root: true,
rules: {
// Customize your rules
},
});
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ coverage/
resume.private.json

dist
.idea
8 changes: 4 additions & 4 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"**/*.{js,jsx,tsx,ts}": [
"prettier --config=.prettierrc.cjs --write",
"cross-env NO_LOGS=true eslint . --ext js,jsx,ts,tsx --max-warnings=1 --config .eslintrc.cjs --cache --cache-strategy content . --fix"
"prettier --config=.prettierrc.js --write",
"cross-env NO_LOGS=true eslint . --ext js,jsx,ts,tsx --max-warnings=1 --config .eslintrc.js --cache --cache-strategy content . --fix"
],
"*.{json,yml,yaml,less,css,scss,sass}": [
"prettier --config=.prettierrc.cjs --write"
"prettier --config=.prettierrc.js --write"
],
"*.{md,mdx}": [
"prettier --config=.prettierrc.cjs --write"
"prettier --config=.prettierrc.js --write"
]
}
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
strict-peer-dependencies=false
dadssa
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.15.1
18.17
21 changes: 0 additions & 21 deletions .prettierrc.cjs

This file was deleted.

6 changes: 6 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// eslint-disable-next-line import/no-extraneous-dependencies
const config = require("@anolilab/prettier-config");

module.exports = {
...config,
};
8 changes: 4 additions & 4 deletions __tests__/utils/get-network.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@ import { getNetwork } from "../../src/utils";
const profiles = [
{
network: "Twitter",
username: "siliconHBO",
url: "https://twitter.com/siliconHBO",
username: "siliconHBO",
},
{
network: "Facebook",
username: "SiliconHBO",
url: "https://www.facebook.com/SiliconHBO",
username: "SiliconHBO",
},
{
network: "Instagram",
username: "siliconhbo",
url: "https://www.instagram.com/siliconhbo/",
username: "siliconhbo",
},
];

describe("getNetwork", () => {
it("returns network profile", () => {
expect(getNetwork(profiles, "twitter")).toEqual({
network: "Twitter",
username: "siliconHBO",
url: "https://twitter.com/siliconHBO",
username: "siliconHBO",
});
});

Expand Down
9 changes: 6 additions & 3 deletions bin/build-pdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,22 @@ import process from "node:process";

import htmlToPdf from "../src/html-to-pdf";

async function buildPdf() {
const buildPdf = async (): Promise<void> => {
const distributionPath = path.join(process.cwd(), "dist");
// eslint-disable-next-line security/detect-non-literal-fs-filename
const assets = fs.readdirSync(path.join(distributionPath, "assets")).map((asset) => path.join(distributionPath, "assets", asset));

await htmlToPdf(path.join(distributionPath, "index.html"), assets, path.join(distributionPath, "resume.pdf"));
}
};

buildPdf()
// eslint-disable-next-line promise/always-return
.then(() => {
// eslint-disable-next-line unicorn/no-process-exit
process.exit(0);
})
.catch((error) => {
// eslint-disable-next-line unicorn/prefer-top-level-await
.catch((error: unknown) => {
// eslint-disable-next-line no-console
console.error(error);
// eslint-disable-next-line unicorn/no-process-exit
Expand Down
13 changes: 8 additions & 5 deletions bin/download-resume-gist.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Octokit } from "@octokit/rest";
import fs from "node:fs";
import { env } from "node:process";
import { Octokit } from "@octokit/rest";
// eslint-disable-next-line import/no-extraneous-dependencies
import { loadEnv } from "vite";

Object.assign(process.env, loadEnv("", process.cwd()));
Expand All @@ -15,21 +16,23 @@ console.log("Downloading resume.json");
// Compare: https://docs.github.com/rest/reference/gists#get-a-gist
octokit.rest.gists
.get({ gist_id: env.VITE_GITHUB_RESUME_GIST_ID as string })
// eslint-disable-next-line promise/always-return
.then(({ data }) => {
const { files } = data;

Object.keys(files as Object)?.forEach((key) => {
fs.writeFileSync(key, ((files as { [key: string]: object })[key] as { content: string }).content as string, "utf8");
Object.keys(files as object).forEach((key) => {
// eslint-disable-next-line security/detect-non-literal-fs-filename,security/detect-object-injection
fs.writeFileSync(key, ((files as Record<string, object>)[key] as { content: string }).content as string, "utf8");
// eslint-disable-next-line no-console
console.log(`Wrote "${key}" to disk.`);
});
})
.then(() => {

// eslint-disable-next-line no-console
console.log("Done");
// eslint-disable-next-line unicorn/no-process-exit
process.exit(0);
})
// eslint-disable-next-line unicorn/prefer-top-level-await
.catch((error) => {
// eslint-disable-next-line no-console
console.error(error);
Expand Down
28 changes: 19 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="robots" content="noindex" />
<meta name="googlebot" content="noindex" />
<meta charset="utf-8" >
<meta http-equiv="X-UA-Compatible" content="IE=edge" >
<meta name="viewport" content="width=device-width, initial-scale=1" >
<meta name="robots" content="noindex" >
<meta name="googlebot" content="noindex" >
<title>{{#resume.basics}}{{name}}{{/resume.basics}} - Résumé</title>
<link rel="stylesheet" href="/assets/style.css" type="text/css" />
<link rel="stylesheet" href="/assets/style.css" type="text/css" >
<script type="module" src="/src/main.tsx"></script>
<script src="https://cdn.usefathom.com/script.js" data-spa="auto" data-site="UUUYFLMH" defer></script>
</head>
Expand Down Expand Up @@ -62,6 +62,16 @@ <h3 class="font-semibold text-2xl" itemprop="name">{{name}}</h3>
</div>

{{/resume.basics}}
<div class="flex print:hidden fixed bottom-0 mb-2.5 -ml-2.5">
<button id="theme-toggle" type="button" title="Theme Switcher" class="text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 focus:outline-none focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-700 rounded-lg text-sm p-2">
<svg id="theme-toggle-dark-icon" class="w-5 h-5 hidden" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<path d="M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"></path>
</svg>
<svg id="theme-toggle-light-icon" class="w-5 h-5 hidden" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<path d="M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1 0 100-2H3a1 1 0 000 2h1z" fill-rule="evenodd" clip-rule="evenodd"></path>
</svg>
</button>
</div>
</nav>

<main class="w-full">
Expand All @@ -84,7 +94,7 @@ <h3 class="font-semibold text-2xl" itemprop="name">{{name}}</h3>
<li class="pl-5 py-5 {{domClasses}}">
<div>
<div class="flex space-x-2" itemprop="award">
<strong>{{displayName}}</strong>&nbsp {{#if githubUrl}}
<strong>{{displayName}}</strong>&nbsp; {{#if githubUrl}}
<a href="{{githubUrl}}" class="text-gray-500 hover:text-gray-900 dark:hover:text-white" target="_blank" title="GitHub">
{{{toSocialIcon 'github'}}}
</a>
Expand Down Expand Up @@ -220,7 +230,7 @@ <h3 class="font-semibold text-2xl" itemprop="name">{{name}}</h3>
>{{#if website}}<a href="{{website}}" target="_blank" class="border-b border-dashed border-zinc-400" title="{{name}}"
>{{name}}</a
>{{else}}{{name}}{{/if}}</strong
>,<span class="text-md text-zinc-500">&nbsp {{publisher}}</span>
>,<span class="text-md text-zinc-500">&nbsp; {{publisher}}</span>
</p>
<p class="mb-2 text-md text-zinc-500">
<small>{{releaseDate}} {{dateNote}}</small>
Expand Down Expand Up @@ -366,7 +376,7 @@ <h3 class="font-semibold text-2xl" itemprop="name">{{name}}</h3>
<script>
async function updateStars() {
await Promise.all(
Array.from(document.querySelectorAll("[data-gh-api]")).map(async (e) => {
[...document.querySelectorAll("[data-gh-api]")].map(async (e) => {
const api = e.dataset.ghApi;
const r = await fetch(api);
const json = await r.json();
Expand Down
4 changes: 2 additions & 2 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[build.environment]
NODE_VERSION = "16"
NODE_VERSION = "18"
NPM_FLAGS="--version"

[[plugins]]
package = "/.netlify/netlify-plugin-pnpm"

[build]
command = "npx pnpm@7 install --store-dir=.pnpm --frozen-lockfile && npx pnpm@7 run download:resume && npx pnpm@7 run build && npx pnpm@7 run build:pdf"
command = "npx pnpm@8 install --store-dir=.pnpm --frozen-lockfile && npx pnpm@8 run download:resume && npx pnpm@8 run build && npx pnpm@8 run build:pdf"
publish = "dist"
Loading

0 comments on commit fcee341

Please sign in to comment.