-
Notifications
You must be signed in to change notification settings - Fork 0
Build esm
and cjs
versions of nimbus-icons
to insure compatibility in non-esm environments (eg jest)
#91
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
packages/nimbus-icons/package.json
Outdated
@@ -1,9 +1,22 @@ | |||
{ | |||
"name": "@commercetools/nimbus-icons", | |||
"version": "0.0.2", | |||
"version": "0.0.3-rc1", | |||
"main": "dist/index.js", | |||
"module": "./dist/index.js", | |||
"types": "./dist/index.d.ts", |
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.
Is anything speaking against adding "sideEffects": false
to the package.json? I tried it on my blank-app branch cause the empty (!) app was huge. And it shoved off roughly a Megabyte:
"types": "./dist/index.d.ts", | |
"types": "./dist/index.d.ts", | |
"sideEffects": false, |
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.
done
0779e9e
to
c884e18
Compare
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.
LGTM 👍
…ignore in nimbus-icons to ignore everything in /material-icons but keep the folder so that its there for vercel hopefully
…ild:icons runs first in build script
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.
As mentioned, I got this build-process working without the need to commit the 2k+ icons. Feel free to hijack the branch or incorporate the changes into this one.
packages/nimbus-icons/package.json
Outdated
@@ -20,7 +33,7 @@ | |||
}, | |||
"scripts": { | |||
"build-icons": "pnpm svgr --filename-case kebab --typescript --jsx-runtime automatic --out-dir src/material-icons node_modules/@material-design-icons/svg/outlined", | |||
"build": "pnpm run build-icons && tsc", | |||
"dev": "tsc" | |||
"build": "pnpm run build-icons && tsc --project tsconfig.esm.json & tsc --project tsconfig.cjs.json", |
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.
I managed to get the build-process to work without committing the icons. The only "significant" change I did was running the two tsc tasks in sequence instead of in parallel/in the background:
"build": "pnpm run build-icons && tsc --project tsconfig.esm.json & tsc --project tsconfig.cjs.json", | |
"build": "pnpm run build-icons && tsc --project tsconfig.esm.json && tsc --project tsconfig.cjs.json", |
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.
Orca Security Scan Summary
Status | Check | Issues by priority | |
---|---|---|---|
![]() |
Infrastructure as Code | ![]() ![]() ![]() ![]() |
View in Orca |
![]() |
SAST | ![]() ![]() ![]() ![]() |
View in Orca |
![]() |
Secrets | ![]() ![]() ![]() ![]() |
View in Orca |
![]() |
Vulnerabilities | ![]() ![]() ![]() ![]() |
View in Orca |
☢️ The following Vulnerabilities (CVEs) have been detected
PACKAGE | FILE | CVE ID | INSTALLED VERSION | FIXED VERSION | ||
---|---|---|---|---|---|---|
![]() |
trim-newlines | ./pnpm-lock.yaml | CVE-2021-33623 | 1.0.0 | 3.0.1, 4.0.1 | View in code |
This pull request includes updates to the
@commercetools/nimbus-icons
package, focusing on restructuring its build process, modifying the package configuration, and adding new material icon components. The most significant changes include updates to thepackage.json
file for better module support, adjustments to the.gitignore
file, and the addition of multiple new material icon components.Build and configuration updates:
packages/nimbus-icons/package.json
to include separate CommonJS (cjs
) and ES Module (esm
) builds, addedsideEffects
for tree-shaking, and definedexports
for better module resolution. Updated the version to0.0.4
.package.json
to use separate TypeScript configurations (tsconfig.esm.json
andtsconfig.cjs.json
) foresm
andcjs
builds..gitignore
to ignore all files insrc/material-icons/
instead of the directory itself.New material icon components:
10k.tsx
,10mp.tsx
,11mp.tsx
, and1k.tsx
, each implementing a React component withforwardRef
for better integration and accessibility. [1] [2] [3] [4] etc.)