0.0.2-alpha.5 • Published 1 year ago

@spacefold/tokens v0.0.2-alpha.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Spacefold Tokens

Simplify your digital product. Always keep your design tokens up to date.

Getting started

Global installation

# yarn
yarn global add @spacefold/tokens

# npm
npm install -g @spacefold/tokens

Local installation (recommended)

# yarn
yarn add -D @spacefold/tokens

# npm
npm install -D @spacefold/tokens

Update / generate your tokens

It's that simple.

# yarn
yarn spacefold-tokens

# npx
npx spacefold-tokens

Configuration

You've got two options to override the configuration's defaults. Either you use a config file or CLI arguments.

Default config

Below is the complete set of what you can configure, together with the defaults.

Don't worry, overriding all of the defaults is explained right below.

{
  "debugMode": false,
  "authToken": "",
  "projectId": "",
  "figmaFileVersion": "published",
  "tokensDirectoryName": "tokens",
  "tokensFileName": "tokens.json",
  "converter": {}
}

Config file

You'll need to use a JSON-formated configuration file at the root of your project to use its settings.

Spacefold Tokens will pick up the path by assessing the current working directory and looking for a .spacefoldrc file there.

If it finds it, it will use it.

See the config features.

CLI arguments

You can run the spacefold-token command w/ arguments in your command line environment of choice.

🚨 The CLI arguments will override your .spacefoldrc config file and .env variables.

See the config features.

All configuration features

FeatureDescription
Debug modeToggle debug mode.
Spacefold auth tokenYour authentication token (to get on Spacefold).
Spacefold project idThe Spacefold project id your dev env is rattached to.
Figma files versionWhich Figma version type to sync with. Published, saved or live.
Design tokens directory nameThe directory name in which your design tokens' json file will be saved.
Design tokens file nameThe filename (w/ extension) in which your design tokens will be written.
Design tokens converter configConvert your design tokens into another language (like SCSS for example).

Debug mode

Toggle debug mode.

Default is false.

RC file

{
  ...
  "debug": true | false,
  ...
}

CLI

spacefold-tokens [--debug | -d]

Spacefold auth token

Your authentication token (get it on Spacefold). You need to specify it in order to use Spacefold services.

You can pass your auth token three different ways:

  • Using the .spacefoldrc file and hardcoding it inside (not recommended).
  • Using a .env file w/ a SPACEFOLD_AUTH_TOKEN variable inside it (default variable name).
  • Using a .env file. Specifying a custom .env variable name in your .spacefoldrc file.
  • Using CLI.

Default is "".

RC file hardcoded

// RC file
{
  ...
  "authToken": "you can hardcode your auth token (not recommended)",
  ...
}

.env w/ default variable name

# .env file

SPACEFOLD_AUTH_TOKEN="paste your auth token here"

.env w/ custom variable name

// RC file
{
  ...
  "authToken": "CUSTOM_VAR_NAME",
  ...
}
# .env file

CUSTOM_VAR_NAME="paste your auth token here"

CLI

spacefold-tokens [--authToken | -at] [paste your auth token]

Spacefold project id

The Spacefold project id your dev env is rattached to.

Default is ''.

RC file

{
  ...
  "projectId": '',
  ...
}

CLI

spacefold-tokens [--projectId | -id] [paste your project id]

Figma files version

Which Figma version type to sync with. Published, saved or live.

Default is 'published'.

RC file

{
  ...
  "figmaFileVersion": 'published' | 'saved' | 'live',
  ...
}

CLI

spacefold-tokens [--figmaFileVersion | -fv] [published | saved | live]

Design tokens directory name

The directory name in which your design tokens' json file will be saved.

Default is 'tokens'.

RC file

{
  ...
  "tokensDirectoryName": '',
  ...
}

CLI

spacefold-tokens [--tokensDirectoryName | -tdir] [dirname]

Design tokens file name

The filename (w/ extension) in which your design tokens will be written.

Default is 'tokens.json'.

RC file

{
  ...
  "tokensFileName": '',
  ...
}

CLI

spacefold-tokens [--tokensFileName | -tfile] [filename]

Design tokens converter config

To use your design tokens in Javascript or Typescript you can exploit the design tokens' JSON file. But some of you will need to use these tokens in other languages like LESS, SASS, etc.

With this feature you can convert your design tokens into other languages.

List of supported languages: |Languages| |---| |SCSS|

RC file

{
  ...
  "converter": {
    "languageName": {
      "path": './directory/filename.extension'
    },
    // real life example
    "scss": {
      "path": './assets/scss/_tokens.scss'
    },
  },
  ...
}

CLI

To convert your design tokens into a specific language you'll necessarily need to use the config file. A tokens converter config would be too verbose w/ CLI arguments.

0.0.2-alpha.4

1 year ago

0.0.2-alpha.5

1 year ago

0.0.2-alpha.2

2 years ago

0.0.2-alpha.3

2 years ago

0.0.1

3 years ago

0.0.1-alpha.24

3 years ago

0.0.1-alpha.23

3 years ago

0.0.1-alpha.22

3 years ago

0.0.1-alpha.21

3 years ago

0.0.1-alpha.20

3 years ago

0.0.1-alpha.18

3 years ago

0.0.1-alpha.19

3 years ago

0.0.1-alpha.16

3 years ago

0.0.1-alpha.17

3 years ago

0.0.1-alpha.14

3 years ago

0.0.1-alpha.13

3 years ago

0.0.1-alpha.15

3 years ago

0.0.1-alpha.12

3 years ago

0.0.1-alpha.11

3 years ago

0.0.1-alpha.10

3 years ago

0.0.1-alpha.9

3 years ago

0.0.1-alpha.6

3 years ago

0.0.1-alpha.7

3 years ago

0.0.1-alpha.5

3 years ago

0.0.1-alpha.8

3 years ago

0.0.1-alpha.4

3 years ago

0.0.1-alpha.2

3 years ago

0.0.1-alpha.3

3 years ago

0.0.1-alpha.1

3 years ago

0.0.1-alpha.0

3 years ago