UNPKG

ajv-ftl-i18n

Version:

Transpile Fluent (ftl) files into ajv error translations.

34 lines (29 loc) 944 B
// Copyright 2026 will Farrell, and ajv-ftl-i18n contributors. // SPDX-License-Identifier: MIT import { Command, Option } from "commander"; import transpile from "./commands/transpile.js"; import packageJson from "./package.json" with { type: "json" }; export const createProgram = () => { const program = new Command() .name("ajv-ftl") .description( "Transpile Fluent (.ftl) files to JavaScript (.js or .mjs) for ajv", ) .version(packageJson.version, "--version"); program .command("transpile", { isDefault: true }) .argument("<input>", "Path to the Fluent file to transpile") .requiredOption( "--locale <locale...>", "What locale(s) to be used. Multiple can be set to allow for fallback. i.e. en-CA", ) .addOption( new Option( "-o, --output <output>", "Path to store the resulting JavaScript file. Will be in ESM.", ), ) .action(transpile); return program; }; export default createProgram;