Skip to content

Releases: dittowords/cli

v2.1.1

06 Jan 16:52
079ce89
Compare
Choose a tag to compare

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

09 Nov 18:49
f78a1fc
Compare
Choose a tag to compare

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 and format options are unset, all data will be stored in a single file: text.json
  • If the variants option is true and the format 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 the format open is flat or structured, files will be written on a per-project basis following the pattern [project-name].json.
  • If the variants option is true and the format option is flat or structured, 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:
image

Other Changes

We made a handful of other low-impact miscellaneous bug fixes and stabilization improvements.

v1.1.1

07 Oct 20:00
Compare
Choose a tag to compare

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 on pull 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