Registry / serialization / messageformat-cli

messageformat-cli

JSON →
library2.1.1jsnpmunverified

CLI for compiling ICU MessageFormat strings using the messageformat library. Version 2.1.1 is current stable. Provides a command-line interface to convert messageformat JSON files to JavaScript modules. Requires messageformat as a peer dependency. Lightweight wrapper with no additional runtime dependencies. Supports Node.js >=6.0. Not actively developed; core library has moved to version 4.x with breaking changes.

npm install messageformat-cli
INSTALL
IMPORT
SIG · MESSAGEFORMAT-CLI
M
messageformat-cli
serializationjavascriptv2.1.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

main
messageformat-cli is used as a CLI tool; no programmatic import. Run via npx messageformat-cli or global install.
No JavaScript import available; use command line only.
compile output
messageformat-cli generates a .js file that can be imported as a CommonJS module. const msg = require('./messages.js');
import msg from './messages.js'; // Output is CommonJS, not ESM
Output files use module.exports, so require() is required.
CLI usage
npx messageformat-cli input.json output.js
npm run messageformat-cli input.json output.js
Direct CLI invocation, not via npm scripts.

Shows installation, creating a message JSON file, running the CLI to compile, and using the generated module.

npm install -g messageformat-cli messageformat@2 # Create a JSON file with translations cat > messages.json <<EOF { "greeting": "Hello {name}!", "farewell": "Goodbye {name}!" } EOF # Compile to JavaScript messageformat-cli messages.json messages.js # Use in Node.js const greeting = require('./messages.js').greeting; console.log(greeting({ name: 'World' })); // Output: Hello World!
messageformat --version
Debug
Known issues
deprecatedmessageformat-cli is deprecated; use messageformat 4.x CLI instead.
fix
Migrate to messageformat 4.x and its built-in CLI.
affects: >=2.0
breakingmessageformat 2.x is a peer dependency; v3+ has breaking changes.
fix
Install messageformat@2 as a peer dependency.
affects: >=2.0
gotchaOutput modules are CommonJS, not ESM. Cannot be imported with import syntax without a bundler.
fix
Use require() or configure bundler to handle CommonJS.
affects: >=1.0
Errors
Common errors & fixes
Error: Cannot find module 'messageformat'
Peer dependency 'messageformat' not installed.
fix
npm install messageformat@2
messageformat-cli: command not found
CLI not installed globally or not in PATH.
fix
npm install -g messageformat-cli messageformat@2
SyntaxError: Unexpected token 'export'
Attempted to import the output file using ESM syntax, but output is CommonJS.
fix
Use require() instead of import.
Upgrade
Version history
2.1.1latest on npm
Audit
Dependencies
messageformatrequiredpeer dependency required for compilation
Agent activity
5 hits · last 30 days
node
4
Resources
messageformat-cli — npm install messageformat-cli · libregistry