Socket
Book a DemoInstallSign in
Socket

@wrtnlabs/autoview-figma-cli

Package Overview
Dependencies
Maintainers
4
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wrtnlabs/autoview-figma-cli

Figma CLI for design token extraction using Personal Access Token

0.3.1
latest
Source
npmnpm
Version published
Weekly downloads
2
Maintainers
4
Weekly downloads
Β 
Created
Source

Figma CLI - Design Token Extractor & Project Generator

Personal Access Token을 μ‚¬μš©ν•˜μ—¬ Figma νŒŒμΌμ—μ„œ λ””μžμΈ 토큰을 μΆ”μΆœν•˜κ³ , boilerplate와 ν•¨κ»˜ μƒˆλ‘œμš΄ ν”„λ‘œμ νŠΈλ₯Ό μƒμ„±ν•˜λŠ” CLI λ„κ΅¬μž…λ‹ˆλ‹€.

πŸš€ μ£Όμš” κΈ°λŠ₯

🎨 λ””μžμΈ 토큰 μΆ”μΆœ (extract λͺ…λ Ήμ–΄)

  • πŸ” λŒ€ν™”ν˜• 토큰 μž…λ ₯: 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
  • CLI μ „μ—­ μ„€μΉ˜:
pnpm link --global
  • Figma Personal Access Token λ°œκΈ‰:
    • Figma Settings > Personal access tokensμ—μ„œ 토큰 생성

🎯 μ‚¬μš©λ²•

λͺ…λ Ήμ–΄ 1: extract - λ””μžμΈ 토큰 μΆ”μΆœ

κΈ°λ³Έ μ‚¬μš©λ²• (λŒ€ν™”ν˜•)

figma-cli extract

μ˜΅μ…˜μ„ μ‚¬μš©ν•œ μ‹€ν–‰

# 토큰과 URL 미리 제곡
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

# λ‹€λ₯Έ boilerplate μ €μž₯μ†Œ μ‚¬μš©
figma-cli create my-project --source github:your-org/your-boilerplate

# νŠΉμ • κ²½λ‘œμ— 생성
figma-cli create my-project --destination ./projects

# Private repositoryμ—μ„œ git clone μ‚¬μš©
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 정보 미리 제곡
figma-cli create my-project --token YOUR_TOKEN --url "https://www.figma.com/design/FILE_KEY/FILE_NAME"

πŸ” Private Repository 지원

방법 1: GitHub Token μ‚¬μš© (degit)

# GitHub 토큰을 ν™˜κ²½λ³€μˆ˜λ‘œ μ„€μ •
export GITHUB_TOKEN=ghp_xxxxxxxxxxxxxx

# Private repository μ‚¬μš© (degit 방식)
figma-cli create my-project --source github:your-org/private-boilerplate

방법 2: Git Clone μ‚¬μš©

# Git clone λ°©μ‹μœΌλ‘œ private repository 클둠
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 방식을 μ‚¬μš©ν•  λ•ŒλŠ” λ‹€μŒ 쀑 ν•˜λ‚˜μ˜ 인증 방법이 ν•„μš”ν•©λ‹ˆλ‹€:

  • SSH ν‚€ μ„€μ •

    # SSH URL μ‚¬μš©
    figma-cli create my-project --source git@github.com:your-org/private-repo.git --use-git
    
  • GitHub CLI 둜그인

    gh auth login
    figma-cli create my-project --source github:your-org/private-repo --use-git
    

🎨 μƒμ„±λ˜λŠ” νŒŒμΌλ“€ (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 {
  /* Colors */
  --color-blue-500: #71a9dc;
  --color-pink-400: #e6bce6;
  --color-system-blue-000: #2388f3;

  /* μΆ”κ°€λœ 색상듀... */
}

TypeScript νƒ€μž… μ˜ˆμ‹œ

// Auto-generated design tokens from Figma

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;

πŸ“‹ λͺ…λ Ήμ–΄ μ˜΅μ…˜

extract λͺ…λ Ήμ–΄ μ˜΅μ…˜

  • -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

# κ²°κ³Ό: Figma 토큰이 ν†΅ν•©λœ μ™„μ„±λœ ν”„λ‘œμ νŠΈ

Private Repository μ‚¬μš© μ˜ˆμ‹œ

# Private boilerplate + Figma 토큰 톡합
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"

πŸ›  개발 μ›Œν¬ν”Œλ‘œμš°

# 1. 토큰 μΆ”μΆœ + ν”„λ‘œμ νŠΈ 생성
figma-cli create my-project

# 2. ν”„λ‘œμ νŠΈ λ””λ ‰ν† λ¦¬λ‘œ 이동
cd my-project

# 3. μ˜μ‘΄μ„± μ„€μΉ˜
npm install

# 4. 개발 μ„œλ²„ μ‹œμž‘
npm run dev

🚨 문제 ν•΄κ²°

Degit μ‹€νŒ¨ μ‹œ

# Private repository인 경우
figma-cli create my-project --source github:org/repo --use-git

# λ˜λŠ” GitHub token μ„€μ •
export GITHUB_TOKEN=ghp_xxxxxxxxxxxxxx
figma-cli create my-project --source github:org/private-repo

Git Clone μ‹€νŒ¨ μ‹œ

# SSH ν‚€ μ„€μ • 확인
ssh -T git@github.com

# λ˜λŠ” HTTPS 인증 μ„€μ •
gh auth login

πŸ“Š 좜λ ₯ ν˜•μ‹ (extract λͺ…λ Ήμ–΄)

μΆ”μΆœλœ λ””μžμΈ 토큰은 λ‹€μŒκ³Ό 같은 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"
    }
  ]
}

FAQs

Package last updated on 03 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.