i18n-validate
Advanced tools
Comparing version 0.1.0-next.0b81611.0 to 0.1.0-next.1c884b7.0
#!/usr/bin/env node | ||
import { parseOptionsFile, log, parseFile, ValidationError, validateKey } from './chunk-JO62OCZH.js'; | ||
import { parseOptionsFile, log, parseFile, ValidationError, validateKey } from './chunk-IGJ556FN.js'; | ||
import process from 'node:process'; | ||
@@ -7,3 +7,3 @@ import { Command } from 'commander'; | ||
var command = new Command().version("0.1.0-next.0b81611.0").usage("[options] <file ...>").option("-c, --config <config>", "Path to the config file", "./i18n-validate.json").option("--log-level <logLevel>", "Log level", "info").option("--exclude <exclude...>", "Exclude files from parsing", "**/node_modules/**").option("--exit-on-error", "Exit immediately if an error is found", false); | ||
var command = new Command().version("0.1.0-next.1c884b7.0").usage("[options] <file ...>").option("-c, --config <config>", "Path to the config file", "./i18n-validate.json").option("--log-level <logLevel>", "Log level", "info").option("--exclude <exclude...>", "Exclude files from parsing", "**/node_modules/**").option("--exit-on-error", "Exit immediately if an error is found", false); | ||
command.on("--help", () => { | ||
@@ -40,2 +40,3 @@ console.log(""); | ||
var errorCount = 0; | ||
var warningCount = 0; | ||
for await (const file of glob) { | ||
@@ -47,2 +48,3 @@ log(`Parsing ${file}`, "debug", options); | ||
log(new ValidationError("Dynamic keys are not supported yet. Skipping", node.path, node.positions), "warn", options); | ||
warningCount++; | ||
} else if (!node.key || !node.namespace) { | ||
@@ -59,6 +61,6 @@ log(new ValidationError("Missing translation key or namespace", node.path, node.positions), "error", options); | ||
if (errorCount > 0) { | ||
log(`Found ${errorCount} errors`, "error", options); | ||
log(`Found ${errorCount} errors and ${warningCount} warnings`, "info", options); | ||
process.exit(1); | ||
} else { | ||
log(`Found ${errorCount} errors`, "info", options); | ||
log(`Found ${errorCount} errors and ${warningCount} warnings`, "info", options); | ||
process.exit(0); | ||
@@ -65,0 +67,0 @@ } |
@@ -1,3 +0,3 @@ | ||
export { ValidationError, parseFile, parseOptionsFile, validateKey } from './chunk-JO62OCZH.js'; | ||
export { ValidationError, parseFile, parseOptionsFile, validateKey } from './chunk-IGJ556FN.js'; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "i18n-validate", | ||
"version": "0.1.0-next.0b81611.0", | ||
"version": "0.1.0-next.1c884b7.0", | ||
"description": "A cli tool to find invalid i18n keys, missing variables and many more", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
38024
399