i18n-validate
Advanced tools
Comparing version 1.4.3-next.ecd3c66.0 to 1.4.3-next.ef32042.0
#!/usr/bin/env node | ||
import { parseOptionsFile, log, parseFile, ValidationError, validateKey } from './chunk-NEPVHCKE.js'; | ||
import { parseOptionsFile, log, parseFile, ValidationError, validateKey } from './chunk-OSNOD3G2.js'; | ||
import process from 'node:process'; | ||
@@ -8,3 +8,3 @@ import { Command } from 'commander'; | ||
var start = performance.now(); | ||
var command = new Command().version("1.4.3-next.ecd3c66.0").usage("[options] <file ...>").option("-c, --config <config>", "Path to the config file", "./i18n-validate.json").option("--log-level <logLevel>", "Log level").option("--exclude <exclude...>", "Exclude files from parsing").option("--exit-on-error", "Exit immediately if an error is found"); | ||
var command = new Command().version("1.4.3-next.ef32042.0").usage("[options] <file ...>").option("-c, --config <config>", "Path to the config file", "./i18n-validate.json").option("--log-level <logLevel>", "Log level").option("--exclude <exclude...>", "Exclude files from parsing").option("--exit-on-error", "Exit immediately if an error is found"); | ||
command.on("--help", () => { | ||
@@ -22,10 +22,7 @@ console.log(""); | ||
options.inputs = program.args.length > 0 ? program.args : options.inputs; | ||
if (!Array.isArray(options.inputs)) | ||
options.inputs = [options.inputs]; | ||
if (!Array.isArray(options.exclude)) | ||
options.exclude = [options.exclude]; | ||
if (!Array.isArray(options.inputs)) options.inputs = [options.inputs]; | ||
if (!Array.isArray(options.exclude)) options.exclude = [options.exclude]; | ||
options.inputs = options.inputs.map((_input) => { | ||
let input = _input.trim().replaceAll("\\", "/"); | ||
if (/^'.*'$|^".*"$/.test(input)) | ||
input = input.slice(1, -1); | ||
if (/^'.*'$|^".*"$/.test(input)) input = input.slice(1, -1); | ||
return input; | ||
@@ -64,4 +61,3 @@ }).filter(Boolean); | ||
const valid = await validateKey(node, options); | ||
if (!valid) | ||
errorCount++; | ||
if (!valid) errorCount++; | ||
} else { | ||
@@ -76,4 +72,3 @@ log( | ||
} | ||
if (errorCount > 0 && options.exitOnError) | ||
break; | ||
if (errorCount > 0 && options.exitOnError) break; | ||
} | ||
@@ -80,0 +75,0 @@ var timeTaken = `${(performance.now() - start).toFixed(2)}ms`; |
@@ -14,3 +14,3 @@ type LogLevel = 'debug' | 'error' | 'info' | 'warn'; | ||
*/ | ||
exclude: string | string[]; | ||
exclude: string[] | string; | ||
/** | ||
@@ -33,3 +33,3 @@ * Exit immediately if an error is found | ||
*/ | ||
inputs: string | string[]; | ||
inputs: string[] | string; | ||
/** | ||
@@ -36,0 +36,0 @@ * Key separator for nested translation keys |
@@ -1,3 +0,3 @@ | ||
export { ValidationError, parseFile, parseOptionsFile, validateKey } from './chunk-NEPVHCKE.js'; | ||
export { ValidationError, parseFile, parseOptionsFile, validateKey } from './chunk-OSNOD3G2.js'; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "i18n-validate", | ||
"version": "1.4.3-next.ecd3c66.0", | ||
"version": "1.4.3-next.ef32042.0", | ||
"description": "A cli tool to find invalid i18n keys, missing variables and many more", | ||
@@ -32,11 +32,11 @@ "main": "./dist/index.js", | ||
"dependencies": { | ||
"commander": "^12.0.0", | ||
"commander": "^12.1.0", | ||
"fast-glob": "^3.3.2", | ||
"typescript": "^5.4.2" | ||
"typescript": "^5.5.2" | ||
}, | ||
"devDependencies": { | ||
"@favware/cliff-jumper": "^3.0.1", | ||
"@favware/cliff-jumper": "^3.0.3", | ||
"@favware/npm-deprecate": "^1.0.7", | ||
"@types/node": "^20.11.28", | ||
"@vitest/coverage-v8": "^1.4.0", | ||
"@types/node": "^20.14.7", | ||
"@vitest/coverage-v8": "^1.6.0", | ||
"esbuild-plugin-version-injector": "^1.2.1", | ||
@@ -46,6 +46,6 @@ "eslint": "^8.57.0", | ||
"husky": "^9.0.11", | ||
"lint-staged": "^15.2.2", | ||
"prettier": "^3.2.5", | ||
"tsup": "^8.0.2", | ||
"vitest": "^1.4.0" | ||
"lint-staged": "^15.2.7", | ||
"prettier": "^3.3.2", | ||
"tsup": "^8.1.0", | ||
"vitest": "^1.6.0" | ||
}, | ||
@@ -52,0 +52,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
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
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
58254
510
Updatedcommander@^12.1.0
Updatedtypescript@^5.5.2