Skip to content

CLI

wuchale provides a CLI from the package wuchale. The CLI can be invoked directly:

Terminal window
npx wuchale [command] {options}

You can get help by running it with --help

Terminal window
$ npx wuchale --help
wuchale cli
Usage:
wuchale [command] {options}
Commands:
[none] Extract/compile messages from the codebase into catalogs
deleting unused messages if --clean is specified
status Show current status
Options:
--config use another config file instead of wuchale.config.js|wuchale.config.mjs
--clean, -c (only when no commands) remove unused messages from catalogs
--watch, -w (only when no commands) continuously watch for file changes
--sync (only when no commands) extract sequentially instead of in parallel
--help, -h Show this help

You can optionally add some commands to your package.json for convenience.

// ...
"scripts": {
// ...
"extract": "wuchale",
"clean": "wuchale --clean"
},
// ...

The following commands are accepted (in place of {cmd}).

You just run

Terminal window
npx wuchale

This scans all of the files that match the configured pattern for the adapters and extracts the messages. And if writeFiles is enabled, it writes the generated files. This can be used when Vite is not used/needed (for example, for server only projects). Watch mode is also supported.

Additionally, if it is running in the project for the first time, it ceates the necessay files, doing the following, for each adapter configuration:

  • If the loader specified is one of the provided ones, not custom, it is created/overwritten.
  • If the loader specified is custom, it doesn’t touch the existing loader files.

This shows the status information of the setup like if the loader files exist and are not empty, the number of total messages, untranslated, obsolete.