Registry / devops / localize-core-cli

localize-core-cli

JSON →
library1.0.0jsnpmunverified

Enterprise-grade, fully deterministic localization and CloudFront CDN migration CLI. Version 1.0.0, requires Node >=18. Works 100% offline with zero AI dependencies. Differentiators: deterministic output (no LLM hallucinations), supports React/Angular/Vue/legacy frameworks, includes AST-based codemods to inject i18n wrappers, and automates S3 upload + CloudFront URL replacement. Peer dependencies include AWS SDK, Babel, jscodeshift, and recast for code transformation.

npm install localize-core-cli
INSTALL
IMPORT
SIG · LOCALIZE-CORE-CLI
L
localize-core-cli
devopsjavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

Scanner
const { Scanner } = require('localize-core-cli');
import { Scanner } from 'localize-core-cli';
Package is CJS-only (uses require). No ESM exports available.
Validator
const { Validator } = require('localize-core-cli');
import Validator from 'localize-core-cli';
Named export, not default. Use destructuring from require().
CodemodEngine
const { CodemodEngine } = require('localize-core-cli');
import { CodemodEngine } from 'localize-core-cli/codemod';
All exports are from the main entry point. Don't use subpath imports.

Demonstrates programmatic usage: scanning for hardcoded strings, generating locale files, validating, reporting, and running codemods.

const { Scanner, LocaleEngine, Validator, Reporter, CodemodEngine } = require('localize-core-cli'); async function main() { // 1. Scan source code for hardcoded strings const scanner = new Scanner({ rootDir: './src', extensions: ['.tsx', '.ts', '.jsx', '.js'], excludeDirs: ['node_modules', 'dist'], }); const { detectedTexts } = await scanner.scan(); // 2. Generate locale files const le = new LocaleEngine('./', { defaultLanguage: 'en', targetLanguages: ['fr', 'de'], localesDir: './src/i18n/locales', }); const keyMap = le.generateFromDetectedTexts(detectedTexts, 'en', 'common'); le.syncLanguages('common'); le.persistAll(); // 3. Validate locale files const validator = new Validator({ baseLanguage: 'en', targetLanguages: ['fr', 'de'], locales: { en: keyMap }, sourceTexts: detectedTexts, }); const validation = validator.validate(); // 4. Generate report const reporter = new Reporter(); reporter.generateCLI({ filesScanned: detectedTexts.length, hardcodedTexts: detectedTexts.length }); // 5. Codemod to inject i18n wrappers const ce = new CodemodEngine({ framework: 'react' }); const codeKeyMap = ce.buildKeyMap(detectedTexts); // Example: transform a single file const sourceCode = '<div>Hello World</div>'; const { code } = ce.transformFile(sourceCode, codeKeyMap); console.log(code); } main().catch(console.error);
Debug
Known issues
breakingPackage is CJS-only. Importing with ES module syntax (import/export) will fail at runtime.
fix
Use require() or dynamic import() in ESM projects.
affects: >=1.0.0
deprecatedThe CLI command 'ai-localize init' creates a config file but does not validate AWS credentials. Missing or invalid credentials cause silent failures later.
fix
Verify AWS credentials are configured (AWS_PROFILE or environment variables) before running full-migrate.
affects: >=1.0.0
gotchaScanner ignores files in node_modules and dist by default, but does not support custom exclude patterns beyond those two.
fix
Manually move or rename directories you want excluded. No config option exists.
affects: >=1.0.0
breakingPeer dependency @babel/traverse v7.22.0+ is required but not installed automatically. Missing peer deps cause runtime errors.
fix
Run npm install @babel/traverse@^7.22.0 @babel/parser@^7.22.0 @babel/types@^7.22.0
affects: >=1.0.0
gotchaLocaleEngine.generateFromDetectedTexts() expects detectedTexts as an array of objects with a 'value' property. Calling with plain strings throws TypeError.
fix
Ensure detectedTexts is the result from Scanner.scan() which returns objects like { value: 'Hello', file: 'path', line: 10 }.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module '@babel/traverse'
Missing peer dependency @babel/traverse
fix
npm install @babel/traverse@^7.22.0
TypeError: detectedTexts is not iterable
Passing plain array of strings instead of scanner output objects
fix
Use result from Scanner.scan() which provides objects with 'value' property.
Error: Cannot use import statement outside a module
Using ES import syntax with a CJS-only package
fix
Replace import with require() or use dynamic import() in .mjs files.
Error: ENOENT: no such file or directory, open 'ai-localize.config.json'
Running commands without initializing config first
fix
Run 'npx ai-localize init' before other commands.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
@aws-sdk/client-cloudfrontrequiredRequired for CloudFront distribution management and CDN migration
@aws-sdk/client-s3requiredRequired for S3 bucket operations in CDN migration
@babel/parserrequiredAST parsing for JavaScript/TypeScript code analysis
@babel/traverserequiredAST traversal for code transformation
@babel/typesrequiredAST node types for code generation
chalkrequiredTerminal string styling for CLI output
commanderrequiredCLI command parsing
inquirerrequiredInteractive prompts for configuration
jscodeshiftrequiredCodemod toolkit for JavaScript/TypeScript transformations
orarequiredSpinner for CLI progress indication
recastrequiredAST-based code pretty-printer for codemods
simple-gitrequiredGit operations for version control integration
zodrequiredSchema validation for configuration files
Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
localize-core-cli — npm install localize-core-cli · libregistry