Usage
#
Install#
Run CommandsNote: This package is experimental. You may have better success by running the command locally:
#
ScorecardGather metrics around the adoption of a design system.
#
TokensDesign tokens are key-value pairs that represent a specification (aka "spec") of a design system.
If you are new to design tokens, here's a good place to start.
Tempera's scorecard
command expects these tokens to be in the javascript/es6 format which you can generate using Style Dictionary except exported as CommonJS modules.
In other words, flat CommonJS modules in PascalCase are expected.
Support for tokens in ES6 format is on the roadmap.
Example:
The scorecard
command expects the tokens to match against one of the following matchers after being transformed to kebab case:
You can learn more about the underlying css-types
package that utilizes these matchers.
#
Output#
JSON ReportUseful for creating custom reporters and tooling.
#
Output#
Using the command via an API#
Running the ExampleCheckout the
examples/scorecard/api
directory locally.Provide a sample
tokens.js
file to the root of the project.Install the dependencies.
- Run the test.
The results will be in the output.json
file at the root of the working directory.
#
Implementing the API- Install the dependencies.
Import the
scorecard
command from thetempera
dependency.Pass the
--tokens
,--site
,--json
, and--output
flags using theparseArgsStringToArgv
method.Run the
scorecard.run
method with the generated argv parameter.Read the generated scorecard from the JSON object in the specified output file.
Do something with the scorecard represented as a JSON object.