Releases: dittowords/cli
v4.5.0
v4.4.1
v4.4.0
v4.3.0
What's Changed
- Fix: Support for Nested JSON Format by @dimazollo in #93
New Contributors
- @dimazollo made their first contribution in #93
Full Changelog: v4.2.3...v4.3.0
v4.2.3
What's Changed
- Bump axios from 0.27.2 to 1.6.0 by @dependabot in #95
- Bump @babel/traverse from 7.21.4 to 7.23.2 by @dependabot in #96
- Bump json5 from 2.2.1 to 2.2.3 by @dependabot in #97
Full Changelog: v4.2.2...v4.2.3
v4.2.2
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:
This release fixes that issue:
Full Changelog: v4.2.1...v4.2.2
v4.2.1
v4.2.0
v4.1.0
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
- Fixes #82
- [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
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 ifsources.components
istrue
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