mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-27 20:49:53 +08:00
chore: update token-meta structure
This commit is contained in:
parent
705575a2af
commit
da097e63bf
@ -102,12 +102,14 @@ const TokenTable: FC<TokenTableProps> = ({ type }) => {
|
||||
|
||||
const data = useMemo<TokenData[]>(
|
||||
() =>
|
||||
tokenMeta[type].map((token) => ({
|
||||
name: token.token,
|
||||
desc: lang === 'cn' ? token.desc : token.descEn,
|
||||
type: token.type,
|
||||
value: (defaultToken as any)[token.name],
|
||||
})),
|
||||
Object.entries(tokenMeta)
|
||||
.filter(([, meta]) => meta.source === type)
|
||||
.map(([token, meta]) => ({
|
||||
name: token,
|
||||
desc: lang === 'cn' ? meta.desc : meta.descEn,
|
||||
type: meta.type,
|
||||
value: (defaultToken as any)[token],
|
||||
})),
|
||||
[type, lang],
|
||||
);
|
||||
|
||||
|
@ -65,7 +65,21 @@ function main() {
|
||||
(item) => !tokenMeta.seed.some((seedItem) => seedItem.token === item.token),
|
||||
);
|
||||
|
||||
fs.writeJsonSync(output, tokenMeta, 'utf8');
|
||||
const finalMeta = Object.entries(tokenMeta).reduce((acc, [key, value]) => {
|
||||
value.forEach((item) => {
|
||||
acc[item.token] = {
|
||||
name: item.name,
|
||||
nameEn: item.nameEn,
|
||||
desc: item.desc,
|
||||
descEn: item.descEn,
|
||||
type: item.type,
|
||||
source: key,
|
||||
};
|
||||
});
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
fs.writeJsonSync(output, finalMeta, 'utf8');
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`✅ Token Meta has been written to ${output}`);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user