Specify CLI VS Specify SDK
Historically, if you wanted to convert your tokens to various outputs: CSS, Swift, Typescript... you could only distribute your tokens thanks to a configuration file. With the introduction of the SDK, you might want to know which option suits your needs, so let's compare them!
This page will be an overview of both options, so if you need more details, you can have look to the Specify CLI page, and the Specify SDK page.
Overview
Running parsers remotely
✅
✅
Running parsers locally
❌
✅
Update the tokens
✅
✅
Filter the tokens
✅
✅
Converting a token to a specific format
❌
✅
Create a custom output
❌
✅
Setup
CLI
In the case of the CLI, you'll first need to install the CLI:
npm install @specifyapp/cli yarn global add @specifyapp/cliAnd then create a .specifyrc.json :
{
"version": "2",
"repository": "@organization/repository",
"personalAccessToken": "<your-personal-access-token>",
"rules": []
}SDK
For the SDK, you'll first want to install the dependencies of the SDK, and the SDTF:
Then you, you have to create a file where we'll import all the installed dependencies:
Running a parser
CLI
We first need to fill up a bit the configuration file with the parser we want to run:
Then we can run everything through the CLI:
SDK
On the SDK side, there's two way of doing it.
Running parsers locally
The main interest of the SDK is to be able to run everything locally. To do so, you can do the following:
There's actually a way to choose which parser runs locally, and which one runs remotely, you can learn more about it here.
Running parsers remotely
Running parsers remotely is basically wrapping the configuration into the SDK:
Filtering the tokens
CLI
To do so, we'll need to introduce a new parser in the configuration file:
SDK
Because the SDK is loading the SDTF, we can work directly with it. No need to run a parser, we can just execute filtering methods, and then generate our tokens:
Updating tokens
CLI
Just like before, it can be done through a parser:
SDK
Again, as the SDK is loading the SDTF, we can work directly with it through the update method and an updater:
Converting a token to a specific format
CLI
This cannot be done with the CLI.
SDK
Here is an example of converting a token to CSS, more detals on the conversion can be found here.
Last updated
Was this helpful?