v0.8.0
Upgrading from v0.7.x to v0.8.0 requires a few changes.
The main update in v0.8.0 is support for the new Figma API rate limit, which takes effect on November 17.
What's new
FigmaRestApi: A utility class for retrieving data from Figma for code generation. It was designed to handle rate limits automatically.
Breaking changes
<AnimaSdkProvider />now requires a new prop:figmaRestApi- The hook
useFigmaFilemust now be called within<AnimaSdkProvider /> - The following styling options were removed from
CodegenSettings:"css_modules" | "styled_components" | "sass" | "scss"
Minor changes
- The type
ProgressMessagewas updated, adding the propertytype: "info" | "rate_limit"
Migration steps
The main step to migrate from v0.7.x to v0.8.0 is to create an instance of FigmaRestApi and pass it to <AnimaSdkProvider />
1 - Create an instance of FigmaRestApi:
import { FigmaRestApi } from "@animaapp/anima-sdk";
const figmaRestApi = new FigmaRestApi({
defaultOptions: { // Optional.
token: "Figma Token", // Must start with `figd_` or `figu_`
},
});2 - Pass it to <AnimaSdkProvider />:
<AnimaSdkProvider
figmaRestApi={figmaRestApi}
...For full details, see the README.
Testing
You can test the new progress messages for rate limiting using the following Figma file key:
- Short rate limit: Use
Y1TdquDVUkEVetLzKOXAp8to simulate a 10-second wait. - Rate limit exceeded: Use
AwhyxD3hSAcPDxedRjckbsto trigger a rate limit exceeded exception. It'll abort the code generation.