Skip to content

Commit b86aefc

Browse files
Gusted0ko
authored andcommitted
chore: use sharp to generate images (go-gitea#7512)
- `tools/generate-images.js` is used to convert SVGs to resized optimized SVGs and resized optimized PNG. Although it would be best to drop generating images from SVG, the usage of these images do not accept a SVG. - The script relied on two dependencies being installed on-the-fly, this is suboptimal as it means its integrity was not saved in package-lock.json and no specific version was specified which makes reproducible builds harder. `imagemin-zopfli` was not updated in 4 years and seems to use dependency that generate funny message about memory leaks and using no longer maintained dependencies. - Use [`sharp`](https://sharp.pixelplumbing.com/) to do the image conversion, this installs two binaries on Linux (glibc/musl) and are responsible for 5% of the `node_modules` directory size. Add this to package.json as a dev dependencies to ensure the integrity can be verified and help reproducible builds. - Drop the `gitea` conversion, I cannot find this being used within Forgejo (my best guess is that e20cd83 dropped the usage of it). - Resolves forgejo/forgejo#7232 Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7512 Reviewed-by: 0ko <[email protected]> Reviewed-by: Michael Kriese <[email protected]> Co-authored-by: Gusted <[email protected]> Co-committed-by: Gusted <[email protected]>
1 parent b55c728 commit b86aefc

File tree

10 files changed

+500
-34
lines changed

10 files changed

+500
-34
lines changed

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,8 +1017,7 @@ generate-gomock:
10171017

10181018
.PHONY: generate-images
10191019
generate-images: | node_modules
1020-
npm install --no-save fabric@6 imagemin-zopfli@7
1021-
node tools/generate-images.js $(TAGS)
1020+
node tools/generate-images.js
10221021

10231022
.PHONY: generate-manpage
10241023
generate-manpage:

0 commit comments

Comments
 (0)