File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ const formatTokens = (
4040 const result = { }
4141 Object . keys ( allTokenObj ) . forEach ( ( key ) => {
4242 const keys = key . split ( '.' ) . filter ( ( k ) => k !== type )
43- makeSdObject ( result , keys , allTokenObj [ key ] )
43+ makeSdObject ( result , keys , allTokenObj [ key ] , keys [ 0 ] !== 'typography' )
4444 } )
4545
4646 return JSON . stringify ( result , null , 2 )
Original file line number Diff line number Diff line change @@ -8,11 +8,17 @@ export const addHyphen = (str: string) => {
88export const makeSdObject = < T extends readonly string [ ] > (
99 obj : SdObjType < { [ key : string ] : any } > ,
1010 keys : T ,
11- value : string
11+ value : string ,
12+ setCasing : boolean
1213) : void => {
1314 const lastIndex = keys . length - 1
1415 for ( let i = 0 ; i < lastIndex ; ++ i ) {
15- const key = camelCase ( keys [ i ] )
16+ let key = keys [ i ] ;
17+
18+ if ( setCasing ) {
19+ key = camelCase ( keys [ i ] ) ;
20+ }
21+
1622 if ( ! ( key in obj ) ) {
1723 obj [ key ] = { }
1824 }
@@ -21,6 +27,10 @@ export const makeSdObject = <T extends readonly string[]>(
2127
2228 // https://v2.tailwindcss.com/docs/upgrading-to-v2#update-default-theme-keys-to-default
2329 if ( keys [ lastIndex ] === 'DEFAULT' ) {
30+ setCasing = false ;
31+ }
32+
33+ if ( ! setCasing ) {
2434 obj [ keys [ lastIndex ] ] = value
2535 } else {
2636 obj [ camelCase ( keys [ lastIndex ] ) ] = value
You can’t perform that action at this time.
0 commit comments