@ngneat/transloco-scoped-libs
Advanced tools
Comparing version 3.0.2 to 3.0.3
@@ -5,2 +5,8 @@ # Changelog | ||
## [3.0.3](https://github.com/ngneat/transloco/compare/transloco-scoped-libs-3.0.2...transloco-scoped-libs-3.0.3) (2021-10-28) | ||
### Bug Fixes | ||
- **scoped-libs:** 🐛 resolve scoped libs path ([c7a701f](https://github.com/ngneat/transloco/commit/c7a701feebb6a27b35bbc982ee37f80e1204efe1)) | ||
## [3.0.2](https://github.com/ngneat/transloco/compare/transloco-scoped-libs-3.0.1...transloco-scoped-libs-3.0.2) (2021-10-28) | ||
@@ -7,0 +13,0 @@ |
{ | ||
"name": "@ngneat/transloco-scoped-libs", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "Transloco support tool for libraries with translations", | ||
@@ -45,3 +45,3 @@ "main": "src/lib/transloco-scroped-libs.js", | ||
"dependencies": { | ||
"@ngneat/transloco-utils": "^3.0.1", | ||
"@ngneat/transloco-utils": "^3.0.2", | ||
"chalk": "^4.1.2", | ||
@@ -48,0 +48,0 @@ "chokidar": "^3.5.2", |
@@ -92,12 +92,16 @@ "use strict"; | ||
function coerceScopedLibs(scopedLibs, defaultPath) { | ||
if (!scopedLibs || scopedLibs.length === 0) { | ||
if (!(scopedLibs === null || scopedLibs === void 0 ? void 0 : scopedLibs.length)) { | ||
console.log(chalk_1.default.red('Please add "scopedLibs" configuration in transloco.config.js file.', libSrcExample)); | ||
return []; | ||
} | ||
return scopedLibs.map((lib) => ({ src: lib, dist: [defaultPath] })); | ||
return scopedLibs.map((lib) => { | ||
return scoped_libs_utils_1.isString(lib) | ||
? { src: lib, dist: [defaultPath] } | ||
: Object.assign(Object.assign({}, lib), { dist: scoped_libs_utils_1.coerceArray(lib.dist) }); | ||
}); | ||
} | ||
function copyScopes(options) { | ||
const resolvedOptions = Object.assign(Object.assign({}, options), { fileExtention: 'json' }); | ||
const resolvedOptions = Object.assign(Object.assign({}, options), { fileExtension: 'json' }); | ||
if (resolvedOptions.strategy === 'join') { | ||
resolvedOptions.fileExtention = 'vendor.json'; | ||
resolvedOptions.fileExtension = 'vendor.json'; | ||
} | ||
@@ -111,7 +115,7 @@ else { | ||
function copyScopeTranslationFiles(options) { | ||
const { files, fileExtention, outputDir, skipGitIgnoreUpdate, strategy, scope, } = options; | ||
const { files, fileExtension, outputDir, skipGitIgnoreUpdate, strategy, scope, } = options; | ||
for (let translationFilePath of files) { | ||
translationFilePath = path_1.default.normalize(translationFilePath); | ||
const [lang] = path_1.default.basename(translationFilePath).split('.'); | ||
const fileName = `${lang}.${fileExtention}`; | ||
const fileName = `${lang}.${fileExtension}`; | ||
const outputFilePath = path_1.default.join(outputDir, fileName); | ||
@@ -118,0 +122,0 @@ console.log('✅ Copy translation from file:', chalk_1.default.blue(scoped_libs_utils_1.cutPath(translationFilePath)), 'to:', chalk_1.default.blue(scoped_libs_utils_1.cutPath(outputFilePath))); |
12416
247