Skip to content

Commit 0242969

Browse files
committed
update normalize variable name util
1 parent fe6f130 commit 0242969

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

packages/tokens-studio-for-figma/src/plugin/pullVariables.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { VariableToCreateToken } from '@/types/payloads';
55
import { TokenTypes } from '@/constants/TokenTypes';
66
import { getVariablesWithoutZombies } from './getVariablesWithoutZombies';
77
import { TokenSetStatus } from '@/constants/TokenSetStatus';
8-
import { normalizeTokenName } from '@/utils/normalizeTokenName';
8+
import { normalizeVariableName } from '@/utils/normalizeVariableName';
99

1010
export default async function pullVariables(options: PullVariablesOptions, themes: ThemeObjectsList, proUser: boolean): Promise<void> {
1111
// @TODO should be specifically typed according to their type
@@ -60,7 +60,7 @@ export default async function pullVariables(options: PullVariablesOptions, theme
6060
collections.set(collection.name, collection);
6161
}
6262

63-
const variableName = normalizeTokenName(variable.name);
63+
const variableName = normalizeVariableName(variable.name);
6464
try {
6565
switch (variable.resolvedType) {
6666
case 'COLOR':
@@ -189,7 +189,7 @@ export default async function pullVariables(options: PullVariablesOptions, theme
189189

190190
const variableReferences = collectionVariables.reduce((acc, variable) => ({
191191
...acc,
192-
[normalizeTokenName(variable.name)]: variable.id,
192+
[normalizeVariableName(variable.name)]: variable.id,
193193
}), {});
194194

195195
themesToCreate.push({

packages/tokens-studio-for-figma/src/utils/normalizeTokenName.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export function normalizeVariableName(name: string) {
2+
const splitKey = name.split('/').map((part) => part.trim());
3+
const normalizedVariableName = splitKey.join('.');
4+
return normalizedVariableName;
5+
}

0 commit comments

Comments
 (0)