UNPKG

@tokens-studio/sdk

Version:
20 lines 728 B
import { TokenSetType } from '../../__generated__/graphql.js'; export function generateTokenSetsFiles(tokenSets) { const graphs = []; const sets = tokenSets.map((set) => { if (set.type === TokenSetType.Dynamic) { graphs.push({ filename: `${set.name}.tsgraph`, contents: JSON.stringify(set.source?.graph ?? {}, null, '\t'), mimeType: 'application/tsgraph', }); } return { filename: `${set.name}.json`, contents: JSON.stringify(set.raw ?? {}, null, '\t'), mimeType: 'application/json', }; }); return [...sets, ...graphs]; } //# sourceMappingURL=generateTokenSetsFiles.js.map