@ama-styling/figma-extractor
v14.3.1
Published
Tools to extract Design Token from the Figma files
Readme
This package is an Otter Framework Module.
Description
This module will extract the Design Token metadata from a given Figma file.
How to execute
The package exposes to commands: extract-file and extract-project.
The 2 commands extract the Design Tokens from a single file but the extract-project will determine the file to extract based on the filename pattern and the versions extract from it.
Common Options
| Option | Env Variables | Descriptions |
| -- | -- | -- |
| --help | | Show help |
| -a, --accessToken [string] | FIGMA_TOKEN | Access Token to read the Figma File information |
| -o, --output [string] | FIGMA_OUTPUT | Folder to extract the Design Token to |
| -n, --name [string] | FIGMA_DT_NAME | Name of the Design Token collection (default: "Design Tokens") |
| --verbose | | Determine if the logger display debug messages (default: false) |
| -q, --quiet | | Determine if it should ignore message in the console (default: false) |
| -g, --generatePackage | | Request the generation of the NPM package.json (default: false) |
| --packageName [string] | | Version of the Design Token collection (if not provided, the name option value will be used) |
Extract single Figma File
Extract the Design Tokens from a single Figma file.
npx @ama-styling/figma-extractor extract-file <fileKey> [options]Extract Figma Project
Extract the Design Tokens from a Figma file part of a project.
npx @ama-styling/figma-extractor extract-project <projectKey> [options]The following options are dedicated to the extract-project command:
| Option | Env Variables | Descriptions | | -- | -- | -- | | -P, --filenamePattern [string] | FIGMA_PROJECT_FILENAME_MATCHER | Pattern of the filename, capturing its version, to match in the project (default: "v((?:[0-9]+\.){0,2}[0-9]+(?:-[^ ]+)?)$") | | --versionRange | | Restricted range of versions of the File to be considered | | projectKey [string] | FIGMA_PROJECT_KEY | Figma Project Key where is the file to extract |
Setup automation
A complete documentation is available on Figma Extractor documentation
