1
1
mirror of https://github.com/theoludwig/theoludwig.git synced 2024-09-09 09:45:52 +02:00

perf: reduce build size + add next-secure-headers

This commit is contained in:
Divlo 2021-08-12 01:19:11 +02:00
parent 712805df93
commit 4f5dfc63ea
No known key found for this signature in database
GPG Key ID: 6F24DA54DA3967CF
15 changed files with 3408 additions and 2800 deletions

View File

@ -1,3 +1,14 @@
{
"presets": ["next/babel"]
"presets": [
[
"next/babel",
{
"preset-env": {
"targets": {
"browsers": ">1%, not ie 11, not dead"
}
}
}
]
]
}

View File

@ -5,7 +5,7 @@
"next/core-web-vitals",
"prettier"
],
"plugins": ["prettier"],
"plugins": ["unicorn", "prettier"],
"parserOptions": {
"project": "./tsconfig.json"
},
@ -15,6 +15,17 @@
"jest": true
},
"rules": {
"prettier/prettier": "error"
"prettier/prettier": "error",
"unicorn/prefer-node-protocol": "error",
"unicorn/prevent-abbreviations": [
"error",
{
"replacements": {
"props": {
"properties": false
}
}
}
]
}
}

View File

@ -11,7 +11,6 @@
"preset": "lighthouse:recommended",
"assertions": {
"csp-xss": "warning",
"non-composited-animations": "warning",
"uses-responsive-images": "warning"
}
},

View File

@ -13,7 +13,12 @@
"preset": "conventionalcommits"
}
],
"@semantic-release/npm",
[
"@semantic-release/npm",
{
"npmPublish": false
}
],
[
"@semantic-release/git",
{

41
.vscode/settings.json vendored
View File

@ -1,9 +1,48 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"prettier.configPath": ".prettierrc.json",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true
},
"[css]": {
"editor.autoClosingBrackets": "always",
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[sass]": {
"editor.autoClosingBrackets": "always",
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[scss]": {
"editor.autoClosingBrackets": "always",
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.autoClosingBrackets": "always",
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.autoClosingBrackets": "always",
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.autoClosingBrackets": "always",
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.autoClosingBrackets": "always",
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.autoClosingBrackets": "always",
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.autoClosingBrackets": "always",
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.autoClosingBrackets": "always",
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}

View File

@ -1,44 +1,17 @@
import useTranslation from 'next-translate/useTranslation'
export const ProfileInfo: React.FC = () => {
export const ProfileInformation: React.FC = () => {
const { t } = useTranslation()
return (
<>
<div className='pb-2 mb-6 border-b-2 font-headline border-gray-600 dark:border-gray-400'>
<h1 className='text-4xl mb-2'>
{t('home:about.IAm')}{' '}
<strong className='font-semibold text-yellow dark:text-yellow-dark'>
Divlo
</strong>
</h1>
<h2 className='text-base mb-3'>{t('home:about.description')}</h2>
</div>
<style jsx>
{`
.profile-info {
padding-bottom: 25px;
margin-bottom: 25px;
border-bottom: 1px solid #dedede;
}
.profile-title {
font-size: 36px;
line-height: 1.1;
font-weight: 300;
margin-bottom: 10px;
}
.profile-title > strong {
font-weight: 600;
}
.profile-description {
font-size: 17.4px;
font-weight: 400;
line-height: 1.1;
margin: 0;
}
`}
</style>
</>
<div className='pb-2 mb-6 border-b-2 font-headline border-gray-600 dark:border-gray-400'>
<h1 className='text-4xl mb-2'>
{t('home:about.IAm')}{' '}
<strong className='font-semibold text-yellow dark:text-yellow-dark'>
Divlo
</strong>
</h1>
<h2 className='text-base mb-3'>{t('home:about.description')}</h2>
</div>
)
}

View File

@ -1,14 +1,11 @@
import Image from 'next/image'
import DivloLogo from 'public/images/divlo_logo.png'
export const ProfileLogo: React.FC = () => {
return (
<div className='px-2 py-6'>
<Image
width={370}
height={370}
src='/images/divlo_logo.png'
alt='Divlo'
/>
<div className='px-2 py-6 max-w-[370px] max-h-[370px]'>
<Image src={DivloLogo} alt='Divlo' />
</div>
)
}

View File

@ -1,14 +1,14 @@
import { ProfileDescriptionBottom } from './ProfileDescriptionBottom'
import { ProfileInfo } from './ProfileInfo'
import { ProfileInformation } from './ProfileInfo'
import { ProfileList } from './ProfileList'
import { ProfileLogo } from './ProfileLogo'
export const Profile: React.FC = () => {
return (
<div className='flex flex-col justify-center items-center px-10 pt-2 md:pt-10 xl:pt-0 md:flex-row'>
<div className='flex flex-col justify-center items-center px-10 pt-2 md:pt-10 md:flex-row'>
<ProfileLogo />
<div>
<ProfileInfo />
<ProfileInformation />
<ProfileList />
<ProfileDescriptionBottom />
</div>

3
next-env.d.ts vendored
View File

@ -1,3 +1,6 @@
/// <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.

View File

@ -1,11 +1,35 @@
const nextPWA = require('next-pwa')
const nextTranslate = require('next-translate')
const { createSecureHeaders } = require('next-secure-headers')
/** @type {import("next").NextConfig} */
module.exports = nextTranslate(
nextPWA({
pwa: {
disable: process.env.NODE_ENV !== 'production',
dest: 'public'
},
async headers() {
return [
{
source: '/:path*',
headers: createSecureHeaders({
contentSecurityPolicy: {
directives: {
defaultSrc: ["'self'"],
scriptSrc: ["'self'", "'unsafe-eval'", "'unsafe-inline'"],
styleSrc: ["'self'", "'unsafe-inline'"],
imgSrc: ['*', 'data:', 'blob:'],
mediaSrc: "'none'",
connectSrc: '*',
objectSrc: "'none'",
fontSrc: "'self'",
baseURI: "'none'"
}
}
})
}
]
}
})
)

6004
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -28,14 +28,14 @@
"postinstall": "husky install"
},
"dependencies": {
"@fontsource/montserrat": "4.5.0",
"@fortawesome/fontawesome-svg-core": "1.2.35",
"@fortawesome/free-brands-svg-icons": "5.15.3",
"@fortawesome/free-solid-svg-icons": "5.15.3",
"@fontsource/montserrat": "4.5.1",
"@fortawesome/fontawesome-svg-core": "1.2.36",
"@fortawesome/free-brands-svg-icons": "5.15.4",
"@fortawesome/free-solid-svg-icons": "5.15.4",
"@fortawesome/react-fontawesome": "0.1.15",
"classnames": "2.3.1",
"html-react-parser": "1.2.7",
"next": "11.0.1",
"next": "11.1.0",
"next-pwa": "5.2.24",
"next-themes": "0.0.15",
"next-translate": "1.0.7",
@ -52,32 +52,34 @@
"@semantic-release/git": "9.0.0",
"@testing-library/jest-dom": "5.14.1",
"@testing-library/react": "12.0.0",
"@types/jest": "26.0.24",
"@types/node": "16.4.10",
"@types/react": "17.0.15",
"@types/jest": "27.0.0",
"@types/node": "16.6.0",
"@types/react": "17.0.17",
"@types/styled-jsx": "2.2.9",
"@typescript-eslint/eslint-plugin": "4.29.0",
"@typescript-eslint/eslint-plugin": "4.29.1",
"autoprefixer": "10.3.1",
"babel-jest": "27.0.6",
"dockerfilelint": "1.8.0",
"editorconfig-checker": "4.0.2",
"eslint": "7.32.0",
"eslint-config-next": "11.0.1",
"eslint-config-next": "11.1.0",
"eslint-config-prettier": "8.3.0",
"eslint-config-standard-with-typescript": "20.0.0",
"eslint-plugin-import": "2.23.4",
"eslint-plugin-import": "2.24.0",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-prettier": "3.4.0",
"eslint-plugin-promise": "5.1.0",
"eslint-plugin-unicorn": "35.0.0",
"husky": "7.0.1",
"jest": "27.0.6",
"lint-staged": "11.1.1",
"lint-staged": "11.1.2",
"markdownlint-cli": "0.28.1",
"next-secure-headers": "2.2.0",
"postcss": "8.3.6",
"prettier": "2.3.2",
"semantic-release": "17.4.4",
"tailwindcss": "2.2.7",
"typescript": "4.3.5",
"vercel": "23.0.1"
"vercel": "23.1.2"
}
}

View File

@ -8,7 +8,6 @@ import 'tailwindcss/tailwind.css'
import '@fontsource/montserrat/400.css'
import '@fontsource/montserrat/500.css'
import '@fontsource/montserrat/600.css'
import '@fontsource/montserrat/700.css'
const universalCookie = new UniversalCookie()

View File

@ -9,9 +9,9 @@ import Document, {
class MyDocument extends Document {
static async getInitialProps(
ctx: DocumentContext
context: DocumentContext
): Promise<DocumentInitialProps> {
const initialProps = await Document.getInitialProps(ctx)
const initialProps = await Document.getInitialProps(context)
return initialProps
}

View File

@ -1,6 +1,5 @@
{
"github": {
"enabled": false,
"silent": true
"enabled": false
}
}