resxprocessor
v3.0.1
Published
fast, powerful resx -> js + ts language resource generator
Keywords
Readme
resxprocessor
resxprocessor is a CLI tool for managing frontend localization resources stored as JSON files.
It helps you:
- create resource files for all configured languages
- keep language files in sync with the default language
- remove outdated keys from localized JSON files
- generate dist resources from source JSON files (
[name].[lang].js) - add new keys to existing resources
- move one or multiple keys between resource files
- move a key directly from the command line without interactive prompts
Features added in the current branch
- interactive Move keys to another resource file flow
- support for moving multiple keys at once
- conflict handling when the target resource already contains a key
- atomic move operation with rollback on failure
- synchronized move across all configured language files
- searchable resource selection in interactive prompts
- searchable multi-select for key selection
Escsupport to go back to the previous interactive step
Dependencies used by the CLI
- Inquirer.js - interactive CLI prompts
- @inquirer/prompts - searchable prompt components
- inquirer-checkbox-plus-plus - searchable multi-select prompt
- commander.js - CLI argument parsing
- colors.js - terminal colors
Requirements
resxprocessor requires Node.js v18+.
Installation
npm install resxprocessor -gConfiguration
Create a .resxprocessor file in the same folder where you run the CLI.
Configuration keys
{
"tabSize": 4,
"srcFolder": "./resxSrc/",
"distFolder": "./resxDist/",
"resxPrefix": "Resx",
"jsNamespace": "ep.resources",
"languages": ["en", "ru", "de", "fr"],
"defaultLang": "en",
"currentLangNS": "ep.resxCulture"
}Field description:
tabSize- indentation size used for generated JSONsrcFolder- folder with source JSON filesdistFolder- folder for generated JS resourcesresxPrefix- suffix/prefix part used in generated dist filenamesjsNamespace- namespace used for generated dist resourceslanguages- list of supported languagesdefaultLang- default language used as the source of truthcurrentLangNS- namespace that contains the current UI language
Usage
Run the CLI from the same directory where .resxprocessor is located.
Main CLI modes
The top-level CLI modes are:
--dogood,-d- regenerate, sanitize, and sort all resources--move,-m- move one or more keys between resource files without interactive prompts--help,-h- show CLI help
Interactive mode
resxprocessorAvailable interactive actions:
Do everything GOODCreate new resxAdd keys to existing oneMove keys to another resource fileQuit
Interactive UX details
- resource selection supports search
- key selection in move flow supports search and multi-select
- press
Escto return to the previous step in supported prompts
Move keys flow
The move flow allows you to:
- select a source resource file
- search and select one or more keys
- select a target resource file
- rename conflicting keys or cancel the move
- move values across all configured language JSON files in sync
On success the CLI regenerates the affected source/dist outputs and prints a success message.
Direct move command
You can also move keys without entering interactive mode by using --move (or -m):
resxprocessor --move --source common --key saveButton --target calendarMove multiple keys at once:
resxprocessor -m -s common -k saveButton -k cancelButton -t calendarYou can also pass multiple keys as a comma-separated list:
resxprocessor -m -s common -k saveButton,cancelButton -t calendarRename while moving. When multiple keys are provided, --new-key values are matched by order:
resxprocessor -m -s common -k saveButton -k cancelButton -t calendar -n calendarSaveButton -n calendarCancelButtonSupported arguments:
--move,-m- run direct move mode--source,-s- source resource name or file name (for examplecommonorcommon.en.json)--key,-k- key name to move; repeat the option or pass a comma-separated list for multiple keys--target,-t- target resource name or file name--new-key,-n- optional target key name; repeat the option or pass a comma-separated list to rename multiple keys by order
Notes:
--source,--key, and--targetare used together with--move--new-keyis optional--dogoodand--moveare separate modes and should not be combined in one command
The command moves all specified keys across configured language files, regenerates affected outputs, and fails safely if the move cannot be completed.
Show CLI help:
resxprocessor --helpBatch regenerate mode
resxprocessor -dThis mode regenerates, sanitizes and sorts the existing src/dist files based on the current resource set.
Development
Install dependencies:
npm installUseful scripts:
npm run lint
npm run prettier
npm run startLicense
MIT
