nestjs-i18n
Advanced tools
Comparing version 4.1.2 to 4.1.3
@@ -8,3 +8,3 @@ "use strict"; | ||
const _ = require("lodash"); | ||
const chalk_1 = require("chalk"); | ||
const chalk = require("chalk"); | ||
class CheckAction extends abstract_action_1.AbstractAction { | ||
@@ -19,3 +19,3 @@ async handle(inputs, options) { | ||
const languages = parse_1.getDirectories(i18nPath).map(dir => path.relative(i18nPath, dir)); | ||
console.log(chalk_1.default.bold('found languages:'), chalk_1.default.bold.yellow(languages.join(','))); | ||
console.log(chalk.bold('found languages:'), chalk.bold.yellow(languages.join(','))); | ||
const translations = await parse_1.parseTranslations({ | ||
@@ -34,3 +34,3 @@ path: i18nPath, | ||
languages.forEach(lang => { | ||
console.log(`${chalk_1.default.underline('checking:')} ${chalk_1.default.bold.yellow(lang)}`); | ||
console.log(`${chalk.underline('checking:')} ${chalk.bold.yellow(lang)}`); | ||
let errorCount = 0; | ||
@@ -45,10 +45,10 @@ let message = ''; | ||
message += | ||
chalk_1.default.underline(`${chalk_1.default.bold.red(lang)} is missing value for key: ${chalk_1.default.bold.red(key)} in file: ${chalk_1.default.bold.red(fileName)}`) + '\n'; | ||
chalk.underline(`${chalk.bold.red(lang)} is missing value for key: ${chalk.bold.red(key)} in file: ${chalk.bold.red(fileName)}`) + '\n'; | ||
} | ||
}); | ||
if (errorCount === 0) { | ||
message = chalk_1.default.bold.green('ok'); | ||
message = chalk.bold.green('ok'); | ||
} | ||
else { | ||
console.log(chalk_1.default.red(`${chalk_1.default.bold(`${errorCount}`)} errors found:`)); | ||
console.log(chalk.red(`${chalk.bold(`${errorCount}`)} errors found:`)); | ||
} | ||
@@ -55,0 +55,0 @@ console.log(message.trim()); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const chalk_1 = require("chalk"); | ||
const chalk = require("chalk"); | ||
const check_command_1 = require("./check.command"); | ||
@@ -13,3 +13,3 @@ const check_action_1 = require("../actions/check.action"); | ||
program.on('command:*', () => { | ||
console.error(chalk_1.default.red('Invalid command: %s'), program.args.join(' ')); | ||
console.error(chalk.red('Invalid command: %s'), program.args.join(' ')); | ||
console.log('See --help for a list of available commands.'); | ||
@@ -16,0 +16,0 @@ process.exit(1); |
@@ -47,3 +47,3 @@ "use strict"; | ||
let translation = translationsByLanguage[key]; | ||
if (args || (args instanceof Array && args.length > 0)) { | ||
if (translation && (args || (args instanceof Array && args.length > 0))) { | ||
translation = format(translation, ...(args instanceof Array ? args || [] : [args])); | ||
@@ -50,0 +50,0 @@ } |
@@ -13,4 +13,16 @@ "use strict"; | ||
.readdirSync(dirPath, { withFileTypes: true }) | ||
.filter(f => f.isFile() && f.name.match(pattern)) | ||
.map(f => path.join(dirPath, f.name)); | ||
.filter((f) => { | ||
try { | ||
if (typeof f === 'string') { | ||
return fs.existsSync(path.join(dirPath, f)) && f.match(pattern); | ||
} | ||
else { | ||
return f.isFile() && f.name.match(pattern); | ||
} | ||
} | ||
catch (_a) { | ||
return false; | ||
} | ||
}) | ||
.map(f => path.join(dirPath, typeof f === 'string' ? f : f.name)); | ||
async function parseTranslations(options) { | ||
@@ -17,0 +29,0 @@ return new Promise((resolve, reject) => { |
@@ -47,3 +47,3 @@ "use strict"; | ||
let translation = translationsByLanguage[key]; | ||
if (args || (args instanceof Array && args.length > 0)) { | ||
if (translation && (args || (args instanceof Array && args.length > 0))) { | ||
translation = format(translation, ...(args instanceof Array ? args || [] : [args])); | ||
@@ -50,0 +50,0 @@ } |
@@ -13,4 +13,16 @@ "use strict"; | ||
.readdirSync(dirPath, { withFileTypes: true }) | ||
.filter(f => f.isFile() && f.name.match(pattern)) | ||
.map(f => path.join(dirPath, f.name)); | ||
.filter((f) => { | ||
try { | ||
if (typeof f === 'string') { | ||
return fs.existsSync(path.join(dirPath, f)) && f.match(pattern); | ||
} | ||
else { | ||
return f.isFile() && f.name.match(pattern); | ||
} | ||
} | ||
catch (_a) { | ||
return false; | ||
} | ||
}) | ||
.map(f => path.join(dirPath, typeof f === 'string' ? f : f.name)); | ||
async function parseTranslations(options) { | ||
@@ -17,0 +29,0 @@ return new Promise((resolve, reject) => { |
{ | ||
"name": "nestjs-i18n", | ||
"version": "4.1.2", | ||
"version": "4.1.3", | ||
"description": "", | ||
@@ -28,27 +28,26 @@ "author": "Toon van Strijp", | ||
"devDependencies": { | ||
"@nestjs/common": "^6.7.2", | ||
"@nestjs/core": "^6.7.2", | ||
"@nestjs/graphql": "^6.5.1", | ||
"@nestjs/platform-express": "^6.7.2", | ||
"@nestjs/platform-fastify": "^6.7.2", | ||
"@nestjs/testing": "^6.7.2", | ||
"@nestjs/common": "^6.10.3", | ||
"@nestjs/core": "^6.10.3", | ||
"@nestjs/graphql": "^6.5.3", | ||
"@nestjs/platform-express": "^6.10.3", | ||
"@nestjs/platform-fastify": "^6.10.3", | ||
"@nestjs/testing": "^6.10.3", | ||
"@types/commander": "^2.12.2", | ||
"@types/cookie": "^0.3.3", | ||
"@types/flat": "0.0.28", | ||
"@types/jest": "^24.0.18", | ||
"@types/lodash": "^4.14.139", | ||
"@types/node": "^12.7.7", | ||
"@types/jest": "^24.0.23", | ||
"@types/lodash": "^4.14.149", | ||
"@types/node": "^12.12.14", | ||
"@types/string-format": "^2.0.0", | ||
"@types/supertest": "^2.0.8", | ||
"apollo-server-express": "^2.9.4", | ||
"fastify": "^2.8.0", | ||
"apollo-server-express": "^2.9.12", | ||
"fastify": "^2.10.0", | ||
"graphql": "^14.5.8", | ||
"graphql-tools": "^4.0.5", | ||
"husky": "3.0.9", | ||
"graphql-tools": "^4.0.6", | ||
"husky": "3.1.0", | ||
"jest": "^24.9.0", | ||
"lint-staged": "9.4.1", | ||
"prettier": "1.19.0", | ||
"lint-staged": "9.5.0", | ||
"prettier": "1.19.1", | ||
"reflect-metadata": "^0.1.13", | ||
"supertest": "^4.0.2", | ||
"ts-jest": "^24.1.0", | ||
"ts-jest": "^24.2.0", | ||
"typescript": "3.6.3" | ||
@@ -58,3 +57,3 @@ }, | ||
"chalk": "^3.0.0", | ||
"commander": "^4.0.0", | ||
"commander": "^4.0.1", | ||
"cookie": "^0.4.0", | ||
@@ -61,0 +60,0 @@ "flat": "^5.0.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
1453093
25
1288
Updatedcommander@^4.0.1