Skip to content

Releases: dittowords/cli

v4.5.0

16 Apr 16:36
3bd2af5
Compare
Choose a tag to compare

What's Changed

Adds support to a new option in config.yml which, when specified, prevents generating the index.js and index.d.ts files:

disableJsDriver: true

Full Changelog: v4.4.1...v4.5.0

v4.4.1

22 Mar 20:41
0932396
Compare
Choose a tag to compare

What's Changed

Bugfixes

  • Fix terminal hanging when Ctrl + C pressed during pull and token prompt by @azjgard in #105

Internal

Full Changelog: v4.4.0...v4.4.1

v4.4.0

29 Feb 19:03
9c51709
Compare
Choose a tag to compare

What's Changed

  • [DIT-6177] Add pull --sample-data flag for variants by @asnewman in #100

Full Changelog: v4.3.0...v4.4.0

v4.3.0

19 Feb 21:49
329f864
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v4.2.3...v4.3.0

v4.2.3

19 Feb 20:05
6c4f42c
Compare
Choose a tag to compare

What's Changed

Full Changelog: v4.2.2...v4.2.3

v4.2.2

23 Jan 16:57
8f79bbf
Compare
Choose a tag to compare

What's Changed

  • Stop component folders with emojis from creating a leading separator

Currently, if you include an emoji at the start of your component folder's name, the Ditto CLI will add this leading hyphen:
image

image

This release fixes that issue:
image

Full Changelog: v4.2.1...v4.2.2

v4.2.1

28 Nov 18:51
ed421a2
Compare
Choose a tag to compare

What's Changed

  • Only run init() on commands that need it by @asnewman in #89

This change prevents the ditto directory from being created on commands that don't need it (e.g. generate-suggestions)

Full Changelog: v4.2.0...v4.2.1

v4.2.0

16 Nov 18:35
7c0bcf6
Compare
Choose a tag to compare

What's Changed

  • Add --sample-data flag to the components-folders command by @asnewman in #88

Full Changelog: v4.1.0...v4.2.0

v4.1.0

31 Oct 22:24
9039cad
Compare
Choose a tag to compare

Documentation has been moved to a new home at https://developer.dittowords.com/cli-reference/installation.

New features

Multiple features have been added to improve the experience of using the Ditto CLI with iOS development.

Support for a new property iosLocales has been added, which enables you to map Ditto Variant IDs to Xcode Locale IDs:

iosLocales:
  - base: en
  - spanish: es
format:
  - ios-strings
  - ios-stringsdict

When this new property is specified in conjunction with having one or both of ios-strings and ios-stringsdict as a format, iOS files written to disk are renamed and grouped into .lproj localization bundles:

ditto/
├── en.lproj/
│   ├── components.strings
│   ├── project1.strings
├── es.lproj/
│   ├── components.strings
│   ├── project1.strings

Additionally, a Ditto.swift driver file is generated that enables type-safe interaction with strings generated from Ditto:

//
// Ditto.swift
//
// Created by the Ditto CLI on 10/6/2023, 1:16:52 PM
//

import SwiftUI

struct Ditto {
  public static func component1(_ localeOverride: String? = nil) -> String {
    String.localizedStringWithFormat(NSLocalizedString("component-1", tableName: "components", /* ... */))
  }

  public struct project1 {
    public static func textItem1(_ localeOverride: String? = nil, variable1: String) -> String {
      String.localizedStringWithFormat(NSLocalizedString("text-item-1", tableName: "project1", /* ... */), variable1)
    }
}

These files are designed to be imported into XCode by reference. This enables using the CLI to pull the latest strings from Ditto and have the text in your project automatically updated.

See more details here.


The index.js driver file for JSON formats is now generated as an ESM module if a package.json file is detected with "type": "module":

import componentsRootBase from "./components__root__base.json";
import componentsRootSpanish from "./components__root__spanish.json";
import exampleProjectBase from "./example-project__base.json";
import exampleProjectSpanish from "./example-project__spanish.json";

export default {
  ditto_component_library: {
    base: { ...componentsRootBase },
    spanish: { ...componentsRootSpanish },
  },
  project_xxx: {
    base: { ...exampleProjectBase },
    spanish: { ...exampleProjectSpanish },
  },
};

If a package.json file is not found in the current directory / an ancestor directory, or if it is found but does not contain a type property, the driver file will continue to be generated as a CommonJS module.

This default will likely change in the next major release.


An index.d.ts TypeScript file is generated alongside the index.js driver file for JSON formats to better support TypeScript projects out of the box:

interface IJSONFlat {
  [key: string]: string;
}


interface IDriverFile {
  [sourceKey: string]: {
    [variantKey: string]: IJSONFlat;
  };
}

declare const driver: IDriverFile;

export default driver;

Other

Internally, the CLI has been migrated from the v0 API to the v1 API.

Issue Resolution


  • [DIT-4819] Update typos in CLI README by @azjgard in #78
  • [DIT-4272] Generate Swift driver file for iOS formats by @azjgard in #81
  • Rename ios_locales property for naming convention consistency by @azjgard in #83
  • [DIT-5321] Support generating ESM JavaScript driver by @azjgard in #86
  • [DIT-5338] Migrate CLI to use v1 API Endpoints by @azjgard in #85

Full Changelog: v4.0.0...v4.0.1

v4.0.0

18 Aug 19:21
758efc6
Compare
Choose a tag to compare

What's Changed

Breaking changes

  • Files containing data from the component library are now written on a per-folder, per-variant basis.
# Before
ditto_component_library__base.json
ditto_component_library__spanish.json

# After
components__root__base.json
components__root__spanish.json
components__some-folder__base.json
components__some-folder__spanish.json
  • All string files in every format now have new lines appended to comply with POSIX standards.
  • Support for sources.components.enabled has been removed. Component data will be fetched if sources.components is true or is a config object:
# boolean explicitly enabled
sources:
  components: true

# config implicitly enabled
sources:
  components:
    folders:
      - id: folder-developer-id-1
         name: Folder 1

New features

  • sources.components.root can now be specified to control the behavior of fetching data for components that are not in folders:
sources:
  components:
    root: true
    folders:
      ...
  • status can now be specified on a per-source basis:
sources:
  components:
    root:
      # for "root level" components (not in folders)
      status: WIP
    folders:
      - id: folder-developer-id-1
         name: Folder 1
         # for individual component folders
         status: FINAL
  projects:
    - id: project-id-1
      name: Project 1
      # for individual projects
      status: REVIEW
# at the root level
status: FINAL
  • For projects, exclude_components can be specified on a per-project basis to only fetch text that is not associated with a component:
sources:
projects:
  - id: project-id-1
    name: Project 1
    exclude_components: true

Full Changelog: v3.10.0...v4.0.0