Skip to content

Commit 72f9770

Browse files
authored
Optimize images with next-image-export-optimizer (graphql#1664)
* aa * aa * aa * aa * rollback * move gallery images from `public` directory to `app` dir
1 parent 4b5a695 commit 72f9770

File tree

2,443 files changed

+794
-306
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,443 files changed

+794
-306
lines changed

Diff for: .eslintrc.cjs

+31-1
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,46 @@
1+
/* eslint-env node */
2+
13
module.exports = {
24
root: true,
35
overrides: [
46
{
57
files: ["**/*.{js,jsx,cjs,mjs,ts,tsx,cts,mts}"],
6-
extends: ["plugin:tailwindcss/recommended"],
8+
extends: [
9+
"eslint:recommended",
10+
"plugin:@typescript-eslint/recommended",
11+
"plugin:tailwindcss/recommended",
12+
"prettier",
13+
],
714
parser: "@typescript-eslint/parser",
815
parserOptions: {
916
sourceType: "module",
1017
ecmaVersion: "latest",
1118
},
1219
rules: {
1320
"tailwindcss/classnames-order": "off",
21+
"@typescript-eslint/no-restricted-imports": [
22+
"error",
23+
{
24+
paths: [
25+
{
26+
name: "next/image",
27+
message: "Please use `next-image-export-optimizer` instead",
28+
allowTypeImports: true,
29+
},
30+
],
31+
},
32+
],
33+
// TODO: fix below
34+
"no-var": "off",
35+
"no-useless-escape": "off",
36+
"prefer-const": "off",
37+
"prefer-rest-params": "off",
38+
"prefer-spread": "off",
39+
"@typescript-eslint/no-explicit-any": "off",
40+
"@typescript-eslint/no-unused-vars": "off",
41+
"@typescript-eslint/ban-ts-comment": "off",
42+
"@typescript-eslint/no-var-requires": "off",
43+
"@typescript-eslint/ban-types": "off",
1444
},
1545
settings: {
1646
tailwindcss: {

Diff for: .prettierrc

-13
This file was deleted.

Diff for: next-sitemap.config.cjs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-env node */
2+
13
/** @type {import('next-sitemap').IConfig} */
24
module.exports = {
35
siteUrl: process.env.SITE_URL || "https://graphql.org",

Diff for: next.config.js

+20-1
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,28 @@ export default withLess(
3737
},
3838
output: "export",
3939
images: {
40-
unoptimized: true,
40+
loader: "custom",
41+
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
42+
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
43+
},
44+
transpilePackages: ["next-image-export-optimizer"],
45+
env: {
46+
nextImageExportOptimizer_imageFolderPath: "public/images",
47+
nextImageExportOptimizer_exportFolderPath: "out",
48+
nextImageExportOptimizer_quality: "75",
49+
nextImageExportOptimizer_storePicturesInWEBP: "true",
50+
nextImageExportOptimizer_exportFolderName: "nextImageExportOptimizer",
51+
// If you do not want to use blurry placeholder images, then you can set
52+
// nextImageExportOptimizer_generateAndUseBlurImages to false and pass
53+
// `placeholder="empty"` to all <ExportedImage> components.
54+
nextImageExportOptimizer_generateAndUseBlurImages: "true",
55+
// If you want to cache the remote images, you can set the time to live of the cache in seconds.
56+
// The default value is 0 seconds.
57+
nextImageExportOptimizer_remoteImageCacheTTL: "0",
4158
},
4259
trailingSlash: true,
60+
// Only for local development, skip 200 statusCode due following error:
61+
//
4362
// `statusCode` is not undefined or valid statusCode for route {"source":"/conf/attendee/:path*","destination":"https://graphql-conf-attendee-nextjs.vercel.app/:path*","statusCode":200}
4463
// `statusCode` is not undefined or valid statusCode for route {"source":"/swapi-graphql/:path*","destination":"https://graphql.github.io/swapi-graphql/:path*","statusCode":200}
4564
// Valid redirect statusCode values are 301, 302, 303, 307, 308

Diff for: package.json

+37-28
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,81 @@
11
{
2+
"version": "0.0.0",
3+
"type": "module",
24
"repository": "graphql/graphql.github.io website",
35
"private": true,
4-
"version": "0.0.0",
56
"scripts": {
6-
"dev": "next",
77
"//prebuild": "tsx --env-file=.env src/get-github-info.ts",
8-
"build": "next build",
9-
"postbuild": "next-sitemap --config next-sitemap.config.cjs",
10-
"start": "next start",
8+
"build": "next build && next-image-export-optimizer",
9+
"dev": "next",
1110
"format": "pnpm format:check --write",
1211
"format:check": "prettier --cache --check \"**/*.{js,jsx,ts,tsx,json,md}\"",
1312
"lint": "eslint --ignore-path .gitignore .",
13+
"postbuild": "next-sitemap --config next-sitemap.config.cjs",
14+
"start": "next start",
1415
"test": "echo \"no tests\" && exit 1"
1516
},
16-
"type": "module",
1717
"dependencies": {
1818
"@graphql-tools/schema": "10.0.3",
19-
"codemirror": "5.65.1",
20-
"codemirror-graphql": "1.3.2",
21-
"graphql": "16.8.1",
22-
"marked": "5.0.2",
23-
"numbro": "2.3.6",
24-
"parser-front-matter": "1.6.4",
25-
"string-similarity": "^4.0.4",
26-
"timeago.js": "4.0.2",
27-
"@radix-ui/react-radio-group": "^1.1.3",
28-
"leaflet": "^1.9.4",
29-
"iframe-resizer-react": "^1.1.0",
30-
"gray-matter": "^4.0.3",
3119
"@headlessui/react": "^1.7.17",
3220
"@heroicons/react": "^2.0.18",
3321
"@radix-ui/react-icons": "^1.3.0",
22+
"@radix-ui/react-radio-group": "^1.1.3",
23+
"@svgr/webpack": "^8.0.1",
24+
"@tailwindcss/nesting": "0.0.0-insiders.565cd3e",
25+
"@tailwindcss/typography": "^0.5.10",
26+
"autoprefixer": "^10.4.17",
3427
"clsx": "^2.1.0",
28+
"codemirror": "5.65.1",
29+
"codemirror-graphql": "1.3.2",
30+
"date-fns": "^2.30.0",
3531
"fast-glob": "^3.3.2",
32+
"graphql": "16.8.1",
33+
"gray-matter": "^4.0.3",
34+
"iframe-resizer-react": "^1.1.0",
35+
"leaflet": "^1.9.4",
3636
"markdown-to-jsx": "^7.4.0",
37+
"marked": "5.0.2",
3738
"next": "^14.1.4",
39+
"next-image-export-optimizer": "^1.12.3",
3840
"next-query-params": "^5.0.0",
3941
"next-sitemap": "^4.2.3",
4042
"next-with-less": "^3.0.1",
4143
"nextra": "3.0.0-alpha.22",
4244
"nextra-theme-docs": "3.0.0-alpha.22",
45+
"numbro": "2.3.6",
4346
"p-limit": "^4.0.0",
47+
"parser-front-matter": "1.6.4",
48+
"postcss": "^8.4.33",
49+
"prettier-plugin-pkg": "^0.18.1",
4450
"react": "^18.2.0",
4551
"react-dom": "^18.2.0",
52+
"react-medium-image-zoom": "5.1.8",
4653
"server-only": "0.0.1",
4754
"server-only-context": "^0.1.0",
55+
"string-similarity": "^4.0.4",
4856
"string-strip-html": "^13.4.5",
49-
"unist-util-visit": "^5.0.0",
50-
"use-query-params": "^2.2.1",
5157
"tailwindcss": "^3.4.1",
52-
"@tailwindcss/nesting": "0.0.0-insiders.565cd3e",
53-
"@tailwindcss/typography": "^0.5.10",
54-
"postcss": "^8.4.33",
55-
"@svgr/webpack": "^8.0.1",
56-
"autoprefixer": "^10.4.17",
58+
"timeago.js": "4.0.2",
5759
"tsx": "^4.7.0",
58-
"react-medium-image-zoom": "5.1.8",
59-
"date-fns": "^2.30.0"
60+
"unist-util-visit": "^5.0.0",
61+
"use-query-params": "^2.2.1"
6062
},
6163
"devDependencies": {
64+
"@types/codemirror": "5.60.7",
6265
"@types/node": "^20.11.30",
6366
"@types/react": "^18.2.73",
64-
"@types/codemirror": "5.60.7",
6567
"@types/string-similarity": "^4.0.2",
68+
"@typescript-eslint/eslint-plugin": "7.4.0",
6669
"@typescript-eslint/parser": "7.4.0",
6770
"eslint": "8.57.0",
71+
"eslint-config-prettier": "^9.1.0",
6872
"eslint-plugin-tailwindcss": "3.15.1",
6973
"prettier": "3.2.5",
7074
"typescript": "^5.4.3"
75+
},
76+
"pnpm": {
77+
"patchedDependencies": {
78+
79+
}
7180
}
7281
}

Diff for: patches/[email protected]

27.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)