Fluid CLI

Fluid Design System CLI by ENGIE

This package regroups helper scripts and acts as a CLI for Fluid. As of v0.1.0, it mainly helps for the Fluid tokens migration.

Getting started

You can either directly run the CLI with npx or install the package globally:

# Though npx
npx @engie-group/fluid-cli

or

# Installing the package globally
npm i -g @engie-group/fluid-cli

# Then running the CLI
nj-fluid-cli

Use the help option to list all the available commands and their use.

nj-fluid-cli --help

Tokens migration

Util to migrate tokens to a new version.

As some tokens have been removed, the script will replace those tokens by the same name but will add prefix REMOVED. Be careful when the migration is done you should check for --nj-REMOVED in all your files and replace them with the correct token.

# Using npx
npx @engie-group/fluid-cli tokens migrate

or

# Using globally installed package
nj-fluid-cli tokens migrate

The script will by default:

  • run at the root of the folder you currently are in,
  • replace tokens in css, scss, sass, less.

You can change the default behaviour by passing option arguments.

Access all other options with

npx @engie-group/fluid-cli tokens migrate --help

Options

-d, --dir to pass the dir path in which you want to proceed with the migration (default to .):

# Example with a custom path
npx @engie-group/fluid-cli tokens migrate --dir "path/to/your/files/"

-f, --files files extensions in which we want to proceed to migration, extensions should be seperated by comma. e.g: --files "ts, js", (default to: css, scss, sass, less):

# Example for a static website with only html, markdown and css
npx @engie-group/fluid-cli tokens migrate --files "html, md, css"

-e, --exclude files regex you want to ignore, regex should be seperated by comma. (default to: **/node_modules/**, **/*-lock.*, **/*.lock, **/package.json, **/*.map):

# Example with custom exclude
npx @engie-group/fluid-cli tokens migrate --exclude "**/node_modules/**, **/*-lock.*"

--versions from which to which version you are migrating, available options are listed when using help.

# Example with versions
npx @engie-group/fluid-cli tokens migrate --versions "5.3To5.4"

If you want to migrate multiple versions, apply each version in order. For example, if you want to migrate from v5.3 to v5.7:

  • first use --versions "5.3To5.4"
  • then use --versions "5.4To5.7"

-v, --verbose: verbose mode to display more info (default: false)

# Example with verbose
npx @engie-group/fluid-cli tokens migrate --verbose true