Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
b2db569
Branch app entry point to support both legacy and beta versions (#113)
jaerod95 Apr 8, 2025
347bfd9
Jrod/dit 10044 top level cli branching (#115)
jaerod95 Apr 8, 2025
b83b2c2
Jrod/dit 10045 reintroduce pull command with ns cli (#116)
jaerod95 Apr 15, 2025
9e4e966
update version
jaerod95 Apr 15, 2025
dacff25
Add environment variable definitions for production in esbuild config…
jaerod95 Apr 16, 2025
80b082c
Update package version to 5.0.0-beta.1
jaerod95 Apr 16, 2025
f81e079
Refactor environment variable handling in esbuild configuration and u…
jaerod95 Apr 16, 2025
9767673
Split up and write tests for all api token methods
marla-hoggard Apr 16, 2025
2f84722
Keep it consistent, always use spy
marla-hoggard Apr 16, 2025
ce0ef37
Use appContext directly
marla-hoggard Apr 16, 2025
d797808
Jrod/dit 10122 add support for c flag for defining the location of th…
jaerod95 Apr 16, 2025
6efce8f
Add module type support in i18next framework output file (#119)
jaerod95 Apr 17, 2025
2a48170
Version bump to beta.2
marla-hoggard Apr 17, 2025
ca288e1
[DIT-10076] Unit tests for API Token service methods
marla-hoggard Apr 17, 2025
608d28e
[DIT-10128] Better error messaging for config errors (#120)
marla-hoggard Apr 17, 2025
617fa39
Update version to 5.0.0-beta.4 and enhance README with installation, …
jaerod95 Apr 18, 2025
9d7b561
Update README to specify installation of the Ditto CLI beta version
jaerod95 Apr 18, 2025
e1b334b
Update version to 5.0.0-beta.5 in package.json
jaerod95 Apr 22, 2025
aacb52e
Update version to 5.0.0-beta.6 and add Vue I18n framework support in …
jaerod95 Apr 22, 2025
572fdaf
Revert version to 5.0.0-beta.5 in package.json
jaerod95 Apr 22, 2025
39e4a43
Enhance legacy mode flag handling in Ditto CLI by adding support for …
jaerod95 Apr 29, 2025
d5ac2c0
Update version to 5.0.0-beta.6 in package.json
jaerod95 Apr 29, 2025
3da6f58
Remove shorthand '-l' option for legacy mode in Ditto CLI, updating t…
jaerod95 Apr 29, 2025
80bcd1b
Add richText field to TextItemsResponse schema
asnewman Aug 8, 2025
2006fe5
Add richText configuration option to base output filters
asnewman Aug 8, 2025
3d2eb38
Update Text Items API request to support richText parameter
asnewman Aug 8, 2025
4200b0b
Pass richText configuration to API filters in JSON formatter
asnewman Aug 8, 2025
411de91
Use richText field in JSON output when configured and available
asnewman Aug 8, 2025
8bc78d7
Add tests for richText field parsing in textItems
asnewman Aug 8, 2025
fd44d16
Use both top level and out filter
asnewman Aug 12, 2025
9e6ccfc
formatting
asnewman Aug 12, 2025
907b84a
remove unnecessary change
asnewman Aug 12, 2025
35ebb5e
remove spec files
asnewman Aug 12, 2025
828f0e8
clarify code
asnewman Aug 12, 2025
6a86fae
simplify code
asnewman Aug 12, 2025
45a4be0
remove incorrect richtext param
asnewman Aug 12, 2025
c74c117
add clarifying comment
asnewman Aug 12, 2025
5d98a93
use boolean false instead of string
asnewman Aug 12, 2025
26438da
Update url for finding your api key
marla-hoggard Aug 14, 2025
5cb3302
Fix fetch text query params in fetchText
marla-hoggard Aug 14, 2025
3fc9598
Move the changes higher up
marla-hoggard Aug 14, 2025
26820d9
Add e2e tests
asnewman Aug 14, 2025
3809f50
Merge branch 'ash/dit-11112-rich-text-for-cli' of github.com:dittowor…
asnewman Aug 14, 2025
ee8a815
Replace any types with proper TypeScript types in tests
asnewman Aug 15, 2025
5347901
Move test variables and hooks inside describe block
asnewman Aug 15, 2025
0a13b28
Use toSorted() instead of sort() in tests
asnewman Aug 15, 2025
1708506
Simplify test setup by removing unused YAML config files
asnewman Aug 15, 2025
e47c9e2
Add proper filter tests with API parameter verification
asnewman Aug 15, 2025
bb48ae2
Split up filter/output tests, add more filter cases
marla-hoggard Aug 18, 2025
566a878
Merge pull request #123 from dittowords/ash/dit-11112-rich-text-for-cli
asnewman Aug 18, 2025
88089ca
bump beta version to 7
JWhite30515 Sep 29, 2025
53643cb
Merge pull request #125 from dittowords/bump-to-7
JWhite30515 Sep 29, 2025
978b517
[DIT 11281] CLI support for components (#124)
JWhite30515 Sep 29, 2025
b174397
update readme to show default components object
JWhite30515 Sep 30, 2025
664586e
Update README
marla-hoggard Oct 1, 2025
adf312b
Set version to 5.0.0
marla-hoggard Oct 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion .github/actions/install-node-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ inputs:
runs:
using: "composite"
steps:
- uses: actions/cache@v3
- uses: actions/cache@v4
env:
cache-name: node_modules-cache
with:
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/required-checks.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
name: "Required Checks"

on:
pull_request:
branches:
- master
on: pull_request

jobs:
jest-tests:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
timeout-minutes: 5
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20

- uses: ./.github/actions/install-node-dependencies

- name: Jest Tests
run: |
npx jest --ci --silent --maxWorkers=1
Expand Down
35 changes: 23 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
# Ditto CLI

The Ditto CLI enables developers to access the Ditto API directly from the command line.
The Ditto CLI enables developers to access the Ditto API directly from the command line. You can use the CLI to import Ditto data directly into your own codebase.

The CLI is configured to fetch text from the latest version of Ditto by default. However, all legacy features are still fully supported by passing a `--legacy` flag along with the legacy CLI command. See [Legacy Setup](#legacy-setup) for details on using the CLI with older Ditto projects and components.

[![NPM version](https://badge.fury.io/js/@dittowords%2Fcli.svg)](https://badge.fury.io/js/@dittowords%2Fcli)

## Documentation

The official documentation can be found [here](http://developer.dittowords.com/cli-reference/authentication).
- [Documentation](https://developer.dittowords.com/cli-reference/authentication)
- [Changelog](https://developer.dittowords.com/feedback-support/changelog)

## Support

- [Bug Reports](https://github.com/dittowords/cli/issues/)
- [Support Chat](https://www.dittowords.com)
- [What is Ditto?](https://www.dittowords.com/docs/what-is-ditto)
- [What is Ditto?](https://developer.dittowords.com/introduction)

## Installation

Expand All @@ -24,7 +27,7 @@ It's recommended to install the CLI as a development dependency to ensure your w

## Authentication

The first time you run the CLI, you’ll be asked to provide an API key. You can generate an API key from your [developer integrations settings](https://app.dittowords.com/account/devtools).
The first time you run the CLI, you’ll be asked to provide an API key. You can generate an API key from your [developer integrations settings](https://app.dittowords.com/developers/api-keys).

See the [Authentication](http://developer.dittowords.com/api-reference/authentication) page for more information on API keys.

Expand All @@ -37,32 +40,40 @@ The first time you run the CLI, a `ditto/` folder will be created if it doesn't
The default file looks like this:

```yml
sources:
components: true
variants: true
format: flat
projects: [],
components: {
folders: []
},
variants: [],
outputs:
- format: json,
framework: i18next
```

For more information on configuring the CLI, see [http://developer.dittowords.com/cli-reference/configuration](http://developer.dittowords.com/cli-reference/configuration).
For more information on configuring the CLI, see [this documentation section](https://developer.dittowords.com/cli-reference/configuration).

## Usage

```bash
npx @dittowords/cli
npx @dittowords/cli pull
```

Run the CLI to pull string data from Ditto and write it to disk.

String files are written to the `ditto` folder in a format that corresponds to your configuration. After integrating these files into development, you can execute the CLI at any time to fetch the latest strings from Ditto and update them in your application.
String files are written to the specified folder in a format that corresponds to your configuration. After integrating these files into development, you can execute the CLI at any time to fetch the latest strings from Ditto and update them in your application.

For more information on how files written to disk, see [http://developer.dittowords.com/cli-reference/files](http://developer.dittowords.com/cli-reference/files).
For more information on how files are written to disk, see [this documentation section](https://developer.dittowords.com/cli-reference/files).

See our demo projects for examples of how to integrate the Ditto CLI in different environments:

- [React web app](https://github.com/dittowords/ditto-react-demo)
- [iOS mobile app](https://github.com/dittowords/ditto-react-demo)
- [Android mobile app](https://github.com/dittowords/ditto-react-demo)

## Legacy Setup

Beginning with `v5.0.0`, the Ditto CLI points at the new Ditto experience by default. To run the CLI compatible with legacy Ditto, append the `--legacy` flag to any legacy command, and the CLI will work as it did in the `4.x` version. All existing legacy commands remain fully functional at this time.

## Feedback

Have feedback? We’d love to hear it! Message us at [[email protected]](mailto:[email protected]).
49 changes: 49 additions & 0 deletions esbuild.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import * as esbuild from "esbuild";

let define = {};
const KEYS_TO_DEFINE = [
"ENV",
"SENTRY_DSN",
"SENTRY_ORG",
"SENTRY_PROJECT",
"SENTRY_DSN",
];

if (process.env.ENV === "production") {
for (const k of KEYS_TO_DEFINE) {
define[`process.env.${k}`] = JSON.stringify(process.env[k]);
}
}

/**
* @type {esbuild.BuildOptions}
*/
const config = {
entryPoints: ["lib/ditto.ts"],
bundle: true,
metafile: true,
keepNames: true,
tsconfig: "tsconfig.json",
sourcemap: process.env.ENV === "production" ? "external" : "both",
minify: process.env.ENV === "production",
outdir: "bin",
target: "es2020",
packages: "external",
platform: "node",
define,
};

async function main() {
const result = await esbuild.build(config);
// Output build metafile so we can analyze the bundle
// size over time and check if anything unexpected is being bundled in.
if (process.env.ENV === "production") {
console.log(
await esbuild.analyzeMetafile(result.metafile, {
verbose: true,
})
);
}
}

main();
13 changes: 0 additions & 13 deletions etsc.config.js

This file was deleted.

1 change: 1 addition & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const config: Config = {
],
watchPathIgnorePatterns: ["<rootDir>/.testing/", "<rootDir>/testing/"],
collectCoverageFrom: ["lib/**/*.{js,jsx,ts,tsx}"],
restoreMocks: true,
};

export default config;
Loading