-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: update color token publisher plugin (#1831)
Co-authored-by: rzpcibot <tools+cibot@razorpay.com>
- Loading branch information
1 parent
e1d6207
commit a426e3a
Showing
26 changed files
with
4,192 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "Token Publisher", | ||
"id": "00000000", | ||
"api": "1.0.0", | ||
"main": "dist/plugin.js", | ||
"ui": "dist/ui.html", | ||
"editorType": ["figma"], | ||
"menu": [ | ||
{ "name": "Publish Global Color Tokens", "command": "globalColorTokens" }, | ||
{ "name": "Publish Theme Color Tokens", "command": "themeColorTokens" }, | ||
{ "name": "Generate Token's Dev Names", "command": "devTokenNames" } | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
import makeGlobalColorTokens from './makeGlobalColorTokens'; | ||
import makeThemeColorTokens from './makeThemeColorTokens'; | ||
import makeDevTokenNames from './makeDevTokenNames'; | ||
import showNotification from './showNotification'; | ||
figma.showUI(__html__, { visible: false, width: 350, height: 250 }); | ||
|
||
console.log(figma.command); | ||
|
||
if (figma.command === 'globalColorTokens') { | ||
makeGlobalColorTokens(); | ||
} else if (figma.command === 'themeColorTokens') { | ||
makeThemeColorTokens(); | ||
} else if (figma.command === 'devTokenNames') { | ||
makeDevTokenNames(); | ||
} | ||
|
||
figma.ui.onmessage = (message: any): void => { | ||
showNotification({ figma, type: message.type, text: message.text }); | ||
}; |
15 changes: 15 additions & 0 deletions
15
packages/plugin-figma-token-publisher/src/plugin/makeDevTokenNames.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import showNotification from './showNotification'; | ||
|
||
const makeDevTokenNames = (): void => { | ||
const variables = figma.variables.getLocalVariables(); | ||
variables.forEach((variable) => { | ||
variable.setVariableCodeSyntax('WEB', variable.name.replace(/\//g, '.')); | ||
}); | ||
showNotification({ | ||
figma, | ||
type: 'information', | ||
text: '✅ Dev friendly token names generated!', | ||
}); | ||
}; | ||
|
||
export default makeDevTokenNames; |
Oops, something went wrong.