material-extensions / vscode-material-icon-theme

Available on the VSCode Marketplace
https://marketplace.visualstudio.com/items?itemName=PKief.material-icon-theme
MIT License
2.02k stars 623 forks source link

Automation of icon optimization #2516

Closed okineadev closed 1 month ago

okineadev commented 1 month ago

Unfortunately, I can't do a PR right now, but I can offer an idea for automatic icon optimization

The first option:

I need a workflow that automatically optimizes the icon after merging a branch, but I doubt that this is possible

The second option:

After I push a commit to the main repository (not a fork) with icon changes, then image optimization is automatically performed using svgo, after which a commit is made on behalf of github-actions

And also to be able to activate the action manually (in order to optimize all the currently unoptimized icons)

I believe that the second option will be the most optimal, because there will be no unwanted optimization of images after each commit while working on PR, and it will also optimize icons that did not come from PR (for example, if the members of the organization added the icon to the main branch themselves)

PKief commented 1 month ago

As every merge of a PR resolves with a new squashed commit on the main branch, I don't see the difference between option 1 and 2. However, if we want to run the optimizer every time when a new commit lands on the main branch and we optimize the icons, we need to push the updated icons either with a separate commit to the branch or adjust the merged commit. Pushing an additional commit will spam the whole commit history with additional commits:

- Add file icon A
- Optimize icon
- Add file icon B
- Optimize icon
- Add file icon C
- Optimize icon

Personally, I don't want to see something like that.

Another possibility is adjusting the history every time, but this would require force pushing of the workflow every time to the history to override the commit with the updated SVG files. This can also have dangerous side affects and is a bit risky.

Another approach could be a pre commit hook that runs the optimizer on the icons locally (see #1526). Would be maybe the best approach, but I don't see the need at the moment of why the bulk optimization before a release isn't enough.

okineadev commented 1 month ago

As every merge of a PR resolves with a new squashed commit on the main branch, I don't see the difference between option 1 and 2. However, if we want to run the optimizer every time when a new commit lands on the main branch and we optimize the icons, we need to push the updated icons either with a separate commit to the branch or adjust the merged commit. Pushing an additional commit will spam the whole commit history with additional commits:

- Add file icon A
- Optimize icon
- Add file icon B
- Optimize icon
- Add file icon C
- Optimize icon

Personally, I don't want to see something like that.

Another possibility is adjusting the history every time, but this would require force pushing of the workflow every time to the history to override the commit with the updated SVG files. This can also have dangerous side affects and is a bit risky.

Another approach could be a pre commit hook that runs the optimizer on the icons locally (see #1526). Would be maybe the best approach, but I don't see the need at the moment of why the bulk optimization before a release isn't enough.

And really, then I think it's better to add a pre-commit hook

Better to focus on #1526.