feat: implement image compressor (#5551)
* wip: image compressor * fix: ignore increase file * Compress images * Compress images --------- Co-authored-by: Kamran Ahmed <kamranahmed.se@gmail.com>
1
.github/workflows/deployment.yml
vendored
@ -39,6 +39,7 @@ jobs:
|
||||
run: |
|
||||
git clone https://${{ secrets.GH_PAT }}@github.com/roadmapsh/web-draw.git .temp/web-draw --depth 1
|
||||
npm run generate-renderer
|
||||
npm run compress:images
|
||||
npm run build
|
||||
|
||||
# --------------------
|
||||
|
@ -2,7 +2,6 @@
|
||||
import sitemap from '@astrojs/sitemap';
|
||||
import tailwind from '@astrojs/tailwind';
|
||||
import node from '@astrojs/node';
|
||||
import compress from 'astro-compress';
|
||||
import { defineConfig } from 'astro/config';
|
||||
import rehypeExternalLinks from 'rehype-external-links';
|
||||
import { serializeSitemap, shouldIndexPage } from './sitemap.mjs';
|
||||
@ -56,11 +55,6 @@ export default defineConfig({
|
||||
filter: shouldIndexPage,
|
||||
serialize: serializeSitemap,
|
||||
}),
|
||||
compress({
|
||||
HTML: false,
|
||||
CSS: false,
|
||||
JavaScript: false,
|
||||
}),
|
||||
react(),
|
||||
],
|
||||
});
|
||||
|
@ -11,7 +11,6 @@
|
||||
"format": "prettier --write .",
|
||||
"astro": "astro",
|
||||
"deploy": "NODE_DEBUG=gh-pages gh-pages -d dist -t",
|
||||
"compress:jsons": "node scripts/compress-jsons.cjs",
|
||||
"upgrade": "ncu -u",
|
||||
"roadmap-links": "node scripts/roadmap-links.cjs",
|
||||
"roadmap-dirs": "node scripts/roadmap-dirs.cjs",
|
||||
@ -20,6 +19,7 @@
|
||||
"best-practice-dirs": "node scripts/best-practice-dirs.cjs",
|
||||
"best-practice-content": "node scripts/best-practice-content.cjs",
|
||||
"generate:og": "node ./scripts/generate-og-images.mjs",
|
||||
"compress:images": "tsx ./scripts/compress-images.ts",
|
||||
"test:e2e": "playwright test"
|
||||
},
|
||||
"dependencies": {
|
||||
@ -33,7 +33,6 @@
|
||||
"@types/react": "^18.2.56",
|
||||
"@types/react-dom": "^18.2.19",
|
||||
"astro": "^4.4.0",
|
||||
"astro-compress": "^2.2.10",
|
||||
"clsx": "^2.1.0",
|
||||
"dayjs": "^1.11.10",
|
||||
"dom-to-image": "^2.6.0",
|
||||
@ -81,6 +80,7 @@
|
||||
"openai": "^4.28.0",
|
||||
"prettier": "^3.2.5",
|
||||
"prettier-plugin-astro": "^0.13.0",
|
||||
"prettier-plugin-tailwindcss": "^0.5.11"
|
||||
"prettier-plugin-tailwindcss": "^0.5.11",
|
||||
"tsx": "^4.7.2"
|
||||
}
|
||||
}
|
||||
|
48
pnpm-lock.yaml
generated
@ -178,6 +178,9 @@ devDependencies:
|
||||
prettier-plugin-tailwindcss:
|
||||
specifier: ^0.5.11
|
||||
version: 0.5.11(prettier-plugin-astro@0.13.0)(prettier@3.2.5)
|
||||
tsx:
|
||||
specifier: ^4.7.2
|
||||
version: 4.7.2
|
||||
|
||||
packages:
|
||||
|
||||
@ -577,7 +580,6 @@ packages:
|
||||
cpu: [ppc64]
|
||||
os: [aix]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@esbuild/android-arm64@0.19.11:
|
||||
@ -586,7 +588,6 @@ packages:
|
||||
cpu: [arm64]
|
||||
os: [android]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@esbuild/android-arm@0.19.11:
|
||||
@ -595,7 +596,6 @@ packages:
|
||||
cpu: [arm]
|
||||
os: [android]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@esbuild/android-x64@0.19.11:
|
||||
@ -604,7 +604,6 @@ packages:
|
||||
cpu: [x64]
|
||||
os: [android]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@esbuild/darwin-arm64@0.19.11:
|
||||
@ -613,7 +612,6 @@ packages:
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@esbuild/darwin-x64@0.19.11:
|
||||
@ -622,7 +620,6 @@ packages:
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@esbuild/freebsd-arm64@0.19.11:
|
||||
@ -631,7 +628,6 @@ packages:
|
||||
cpu: [arm64]
|
||||
os: [freebsd]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@esbuild/freebsd-x64@0.19.11:
|
||||
@ -640,7 +636,6 @@ packages:
|
||||
cpu: [x64]
|
||||
os: [freebsd]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@esbuild/linux-arm64@0.19.11:
|
||||
@ -649,7 +644,6 @@ packages:
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@esbuild/linux-arm@0.19.11:
|
||||
@ -658,7 +652,6 @@ packages:
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@esbuild/linux-ia32@0.19.11:
|
||||
@ -667,7 +660,6 @@ packages:
|
||||
cpu: [ia32]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@esbuild/linux-loong64@0.19.11:
|
||||
@ -676,7 +668,6 @@ packages:
|
||||
cpu: [loong64]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@esbuild/linux-mips64el@0.19.11:
|
||||
@ -685,7 +676,6 @@ packages:
|
||||
cpu: [mips64el]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@esbuild/linux-ppc64@0.19.11:
|
||||
@ -694,7 +684,6 @@ packages:
|
||||
cpu: [ppc64]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@esbuild/linux-riscv64@0.19.11:
|
||||
@ -703,7 +692,6 @@ packages:
|
||||
cpu: [riscv64]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@esbuild/linux-s390x@0.19.11:
|
||||
@ -712,7 +700,6 @@ packages:
|
||||
cpu: [s390x]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@esbuild/linux-x64@0.19.11:
|
||||
@ -721,7 +708,6 @@ packages:
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@esbuild/netbsd-x64@0.19.11:
|
||||
@ -730,7 +716,6 @@ packages:
|
||||
cpu: [x64]
|
||||
os: [netbsd]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@esbuild/openbsd-x64@0.19.11:
|
||||
@ -739,7 +724,6 @@ packages:
|
||||
cpu: [x64]
|
||||
os: [openbsd]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@esbuild/sunos-x64@0.19.11:
|
||||
@ -748,7 +732,6 @@ packages:
|
||||
cpu: [x64]
|
||||
os: [sunos]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@esbuild/win32-arm64@0.19.11:
|
||||
@ -757,7 +740,6 @@ packages:
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@esbuild/win32-ia32@0.19.11:
|
||||
@ -766,7 +748,6 @@ packages:
|
||||
cpu: [ia32]
|
||||
os: [win32]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@esbuild/win32-x64@0.19.11:
|
||||
@ -775,7 +756,6 @@ packages:
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@fingerprintjs/fingerprintjs@4.2.2:
|
||||
@ -3112,7 +3092,6 @@ packages:
|
||||
'@esbuild/win32-arm64': 0.19.11
|
||||
'@esbuild/win32-ia32': 0.19.11
|
||||
'@esbuild/win32-x64': 0.19.11
|
||||
dev: false
|
||||
|
||||
/escalade@3.1.1:
|
||||
resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==}
|
||||
@ -3429,6 +3408,12 @@ packages:
|
||||
engines: {node: '>=16'}
|
||||
dev: false
|
||||
|
||||
/get-tsconfig@4.7.3:
|
||||
resolution: {integrity: sha512-ZvkrzoUA0PQZM6fy6+/Hce561s+faD1rsNwhnO5FelNjyy7EMGJ3Rz1AQ8GYDWjhRs/7dBLOEJvhK8MiEJOAFg==}
|
||||
dependencies:
|
||||
resolve-pkg-maps: 1.0.0
|
||||
dev: true
|
||||
|
||||
/gh-pages@6.1.1:
|
||||
resolution: {integrity: sha512-upnohfjBwN5hBP9w2dPE7HO5JJTHzSGMV1JrLrHvNuqmjoYHg6TBrCcnEoorjG/e0ejbuvnwyKMdTyM40PEByw==}
|
||||
engines: {node: '>=10'}
|
||||
@ -6152,6 +6137,10 @@ packages:
|
||||
resolution: {integrity: sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==}
|
||||
dev: false
|
||||
|
||||
/resolve-pkg-maps@1.0.0:
|
||||
resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==}
|
||||
dev: true
|
||||
|
||||
/resolve@1.22.8:
|
||||
resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==}
|
||||
hasBin: true
|
||||
@ -6940,6 +6929,17 @@ packages:
|
||||
resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==}
|
||||
dev: false
|
||||
|
||||
/tsx@4.7.2:
|
||||
resolution: {integrity: sha512-BCNd4kz6fz12fyrgCTEdZHGJ9fWTGeUzXmQysh0RVocDY3h4frk05ZNCXSy4kIenF7y/QnrdiVpTsyNRn6vlAw==}
|
||||
engines: {node: '>=18.0.0'}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
esbuild: 0.19.11
|
||||
get-tsconfig: 4.7.3
|
||||
optionalDependencies:
|
||||
fsevents: 2.3.3
|
||||
dev: true
|
||||
|
||||
/tuf-js@1.1.7:
|
||||
resolution: {integrity: sha512-i3P9Kgw3ytjELUfpuKVDNBJvk4u5bXL6gskv572mcevPbSKCV3zt3djhmlEQ65yERjIbOSncy7U4cQJaB1CBCg==}
|
||||
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
|
||||
|
Before Width: | Height: | Size: 844 KiB After Width: | Height: | Size: 509 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 150 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 505 KiB After Width: | Height: | Size: 185 KiB |
Before Width: | Height: | Size: 469 KiB After Width: | Height: | Size: 174 KiB |
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 479 KiB |
Before Width: | Height: | Size: 378 KiB After Width: | Height: | Size: 140 KiB |
Before Width: | Height: | Size: 987 KiB After Width: | Height: | Size: 351 KiB |
Before Width: | Height: | Size: 875 KiB After Width: | Height: | Size: 420 KiB |
Before Width: | Height: | Size: 119 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 148 KiB After Width: | Height: | Size: 126 KiB |
Before Width: | Height: | Size: 834 KiB After Width: | Height: | Size: 431 KiB |
Before Width: | Height: | Size: 404 KiB After Width: | Height: | Size: 235 KiB |
Before Width: | Height: | Size: 383 KiB After Width: | Height: | Size: 205 KiB |
Before Width: | Height: | Size: 447 KiB After Width: | Height: | Size: 242 KiB |
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 572 KiB |
Before Width: | Height: | Size: 734 KiB After Width: | Height: | Size: 283 KiB |
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 437 KiB |
Before Width: | Height: | Size: 2.1 MiB After Width: | Height: | Size: 799 KiB |
Before Width: | Height: | Size: 691 KiB After Width: | Height: | Size: 233 KiB |
Before Width: | Height: | Size: 2.0 MiB After Width: | Height: | Size: 756 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 248 KiB After Width: | Height: | Size: 142 KiB |
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 685 KiB |
Before Width: | Height: | Size: 168 KiB After Width: | Height: | Size: 128 KiB |
Before Width: | Height: | Size: 297 KiB After Width: | Height: | Size: 92 KiB |
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 602 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 937 KiB After Width: | Height: | Size: 345 KiB |
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 516 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 1021 B |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 405 KiB |
Before Width: | Height: | Size: 448 KiB After Width: | Height: | Size: 398 KiB |
Before Width: | Height: | Size: 832 KiB After Width: | Height: | Size: 286 KiB |
Before Width: | Height: | Size: 140 KiB After Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 316 KiB After Width: | Height: | Size: 132 KiB |
Before Width: | Height: | Size: 326 KiB After Width: | Height: | Size: 137 KiB |
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 294 KiB After Width: | Height: | Size: 123 KiB |
Before Width: | Height: | Size: 199 KiB After Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 261 KiB After Width: | Height: | Size: 96 KiB |
Before Width: | Height: | Size: 277 KiB After Width: | Height: | Size: 119 KiB |
Before Width: | Height: | Size: 279 KiB After Width: | Height: | Size: 114 KiB |
Before Width: | Height: | Size: 296 KiB After Width: | Height: | Size: 129 KiB |
Before Width: | Height: | Size: 773 KiB After Width: | Height: | Size: 312 KiB |
Before Width: | Height: | Size: 263 KiB After Width: | Height: | Size: 99 KiB |
Before Width: | Height: | Size: 318 KiB After Width: | Height: | Size: 132 KiB |
Before Width: | Height: | Size: 218 KiB After Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 275 KiB After Width: | Height: | Size: 116 KiB |
Before Width: | Height: | Size: 345 KiB After Width: | Height: | Size: 123 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 267 B After Width: | Height: | Size: 218 B |
Before Width: | Height: | Size: 374 KiB After Width: | Height: | Size: 184 KiB |
Before Width: | Height: | Size: 327 KiB After Width: | Height: | Size: 154 KiB |
Before Width: | Height: | Size: 305 KiB After Width: | Height: | Size: 150 KiB |
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 384 KiB After Width: | Height: | Size: 184 KiB |
Before Width: | Height: | Size: 89 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 55 KiB |
Before Width: | Height: | Size: 113 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 89 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 95 KiB After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 37 KiB |