Skip to content

Commit

Permalink
WIP: Upgrade nextjs and deps, fix errors
Browse files Browse the repository at this point in the history
WIP: Fix legacy image

WIP: Fix legacy image
  • Loading branch information
colinhoernig committed Nov 24, 2022
1 parent 0ecc2ce commit 764400a
Show file tree
Hide file tree
Showing 16 changed files with 1,782 additions and 4,845 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
23 changes: 23 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"plugin:@typescript-eslint/recommended",
"next",
"next/core-web-vitals",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
]
}
7 changes: 7 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
printWidth: 80,
semi: true,
singleQuote: true,
tabWidth: 2,
useTabs: false,
};
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"editor.formatOnSave": true,
"editor.formatOnPaste": true
}
5 changes: 4 additions & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
28 changes: 19 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,34 @@
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"next": "latest",
"next-google-fonts": "^1.2.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"@next/font": "^13.0.5",
"autoprefixer": "^10.4.13",
"eslint": "^8.28.0",
"next": "13.0.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^3.11.0"
},
"devDependencies": {
"@fullhuman/postcss-purgecss": "^5.0.0",
"@types/node": "^14.6.0",
"@types/react": "^16.9.46",
"@types/react-dom": "^16.9.8",
"postcss": "^8.1.8",
"@typescript-eslint/eslint-plugin": "^5.44.0",
"@typescript-eslint/parser": "^5.44.0",
"eslint-config-next": "13.0.5",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-typescript": "^3.5.2",
"eslint-plugin-prettier": "^4.2.1",
"postcss": "^8.4.19",
"postcss-preset-env": "^6.7.0",
"prettier": "^2.1.2",
"tailwindcss": "^2.0.1",
"typescript": "4.0.2"
"prettier": "^2.8.0",
"tailwindcss": "^3.2.4",
"typescript": "^4.9.3"
},
"license": "MIT"
}
10 changes: 9 additions & 1 deletion postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
module.exports = {
plugins: ['tailwindcss', 'postcss-preset-env'],
plugins: ['tailwindcss', process.env.NODE_ENV === 'production' ?
[ '@fullhuman/postcss-purgecss', {
content: [
'./pages/**/*.{js,jsx,ts,tsx}',
'./components/**/*.{js,jsx,ts,tsx}',
],
defaultExtractor: content => content.match(/[\w-/:]+(?<!:)/g) || [],
},
] : undefined,,'postcss-preset-env'],
}
5 changes: 4 additions & 1 deletion src/components/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ const Index = () => (
width={150}
height={150}
className="object-cover rounded-full"
/>
style={{
maxWidth: "100%",
height: "auto"
}} />
</div>
);

Expand Down
6 changes: 2 additions & 4 deletions src/components/DarkModeSwitch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ const DarkModeSwitch = () => {

useEffect(() => {
if (active) {
// @ts-ignore
document?.querySelector("html").classList.add("dark");
document?.querySelector("html")?.classList.add("dark");
} else {
// @ts-ignore
document?.querySelector("html").classList.remove("dark");
document?.querySelector("html")?.classList.remove("dark");
}
}, [active]);

Expand Down
2 changes: 0 additions & 2 deletions src/components/Head.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { FunctionComponent } from "react";
import NextHead from "next/head";
import GoogleFonts from "next-google-fonts";

const Head: FunctionComponent = ({ children }) => (
<>
<GoogleFonts href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro&display=swap" />
<NextHead>
<meta charSet="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
Expand Down
2 changes: 1 addition & 1 deletion src/components/SocialIconRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const SOCIAL_LINKS = {
const SocialIconRow = () => (
<div className="flex justify-center align-center space-x-4">
{Object.values(SOCIAL_LINKS).map((social) => (
<a href={social.url} target="_blank" rel="noopener" key={social.service}>
<a href={social.url} target="_blank" rel="noopener noreferrer" key={social.service}>
<span className="sr-only">
{social.srPretext} {social.handle} on {social.service}
</span>
Expand Down
8 changes: 8 additions & 0 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
import { AppProps } from "next/app";
import Head from "../components/Head";
import "../styles/index.css";
import { Source_Sans_Pro } from '@next/font/google';

const TITLE =
"ckhdotio - Colin Hoernig - musings of an engineering manager, developer, and tech enthusiast";

const font = Source_Sans_Pro({weight:"400", subsets:["latin"]});

function App({ Component, pageProps }: AppProps) {
return (
<>
<Head>
<title>{TITLE}</title>
<meta name="description" content={TITLE} />
</Head>
<style jsx global>{`
html {
font-family: ${font.style.fontFamily};
}
`}</style>
<Component {...pageProps} />
</>
);
Expand Down
2 changes: 2 additions & 0 deletions src/styles/index.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/* purgecss start ignore */
@tailwind base;
@tailwind components;
/* purgecss end ignore */

html, body {
@apply m-0 p-0 bg-gray-200 dark:bg-gray-800;
Expand Down
11 changes: 8 additions & 3 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
const colors = require("tailwindcss/colors");
/* eslint-disable @typescript-eslint/no-var-requires */
const colors = require('tailwindcss/colors')

/** @type {import('tailwindcss').Config} */
module.exports = {
purge: ["./src/**/*.html", "./src/**/*.tsx", "./src/**/*.jsx"],
content: [
"./src/pages/**/*.{js,ts,jsx,tsx}",
"./src/components/**/*.{js,ts,jsx,tsx}",
],
darkMode: "class",
theme: {
extend: {
Expand Down Expand Up @@ -31,7 +36,7 @@ module.exports = {

black: colors.black,
white: colors.white,
gray: colors.coolGray,
gray: colors.gray,
red: colors.red,
yellow: colors.amber,
green: colors.emerald,
Expand Down
17 changes: 13 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"jsx": "preserve",
"lib": ["dom", "es2017"],
"lib": [
"dom",
"es2017"
],
"module": "esnext",
"moduleResolution": "node",
"noEmit": true,
Expand All @@ -16,8 +19,14 @@
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "esnext"
"target": "esnext",
"incremental": true
},
"exclude": ["node_modules"],
"include": ["**/*.ts", "**/*.tsx"]
"exclude": [
"node_modules"
],
"include": [
"**/*.ts",
"**/*.tsx"
]
}
Loading

0 comments on commit 764400a

Please sign in to comment.