Skip to content

Commit

Permalink
refactor(icon-import): change alias separator to comma (#1885)
Browse files Browse the repository at this point in the history
In our Figma icon file, not all icon aliases were separated correctly
(some used `|`, others `,`).
This is not aligned in Figma to always use comma so we also reflect this
change in our CLI.
  • Loading branch information
larsrickert committed Sep 18, 2024
1 parent 516c9f5 commit 33700f9
Show file tree
Hide file tree
Showing 7 changed files with 218 additions and 156 deletions.
15 changes: 15 additions & 0 deletions .changeset/fast-rivers-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
"@sit-onyx/icons": minor
---

feat: update icons

Also fixed icon aliases in the metadata for most icons which are now separated correctly

#### New icons

- heptagon-cloud-foundry

#### Modified icons

- sidebar-arrow-right
10 changes: 10 additions & 0 deletions .changeset/swift-fans-rhyme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@sit-onyx/figma-utils": major
---

refactor(icon-import): change alias separator to comma

To use the previous behavior, change the alias separator to `|`:

- if using CLI: add flag `-s "|"`
- if using function: `parseComponentsToIcons({ aliasSeparator: "|" })`
2 changes: 1 addition & 1 deletion packages/figma-utils/src/commands/import-icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const importIconsCommand = new Command("import-icons")
.option(
"-s, --alias-separator <string>",
"Separator for icon alias names (which can be set to the component description in Figma).",
"|",
",",
)
.action(importIconsCommandAction);

Expand Down
4 changes: 2 additions & 2 deletions packages/figma-utils/src/icons/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export type ParseIconComponentsOptions = {
/**
* Separator for icon alias names (which can be set to the component description in Figma).
*
* @default "|"
* @default ","
*/
aliasSeparator?: string;
};
Expand All @@ -28,7 +28,7 @@ export const parseComponentsToIcons = (options: ParseIconComponentsOptions): Par
id: component.node_id,
name: component.name,
aliases: component.description
.split(options.aliasSeparator ?? "|")
.split(options.aliasSeparator ?? ",")
.map((alias) => alias.trim())
.filter((i) => i !== ""),
category: component.containing_frame.name.trim(),
Expand Down
1 change: 1 addition & 0 deletions packages/icons/src/assets/heptagon-cloud-foundry.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/icons/src/assets/sidebar-arrow-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 33700f9

Please sign in to comment.