Releases: dittowords/cli
v2.1.1
We've added a new supported property to ditto/config.yml
to allow explicitly specifying that the component library should be fetched and included in the CLI's output:
components: true
This is now the preferred alternative to the old way of specifying the component library:
projects:
- name: Ditto Component Library
id: ditto_component_library
Our goal with this change is to make the CLI easier to use and understand by aligning it with the way things work in the Ditto web app, where the component library is fundamentally different from the projects in a workspace.
v2.0.0
This is a new major version with breaking changes.
Breaking Changes
Output file structure
The way in which JSON files are written is now a function of how the variants
and format
options are configured. As specified in the latest README update:
- If the
variants
andformat
options are unset, all data will be stored in a single file:text.json
- If the
variants
option istrue
and theformat
option is unset, files will be written on a per-variant basis;base.json
will contain all base (non-variant) text and all other files will follow the pattern[variant-api-id].json
. - If the
variants
option is unset and theformat
open isflat
orstructured
, files will be written on a per-project basis following the pattern[project-name].json
. - If the
variants
option istrue
and theformat
option isflat
orstructured
, files will be written on a per-project per-variant basis following the pattern[project-name__variant-api-id].json
.
project-name
used above represents a normalized version of the project's name in Ditto, where the name is lowercased and whitespace characters are replaced with hyphens.
structured
and flat
formats
When the structured
or flat
format is specified, the files that are written will not contain top-level keys that arbitrarily nest the data. These keys are legacy carryovers from when everything was written to a single file where the data needed to be separated by project.
Flat file examples
v1.1.1. (before):
{
"projects": {
"project_12345": {
"key1": "value1",
"key2": "value2",
"key3": "value3"
}
}
}
v2.0.0 (now):
{
"key1": "value1",
"key2": "value2",
"key3": "value3"
}
Empty variant files
Previously, if the variants
option was specified, files (usually containing {}
) were written for every variant in the workspace, independent of whether or not any of the specified projects had values for a given variant. Now, files will only be written for variants in the workspace that also have values for the specified projects -- no more empty files.
index.js
driver file
The structure of the generated index.js
is now always the same, independent of the CLI configuration used to generate it. This change is designed to reduce the amount of overhead required in the React SDK to support different CLI configurations.
We also added a warning to the README recommending against depending on this file, as its primary use case is to simplify CLI integration with other Ditto developer tools:
Other Changes
We made a handful of other low-impact miscellaneous bug fixes and stabilization improvements.
v1.1.1
Feature Additions
- Adds a precursor action to the
pull
command that cleans the output directory of all.js
and.json
files prior to fetching new data - Generates an
index.js
driver file onpull
to make it easier to import text data in JavaScript projects - Adds support for two new options in
config.yml
:
Option Name | Possible Values | Description |
---|---|---|
variants |
true or false or unspecified |
if true , variant text will be fetched for specified projects, a separate file will be written for each variant, and base text will be written to base.json instead of text.json |
format |
flat or structured or unspecified |
if specified, all text data will be fetched and stored in the indicated format |