Skip to content

Commit

Permalink
feat: use env var
Browse files Browse the repository at this point in the history
  • Loading branch information
Niznikr committed Jan 29, 2025
1 parent 4c23666 commit ef3ff80
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/tokens/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { Variable } from './types';

import JsonToTS from 'json-to-ts';
import StyleDictionary from 'style-dictionary';
import { formats, transformGroups, transforms } from 'style-dictionary/enums';
import { formats, transformGroups, transformTypes, transforms } from 'style-dictionary/enums';
import { fileHeader, minifyDictionary, usesReferences } from 'style-dictionary/utils';

import { css, themes } from './themes';
Expand Down Expand Up @@ -366,7 +366,7 @@ StyleDictionary.registerFormat({

StyleDictionary.registerTransform({
name: 'custom/value/name',
type: 'attribute',
type: transformTypes.attribute,
transform: (token) => {
token.$value = token.name;
return token;
Expand All @@ -375,7 +375,7 @@ StyleDictionary.registerTransform({

StyleDictionary.registerTransform({
name: 'attribute/font',
type: 'attribute',
type: transformTypes.attribute,
filter: (token) => token.$type === 'file',
transform: (token) => ({
category: token.path[0],
Expand Down
5 changes: 3 additions & 2 deletions packages/tokens/src/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import defaultTokens from '../dist/figma.default.json';
import { FigmaApi } from './figma';
import { generatePostVariablesPayload } from './variables';

// https://github.com/gerard-figma/figma-variables-to-styledictionary
const main = async () => {
const fileKey = '';
const api = new FigmaApi('');
const fileKey = process.env.FIGMA_FILE_KEY ?? '';
const api = new FigmaApi(process.env.FIGMA_TOKEN ?? '');

const localVariables = await api.getLocalVariables(fileKey);

Expand Down

0 comments on commit ef3ff80

Please sign in to comment.