Personal Access Tokenμ μ¬μ©νμ¬ Figma νμΌμμ λμμΈ ν ν°μ μΆμΆνκ³ , boilerplateμ ν¨κ» μλ‘μ΄ νλ‘μ νΈλ₯Ό μμ±νλ CLI λꡬμ
λλ€.
π μ£Όμ κΈ°λ₯
- π λνν ν ν° μ
λ ₯: Personal Access Tokenμ μμ νκ² μ
λ ₯λ°μ΅λλ€
- π μ μ°ν νμΌ μ§μ : URL λλ νμΌ ν€λ‘ Figma νμΌμ μ κ·Ό
- π λ€μν URL νμ μ§μ: κΈ°μ‘΄
/file/ νμκ³Ό μλ‘μ΄ /design/ νμ λͺ¨λ μ§μ
- π μλ νμΌ μ μ₯: JSON νμμΌλ‘ λμμΈ ν ν°μ μ μ₯
π οΈ νλ‘μ νΈ μμ± (create λͺ
λ Ήμ΄)
- μ¬μΈμ μ루μ
: ν λͺ
λ Ήμ΄λ‘ boilerplate ν΄λ‘ + Figma ν ν° μΆμΆ + νλ‘μ νΈ μ€μ μλ£
- Private/Public Repository μ§μ: GitHub token λλ git clone λ°©μ μ ν κ°λ₯
- μλ ν ν° ν΅ν©: CSS Variables, TypeScript νμ
μ μ μλ μμ±
- λνν μΈν°νμ΄μ€: λ¨κ³λ³ μλ΄λ‘ μ¬μ΄ νλ‘μ νΈ μμ±
π― μ§μνλ ν ν° νμ
- Color Styles: Figmaμμ μ μν μμ μ€νμΌ
- Typography Styles: ν
μ€νΈ μ€νμΌ
- Variables: Figma Variables (μμ, μ«μ, λ¬Έμμ΄, λΆλ¦°)
- Collections: λ³μ 컬λ μ
μ 보
π¦ μ€μΉ λ° μ€μ
cd apps/figma-cli
pnpm install
pnpm build
pnpm link --global
- Figma Personal Access Token λ°κΈ:
π― μ¬μ©λ²
κΈ°λ³Έ μ¬μ©λ² (λνν)
figma-cli extract
μ΅μ
μ μ¬μ©ν μ€ν
figma-cli extract --token YOUR_TOKEN --url "https://www.figma.com/design/FILE_KEY/FILE_NAME"
figma-cli extract --output ./my-tokens.json
export FIGMA_ACCESS_TOKEN=your_token_here
figma-cli extract --url "https://www.figma.com/design/FILE_KEY/FILE_NAME"
λͺ
λ Ήμ΄ 2: create - νλ‘μ νΈ μμ± (NEW!)
κΈ°λ³Έ μ¬μ©λ²
figma-cli create my-awesome-project
κ³ κΈ μ΅μ
figma-cli create my-project --skip-tokens
figma-cli create my-project --source github:your-org/your-boilerplate
figma-cli create my-project --destination ./projects
figma-cli create my-project --source github:your-org/private-repo --use-git
figma-cli create my-project --source github:your-org/repo --use-git --branch develop
figma-cli create my-project --token YOUR_TOKEN --url "https://www.figma.com/design/FILE_KEY/FILE_NAME"
π Private Repository μ§μ
λ°©λ² 1: GitHub Token μ¬μ© (degit)
export GITHUB_TOKEN=ghp_xxxxxxxxxxxxxx
figma-cli create my-project --source github:your-org/private-boilerplate
λ°©λ² 2: Git Clone μ¬μ©
figma-cli create my-project --source github:your-org/private-repo --use-git
figma-cli create my-project \
--source github:your-org/private-repo \
--use-git \
--branch develop
Git μΈμ¦ μ€μ
Git clone λ°©μμ μ¬μ©ν λλ λ€μ μ€ νλμ μΈμ¦ λ°©λ²μ΄ νμν©λλ€:
π¨ μμ±λλ νμΌλ€ (create λͺ
λ Ήμ΄)
CLIλ λ€μ νμΌλ€μ μλμΌλ‘ μμ±ν©λλ€:
my-project/
βββ src/
β βββ styles/
β β βββ tokens.css # CSS Variables
β βββ tokens/
β βββ index.ts # TypeScript νμ
μ μ
βββ design-tokens.json # μλ³Έ ν ν° JSON
βββ package.json # νλ‘μ νΈλͺ
μ
λ°μ΄νΈλ¨
βββ README.md # νλ‘μ νΈλͺ
μ
λ°μ΄νΈλ¨
CSS Variables μμ
:root {
--color-blue-500: #71a9dc;
--color-pink-400: #e6bce6;
--color-system-blue-000: #2388f3;
}
TypeScript νμ
μμ
export type ColorToken = "blue-500" | "pink-400" | "system-blue-000";
export const colors = {
"blue-500": "#71a9dc",
"pink-400": "#e6bce6",
"system-blue-000": "#2388f3",
} as const;
π λͺ
λ Ήμ΄ μ΅μ
-t, --token <token>: Figma Personal Access Token (μ νμ¬ν)
-u, --url <url>: Figma νμΌ URL (μ νμ¬ν)
-k, --key <key>: Figma νμΌ ν€ (μ νμ¬ν)
-o, --output <path>: μΆλ ₯ νμΌ κ²½λ‘ (κΈ°λ³Έκ°: ./design-tokens.json)
-j, --json <path>: μΆκ° JSON νμΌμμ λ³μ μΆμΆ
-v, --variable <name>: JSON νμΌμμ μΆμΆν λ³μλͺ
create λͺ
λ Ήμ΄ μ΅μ
-s, --source <url>: Boilerplate Git μ μ₯μ URL (κΈ°λ³Έκ°: github:wrtnlabs/autoview-boilerplate)
-d, --destination <path>: μμ±ν λλ ν 리 (κΈ°λ³Έκ°: νμ¬ λλ ν 리)
--skip-tokens: Figma ν ν° μΆμΆ 건λλ°κΈ°
--use-git: Git clone μ¬μ© (private repoμ©)
--branch <branch>: ν΄λ‘ ν λΈλμΉ (git clone μ¬μ©μ)
-t, --token <token>: Figma Personal Access Token (μ νμ¬ν)
-u, --url <url>: Figma νμΌ URL (μ νμ¬ν)
-k, --key <key>: Figma νμΌ ν€ (μ νμ¬ν)
π μ¬μ© μμ
μμ μλνλ μν¬νλ‘μ°
export FIGMA_ACCESS_TOKEN=figd_xxxxxxxxxxxxxx
export GITHUB_TOKEN=ghp_xxxxxxxxxxxxxx
figma-cli create design-system-app
Private Repository μ¬μ© μμ
figma-cli create my-company-project \
--source github:my-company/private-boilerplate \
--use-git \
--branch company-template \
--token figd_xxxxxxxxxxxxxx \
--url "https://www.figma.com/design/FILE_KEY/FILE_NAME"
ν ν° μΆμΆλ§ νκΈ°
figma-cli extract --token figd_xxxxxxxxxxxxxx --url "https://www.figma.com/design/FILE_KEY/FILE_NAME"
π κ°λ° μν¬νλ‘μ°
figma-cli create my-project
cd my-project
npm install
npm run dev
π¨ λ¬Έμ ν΄κ²°
Degit μ€ν¨ μ
figma-cli create my-project --source github:org/repo --use-git
export GITHUB_TOKEN=ghp_xxxxxxxxxxxxxx
figma-cli create my-project --source github:org/private-repo
Git Clone μ€ν¨ μ
ssh -T git@github.com
gh auth login
μΆμΆλ λμμΈ ν ν°μ λ€μκ³Ό κ°μ JSON νμμΌλ‘ μ μ₯λ©λλ€:
{
"colors": [
{
"name": "Primary Blue",
"description": "Main brand color",
"type": "color",
"value": "rgba(0, 123, 255, 1)",
"source": "style"
}
],
"typography": [
{
"name": "Heading 1",
"description": "Main heading style",
"type": "typography",
"value": {
"fontFamily": "Inter",
"fontSize": 32,
"fontWeight": 700,
"lineHeight": "normal"
},
"source": "style"
}
]
}