-
-
Notifications
You must be signed in to change notification settings - Fork 547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changed font creation process #1413
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic job, I'm also impressed with the amount of output and different files it has for using the font. And JSON file is really useful for the site.
I noticed that the CSS classes are now prefixed with lucide-
instead of icon-
, maybe we should keep the old class prefix for backward compatibility.
The lucide-font.yml workflow has currently container
option declared for the ruby environment but if we switch to this flow we can remove that one.
Class name prefix added for backward compatibility.
Removed the container option in github workflow lucide-font because it is not needed anymore, workflow was changed to nodejs only
Thank you for pointing this out. Fixed both.
|
@schmidt-oliver Thanks for your changes, this looks really nice! So for the website we already fetching this data with {
"accessibility": {
"createdRelease": {
"version": "0.33.0",
"date": "2022-04-24T12:12:44+02:00"
},
"changedRelease": ...
},
"activity-square": {
"createdRelease": {
"version": "0.244.0",
"date": "2023-06-12T21:36:07+02:00"
},
"changedRelease": ...
},
... We could use Let me know what you think of this idea |
Interesting idea. You can fetch the json file, sort the list by |
@schmidt-oliver Yeah, the easiest way is simply to run the |
Well, I will probably update the build script within the next week. |
@schmidt-oliver yeah, take your time. Thanks for the work you already did! |
@ericfennis thank you. I think this approach only works if the release information of all icons is found, but I got this warning message after running
I found out, that the If some icons have the same |
Yeah you can ignore these warnings. These icons are created before the fork (forking from feather). They should have the date of the fork. |
Hey @ericfennis, found two icons where |
@schmidt-oliver I Found the issue, fixed it on the main branch, and rebased this PR. |
@ericfennis I have changed the process from using the I have a suggestion regarding the [
{
createdRelease: { version: '0.0.0', date: '2020-06-08T16:39:52+0100' },
changedRelease: { version: '0.244.0', date: '2023-06-12T21:36:07+02:00' },
name: 'activity',
index: 0,
unicode: 57400
},
{
createdRelease: { version: '0.0.0', date: '2020-06-08T16:39:52+0100' },
changedRelease: { version: '0.18.0', date: '2022-04-06T11:13:36+02:00' },
name: 'airplay',
index: 1,
unicode: 57401
},
{
createdRelease: { version: '0.1.0-alpha.0', date: '2020-06-08T16:39:52+0100' },
changedRelease: { version: '0.152.0', date: '2023-04-16T14:17:17+02:00' },
name: 'alarm-clock',
index: 2,
unicode: 57402
},
{
createdRelease: { version: '0.11.0', date: '2020-06-08T16:39:52+0100' },
changedRelease: { version: '0.133.0', date: '2023-04-09T11:46:30+02:00' },
name: 'album',
index: 3,
unicode: 57403
},
// ...
] As we want to display the Unicode numbers on the website, it would be smart to modify the data directly where it is created. After that we could use the prepared data for the font creation. What do you think about that? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@schmidt-oliver Fantastic work. Looks really good.
I don't fully understand the last part of your last comment, do you mean to run the website builds first and then use the created "data" for the font builds?
@ericfennis Yes, that's more or less how I imagined it. Maybe in a separate step before generating the website as well as the font. For example, with a data structure like this: {
meta: {
name: 'lucide',
version: '0.263.0',
iconsTotal: 1215,
},
data: [
{
name: 'activity',
tags: ['...'],
categories: ['...'],
contributors: ['...'],
index: 0,
unicode: 57400,
createdRelease: { version: '0.0.0', date: '2020-06-08T16:39:52+0100' },
changedRelease: { version: '0.244.0', date: '2023-06-12T21:36:07+02:00' },
// ...
},
// ...
]
} |
@victorbnl I only had to fix the Have a nice day =) |
@schmidt-oliver Awesome! I will review and test this. |
@ericfennis Awesome, I re-checked it today and it's working well on my local machine. If any issues arise in the future, I will try to resolve them. @victorbnl, you are welcome to review it as well. The project installation is based on
I thought a little summary would be a good idea. |
Nice, thank you for the summary! Looks quite good to me, but two things:
|
Hi @victorbnl,
lucide/.github/workflows/lucide-font.yml Lines 39 to 49 in 12d612d
Both steps are part of the GitHub workflow and the final font is released in each package. They are not intended to be run by an end user.
Lines 18 to 19 in 12d612d
Each script does it's own job and as long as they aren't intended to be run by an end user it's totally fine to separate them in my opinion. This way it is a bit clearer and easier to identify problems in the code and to write tests. But sure, it's also possible to combine all the steps in a single task: "build:font": "pnpm --filter outline-svg start && pnpm --filter docs prebuild:releaseJson && pnpm --filter build-font start", |
@schmidt-oliver Awesome work. I tested this with an old HTML file from the old font and it all looks great. 1 change I'm not totally convinced yet is chang in the |
@ericfennis Thank you.
No problem, the reason is described in this issue. But I will try to break it down. The problem is based on the way how the outlines are created. The outline paths can be clockwise or counter-clockwise. And there are rules to determine whether the paths are filled or cut out. The even-odd rule is used in the More information about the the two rules:
The old workflow is not based on JS and we have some improvements (bugfixes and features) as mentioned above. The outlining process takes about 0.3 seconds per icon, depending on its complexity and hardware performance. The build time will increase with the number of icons. I think it's fine. |
My bad, as I saw there was no action running on your fork I thought you hadn’t made one. Apparently you just didn’t enable them. That’s nice!
Given it’s run in an action, it doesn’t matter much indeed. |
Why run the workflow on pull requests though? The font should be built every time Lucide icons change, right? Also, but this is only a suggestion, I think it would make sense to make a new release with the font on version bumps. It would make it possible more easily to get the font of the latest release (as opposed to that of the latest commit), for more stability. For context, I’ll make an Arch package for the font and it would be nice to have two packages: |
@schmidt-oliver Thanks makes sense! The process probably can speed up if the processes are done in worker pools. Looks like SVGFixer doesn't do that yet. Could be a nice improvement. But that's aside I think it's ready to go then! @victorbnl As a maintainer I like to have workflows run as fast as possible. During a release, the font workflow is dependent on two other workflows that build packages. So that's why I'm not happy with this increase in time. But I will see if we can speed things up later. Also, the Font workflow is not running on all PRs, only if there are changes in: icons, font build scripts, and the package-lock file. Why? Because then we can know if the font process is still working correctly or if something has changed. |
I didn’t discuss the process speed, was it me you wanted to mention?
Well from what I understand the font created in this action is not directed towards end users but Lucide maintainers for testing then. In that case, where is the user who wants to use the font supposed to get it from? |
Interesting idea. I have never worked with worker pools before. The |
@schmidt-oliver I'm already working on it. See my PR: oslllo/svg-fixer#89 |
@ericfennis @schmidt-oliver @victorbnl Do we need to run the entire set of SVGs through the svg-fixer outline step on every build? I wonder if we could cache the intermediate outlined SVGs, and only rerun the outline step over those that have changed since the last build…? |
@danielbayley Sure, we could reuse them. Then we need to store the date or version number of each outlined icon during the outline step and compare it to its |
@ericfennis wrote here #1413 (comment):
I just wanted to note that the Whatever the problem is with also fetching the Edit: Fix typos |
@Finii So you're telling us that #514. Is not fixed? That's not what we wanted. But It is a bummer to hear that this is still not working correctly as we expected. |
@ericfennis This might be a half baked idea—I’m stretched too thin 😅—But could the general approach not be to save the associated codepoint of each icon as simply another property of it’s existing accompanying metadata file? Then in whatever post-merge automation, make use of |
@danielbayley Yeah I thought of this idea as well. This great solution for icons that will be renamed. But the problem is what to do with new icon PRs. If we have multiple PRs open which icon will get which |
@ericfennis Would this not cease to be a problem if we could make sure every PR was first
Isn’t the limit something like ~150,000 though? Not even I am going to churn out that many icons… 😅 |
Just as idea ...
That means almost no manual attention is needed. And I can not see the security reasons you mention. The workflow that is triggered on pulls to master can only be triggered by persons/processes that are allowed to pull to master. The workflow inherits that right, and can add one more commit on the fly. At Nerd Fonts for example we
See https://github.com/ryanoasis/nerd-fonts/blob/master/.github/workflows/zip-release.yml Edit: Add link to NF workflow |
@Finii We had something similar before, it was a workflow that updated our packages.json files after our releases in our GitHub repo. If you are doing it with the use of branch protection rules and without PATs, I really want to know how. I've searched a lot Internet for a solution but never found a solution. |
@Finii @ericfennis @danielbayley: We are creating a releaseJson file that contains all the information about icon releases and changes, including their timestamps. If it is possible to find out when an icon was deleted or renamed (a renamed icon could be handled like a deleted and a new one), it should be possible to take this into account when creating codepoints. But it's much more complex than the current algorithm. That approach would not need to store the codepoints. But every deletion have to be taken into account. Is it possible to find out when an icon was deleted? |
Moved font creation to node library svgtofont.
Fixes these Issues:
Because of a problem with path directions in outline-stroke (see #5) I moved the creation of outline SVGs to svg-fixer.
There are some options which could be changed in both build scripts. Please test yourself and change them if needed. Tried to adapt your code style. Updated the github workflow. I hope I didn't missed something.
New process:
Do not delete the created ./lucide-font folder. The info.json file that is created the first time contains the code points that will be used in the next execution. Existing code points will be reused. New Icons will be added after existing.Tested the whole process myself. But you should test it yourself before bringing it to production.