-
Notifications
You must be signed in to change notification settings - Fork 25
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
Fct 1311 - icons bundle 2 #3014
Conversation
🦋 Changeset detectedLatest commit: 05e1e9c The changes in this PR will be included in the next version bump. This PR includes changesets to release 98 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
Awesome! 🎉
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.
Super duper work. Many thanks!
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.
Thanks for going deeper on this! I cant see a diff in SVGR template strangely. By each preconstruct entry we enable the tree shake-ability?
echo "Ignoring PR because of the branch name. Exiting workflow." | ||
exit 1 | ||
fi | ||
# - name: Validate branch name |
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.
Should this be re-added?
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.
yes, although it should be updated/fixed in another PR
@@ -0,0 +1,4 @@ | |||
{ | |||
"main": "dist/commercetools-uikit-icons-generated-ImportReact.cjs.js", |
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.
Should we kebab case the package name part which is the icon?
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.
everything in packages/icons/generated
is auto-generated by preconstruct when you run preconstruct dev
or preconstruct build
, and there is no way to configure the naming format in preconstruct.
Sorry for re-reviewing. Disregard. Just things that appear to the eye when reviewing thrice ;) |
@@ -22,10 +22,17 @@ | |||
"./index.ts", | |||
"./custom-icon/index.ts", | |||
"./inline-svg/index.ts", | |||
"./leading-icon/index.ts" | |||
"./leading-icon/index.ts", | |||
"./generated/*.tsx" |
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.
This glob tells preconstruct that each of the icons should have an entrypoint in the package.
"custom-icon", | ||
"inline-svg", | ||
"leading-icon", | ||
"generated/**" |
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.
This glob tells preconstruct that we expect the dist/package.json for each icon to be in the generated
folder.
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.
nice doc!
179c258
to
05e1e9c
Compare
… remove unnecessary styling boilerplate from icons template
…ls-ui-kit/icons namespace, remove unnecessary pure annotations from icon template in svgr.config.js, add CONTRIBUTING.md file explaining how to add/update/remove icons in ui kit
…add preview branch name check back into preview-release github workflow
…o @commercetools-uikit/icons for backwards compatibility reasons
05e1e9c
to
8615362
Compare
Updates the SVGR template for generating icons, results in a substantial reduction in bundle size for ui kit icons, as shown in screenshots.
Implements a unique entrypoint for each icon, which enables better tree shaking in consuming applications. This results in a substantial decrease in bundle size for consuming applications, since they can bundle only necessary icons, as shown in the third screenshot.
From 1.35MB to 287kb unzipped, from 341kb to 201kb parsed, from 46kb to 38kb gzipped.
Previous:
Without unique entrypoints:
WITH UNIQUE ENTRYPOINTS FOR EACH ICON: