-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: Icon builder to library #8203
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
base: main
Are you sure you want to change the base?
Changes from all commits
eb2367f
e3197a6
f39c8f4
f66c302
fb79303
d0c6805
a974371
eb07253
c3cda55
d878af2
4405518
059fbab
b5a6263
165ec9c
5498369
d5cd442
c833bb5
2376198
935691d
40ece33
7a9e62f
809fc42
ec9fdf9
0909fb7
676fe82
fb15755
34ae776
6b2aca7
ff79bfe
86c431f
4d359dd
56e33aa
5675fb8
2d0cd4c
28fd7ab
cc1608d
1def4d4
e0d1c11
0b42921
22fd984
db3b804
cc0b9a1
0b06754
fd8932b
65f81ac
9d4930e
946b414
c549352
fecc412
1f59b63
92ac4e5
f3c2a03
9377246
efe0a83
ee66ef5
a9bb8ea
605cfef
19f2fbd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,28 @@ const path = require('path'); | |
module.exports = new Namer({ | ||
name({bundle}) { | ||
let mainAsset = bundle.getMainEntry(); | ||
|
||
if (!mainAsset?.filePath.includes('react-spectrum/packages')) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the same logic as below? Could the if conditions be merged? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, so open question about this due to ask for non-20 sized icons |
||
if (bundle.needsStableName && bundle.target.distEntry) { | ||
return bundle.target.distEntry; | ||
} | ||
let ext = '.' + bundle.type; | ||
if (bundle.type === 'js') { | ||
ext = bundle.env.outputFormat === 'esmodule' ? '.mjs' : '.cjs'; | ||
} | ||
let originalExt = path.extname(mainAsset.filePath); | ||
let name = path.basename(mainAsset.filePath, originalExt).replace(/\*/g, 'intlStrings'); | ||
|
||
return name | ||
.replace(/^S2_Icon_(.*?)(Size\d+)?_\d+(?:x\d+)?_N$/, '$1') | ||
.replace(/^S2_(fill|lin)_(.+)_(generic\d)_(\d+)$/, (m, type, name, style) => { | ||
name = name[0].toUpperCase() + name.slice(1).replace(/_/g, ''); | ||
return 'gradient/' + style + '/' + name; | ||
}) | ||
.replace(/\.module$/, '_module') | ||
+ ext; | ||
} | ||
|
||
if (mainAsset?.filePath.includes('@react-spectrum/s2')) { | ||
if (bundle.needsStableName && bundle.target.distEntry) { | ||
return bundle.target.distEntry; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"extends": "@parcel/config-default", | ||
"namers": ["@react-spectrum/parcel-namer-s2", "@parcel/namer-default"], | ||
"bundler": "@parcel/bundler-library", | ||
"transformers": { | ||
"*.svg": ["@react-spectrum/parcel-transformer-s2-icon"], | ||
"*.{js,mjs,jsm,jsx,es6,cjs,ts,tsx}": [ | ||
"@parcel/transformer-js", | ||
"@parcel/transformer-react-refresh-wrap" | ||
] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.DS_Store | ||
node_modules | ||
package-lock.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.
?