@ngneat/transloco-scoped-libs
Advanced tools
Comparing version 3.0.5 to 5.0.0
@@ -5,6 +5,22 @@ # Changelog | ||
## [3.0.5](https://github.com/ngneat/transloco/compare/transloco-scoped-libs-3.0.4...transloco-scoped-libs-3.0.5) (2023-05-18) | ||
# [5.0.0](https://github.com/ngneat/transloco/compare/transloco-scoped-libs-4.0.0...transloco-scoped-libs-5.0.0) (2023-07-30) | ||
### Bug Fixes | ||
- **transloco-scoped-libs:** 🐛 remove unwanted peerDependencies ([#668](https://github.com/ngneat/transloco/issues/668)) ([8a05565](https://github.com/ngneat/transloco/commit/8a0556516c58bd39469964744dd4d79b776ce862)) | ||
# [4.0.0](https://github.com/ngneat/transloco/compare/transloco-scoped-libs-3.0.5...transloco-scoped-libs-4.0.0) (2023-06-17) | ||
### chore | ||
- 🤖 upgrade to angular v16 ([#661](https://github.com/ngneat/transloco/issues/661)) ([08db7e7](https://github.com/ngneat/transloco/commit/08db7e7d1f64846fa0b07123dee8ff5bff20b4f0)) | ||
- **scoped-libs:** 🤖 min node version is 16 ([42ffd32](https://github.com/ngneat/transloco/commit/42ffd329226bf59677b853845ddd51550f45e316)) | ||
### BREAKING CHANGES | ||
- **scoped-libs:** 🧨 min node version is 16 | ||
- 🧨 Angular 16 | ||
## [3.0.5](https://github.com/ngneat/transloco/compare/transloco-scoped-libs-3.0.4...transloco-scoped-libs-3.0.5) (2023-05-18) | ||
## [3.0.4](https://github.com/ngneat/transloco/compare/transloco-scoped-libs-3.0.3...transloco-scoped-libs-3.0.4) (2022-01-15) | ||
@@ -11,0 +27,0 @@ |
{ | ||
"name": "@ngneat/transloco-scoped-libs", | ||
"version": "3.0.5", | ||
"version": "5.0.0", | ||
"description": "Transloco support tool for libraries with translations", | ||
"main": "src/lib/transloco-scoped-libs.js", | ||
"engines": { | ||
"node": ">=16" | ||
}, | ||
"bin": { | ||
@@ -45,3 +48,3 @@ "transloco-scoped-libs": "src/index.js" | ||
"dependencies": { | ||
"@ngneat/transloco-utils": "^3.0.5", | ||
"@ngneat/transloco-utils": "^4.0.0", | ||
"chalk": "^4.1.2", | ||
@@ -53,10 +56,3 @@ "chokidar": "^3.5.2", | ||
}, | ||
"typings": "./src/index.d.ts", | ||
"peerDependencies": { | ||
"cosmiconfig": "^8.1.3", | ||
"tslib": "2.3.1", | ||
"zone.js": "0.11.5", | ||
"@angular/core": "13.3.10", | ||
"@angular/platform-browser-dynamic": "13.3.10" | ||
} | ||
"types": "./src/index.d.ts" | ||
} |
@@ -5,3 +5,3 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const path_1 = tslib_1.__importDefault(require("path")); | ||
const node_path_1 = tslib_1.__importDefault(require("node:path")); | ||
const fs_1 = tslib_1.__importDefault(require("fs")); | ||
@@ -11,3 +11,3 @@ const fs_extra_1 = tslib_1.__importDefault(require("fs-extra")); | ||
function toLinuxFormat(p) { | ||
return p.split(path_1.default.sep).join('/'); | ||
return p.split(node_path_1.default.sep).join('/'); | ||
} | ||
@@ -20,5 +20,5 @@ exports.toLinuxFormat = toLinuxFormat; | ||
function getPackageJson(lib) { | ||
let pkgPath = path_1.default.join(process.cwd(), lib, 'package.json'); | ||
let pkgPath = node_path_1.default.join(process.cwd(), lib, 'package.json'); | ||
if (!fs_1.default.existsSync(pkgPath)) { | ||
pkgPath = path_1.default.resolve(path_1.default.join('node_modules', lib, 'package.json')); | ||
pkgPath = node_path_1.default.resolve(node_path_1.default.join('node_modules', lib, 'package.json')); | ||
} | ||
@@ -29,3 +29,3 @@ return { path: pkgPath, content: readJson(pkgPath) }; | ||
function insertPathToGitIgnore(route) { | ||
const gitIgnorePath = path_1.default.resolve('.gitignore'); | ||
const gitIgnorePath = node_path_1.default.resolve('.gitignore'); | ||
if (!fs_1.default.existsSync(gitIgnorePath)) { | ||
@@ -32,0 +32,0 @@ return; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const path_1 = tslib_1.__importDefault(require("path")); | ||
const node_path_1 = tslib_1.__importDefault(require("node:path")); | ||
const chalk_1 = tslib_1.__importDefault(require("chalk")); | ||
@@ -37,3 +37,2 @@ const glob_1 = tslib_1.__importDefault(require("glob")); | ||
function run({ watch, skipGitIgnoreUpdate, rootTranslationsPath, scopedLibs, }) { | ||
var _a; | ||
const scopedLibsArr = coerceScopedLibs(scopedLibs, rootTranslationsPath); | ||
@@ -51,14 +50,14 @@ const startMsg = watch | ||
if (!pkg.content.i18n) { | ||
console.log(chalk_1.default.red(`${path_1.default.join(lib.src, 'package.json')} is missing i18n information.`, packageJsoni18nExample)); | ||
console.log(chalk_1.default.red(`${node_path_1.default.join(lib.src, 'package.json')} is missing i18n information.`, packageJsoni18nExample)); | ||
return; | ||
} | ||
if (!((_a = lib.dist) === null || _a === void 0 ? void 0 : _a.length)) { | ||
if (!lib.dist?.length) { | ||
console.log(chalk_1.default.red('please specify dist path, by either set "rootTranslationsPath" or specify the "dist" for each library', libSrcExample)); | ||
return; | ||
} | ||
const outputs = lib.dist.map((o) => path_1.default.resolve(o)); | ||
const input = path_1.default.dirname(pkg.path); | ||
const outputs = lib.dist.map((o) => node_path_1.default.resolve(o)); | ||
const input = node_path_1.default.dirname(pkg.path); | ||
for (const scopeConfig of pkg.content.i18n) { | ||
const { scope, strategy } = scopeConfig; | ||
(0, glob_1.default)(`${path_1.default.join(input, scopeConfig.path)}/**/*.json`, {}, function (err, files) { | ||
(0, glob_1.default)(`${node_path_1.default.join(input, scopeConfig.path)}/**/*.json`, {}, function (err, files) { | ||
if (err) | ||
@@ -94,3 +93,3 @@ console.log(chalk_1.default.red(err)); | ||
function coerceScopedLibs(scopedLibs, defaultPath) { | ||
if (!(scopedLibs === null || scopedLibs === void 0 ? void 0 : scopedLibs.length)) { | ||
if (!scopedLibs?.length) { | ||
console.log(chalk_1.default.red('Please add "scopedLibs" configuration in transloco.config.js file.', libSrcExample)); | ||
@@ -102,7 +101,10 @@ return []; | ||
? { src: lib, dist: [defaultPath] } | ||
: Object.assign(Object.assign({}, lib), { dist: (0, scoped_libs_utils_1.coerceArray)(lib.dist) }); | ||
: { ...lib, dist: (0, scoped_libs_utils_1.coerceArray)(lib.dist) }; | ||
}); | ||
} | ||
function copyScopes(options) { | ||
const resolvedOptions = Object.assign(Object.assign({}, options), { fileExtension: 'json' }); | ||
const resolvedOptions = { | ||
...options, | ||
fileExtension: 'json', | ||
}; | ||
if (resolvedOptions.strategy === 'join') { | ||
@@ -112,3 +114,3 @@ resolvedOptions.fileExtension = 'vendor.json'; | ||
else { | ||
resolvedOptions.outputDir = path_1.default.join(resolvedOptions.outputDir, options.scope); | ||
resolvedOptions.outputDir = node_path_1.default.join(resolvedOptions.outputDir, options.scope); | ||
fs_extra_1.default.mkdirsSync(resolvedOptions.outputDir); | ||
@@ -121,6 +123,6 @@ } | ||
for (let translationFilePath of files) { | ||
translationFilePath = path_1.default.normalize(translationFilePath); | ||
const [lang] = path_1.default.basename(translationFilePath).split('.'); | ||
translationFilePath = node_path_1.default.normalize(translationFilePath); | ||
const [lang] = node_path_1.default.basename(translationFilePath).split('.'); | ||
const fileName = `${lang}.${fileExtension}`; | ||
const outputFilePath = path_1.default.join(outputDir, fileName); | ||
const outputFilePath = node_path_1.default.join(outputDir, fileName); | ||
console.log('✅ Copy translation from file:', chalk_1.default.blue((0, scoped_libs_utils_1.cutPath)(translationFilePath)), 'to:', chalk_1.default.blue((0, scoped_libs_utils_1.cutPath)(outputFilePath))); | ||
@@ -145,5 +147,5 @@ if (!skipGitIgnoreUpdate) { | ||
if (strategy === 'join') { | ||
content = Object.assign(Object.assign({}, (0, scoped_libs_utils_1.readJson)(outputFilePath)), { [scope]: content }); | ||
content = { ...(0, scoped_libs_utils_1.readJson)(outputFilePath), [scope]: content }; | ||
} | ||
(0, scoped_libs_utils_1.writeJson)(outputFilePath, content); | ||
} |
@@ -10,7 +10,3 @@ "use strict"; | ||
(0, testing_1.getTestBed)().initTestEnvironment(testing_2.BrowserDynamicTestingModule, (0, testing_2.platformBrowserDynamicTesting)(), { | ||
teardown: { destroyAfterEach: false } | ||
teardown: { destroyAfterEach: false }, | ||
}); | ||
// Then we find all the tests. | ||
const context = require.context('./', true, /\.spec\.ts$/); | ||
// And load the modules. | ||
context.keys().map(context); |
13723
6
247
- Removed@angular/common@13.3.10(transitive)
- Removed@angular/compiler@13.3.10(transitive)
- Removed@angular/core@13.3.10(transitive)
- Removed@angular/platform-browser@13.3.10(transitive)
- Removed@angular/platform-browser-dynamic@13.3.10(transitive)
- Removed@babel/code-frame@7.24.7(transitive)
- Removed@babel/helper-validator-identifier@7.24.7(transitive)
- Removed@babel/highlight@7.24.7(transitive)
- Removed@ngneat/transloco-utils@3.0.5(transitive)
- Removedansi-styles@3.2.1(transitive)
- Removedargparse@2.0.1(transitive)
- Removedcallsites@3.1.0(transitive)
- Removedchalk@2.4.2(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedcosmiconfig@8.3.6(transitive)
- Removederror-ex@1.3.2(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removedimport-fresh@3.3.0(transitive)
- Removedis-arrayish@0.2.1(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedjs-yaml@4.1.0(transitive)
- Removedjson-parse-even-better-errors@2.3.1(transitive)
- Removedlines-and-columns@1.2.4(transitive)
- Removedparent-module@1.0.1(transitive)
- Removedparse-json@5.2.0(transitive)
- Removedpath-type@4.0.0(transitive)
- Removedpicocolors@1.0.1(transitive)
- Removedresolve-from@4.0.0(transitive)
- Removedrxjs@7.8.1(transitive)
- Removedsupports-color@5.5.0(transitive)
- Removedtslib@2.3.1(transitive)
- Removedzone.js@0.11.5(transitive)