Usage
Behavior
By default,pack prepares a translation file for downstream workflows by removing description metadata while preserving id-keyed output.
For FormatJS message JSON, the default output keeps each message id and its defaultMessage:
--group-by-value to invert the shape and group ids that share the same translation string:
Automatic discovery
When no translation file is passed,pack loads your i18n config (i18n.yml or i18n.jsonc in the working directory by default) and packs every react-intl translation file referenced by bucket to paths for the selected target locales. Only JSON files in strict FormatJS shape (defaultMessage per id) are packed; plain nested JSON, non-JSON files, and missing files are skipped.
Batch discovery writes the packed output back to each input file in place by default. Use --out-suffix to write separate output files instead (for example, --out-suffix .packed turns lang/es-ES.json into lang/es-ES.packed.json). Progress is printed to stderr.
Flags
--group-by-value: group ids by shared translation string instead of preserving id-keyed output. Use with a single input file only.--out-file <path>: write the packed JSON to a file instead of stdout. Use with a single input file only.--prefix-id: stripextract --prefix-idfilename prefixes from ids. For example,src.components.app-header.titlebecomestitle.--ignore-duplicate-id: ignore duplicate packed ids and keep the first value. This is useful when--prefix-idcauses multiple source ids to strip to the same packed id.--config <path>: optional path to i18n config when discovering locale files (default:i18n.ymlori18n.jsonc).--group <name>: filter config discovery by group name.--bucket <name>: filter config discovery by bucket name.--out-suffix <suffix>: optional output filename suffix when packing multiple files. When omitted, each input file is overwritten in place.