@jsverse/transloco-keys-manager
Advanced tools
Comparing version 4.2.2 to 4.2.3
{ | ||
"name": "@jsverse/transloco-keys-manager", | ||
"version": "4.2.2", | ||
"version": "4.2.3", | ||
"description": "Extract translatable keys from projects that uses Transloco", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -259,3 +259,4 @@ > [!IMPORTANT] | ||
*Notes:* | ||
1. When using a Typescript file, you must have an `import { } from '@jsverse/transloco'` statement in it. | ||
1. When using a Typescript file, you must have `@jsverse/transloco` present somewhere in the file, if it's an import or | ||
simply adding a comment `// @jsverse/transloco`. | ||
2. When using comments in your HTML files, they *must* contain only the markers without additional text. | ||
@@ -342,6 +343,14 @@ Here's an example for invalid comment: | ||
- `project`*: The targeted project (default is `defaultProject`). The `sourceRoot` of this project will be extracted from the `angular.json` file and will prefix the `input`, `output`, and `translationPath` properties. | ||
- `config`: The root search directory for the transloco config file: (default is `process.cwd()`) | ||
```bash | ||
transloco-keys-manager extract --config src/my/path | ||
transloco-keys-manager extract -c src/my/path | ||
``` | ||
- `project`*: The targeted project (default is `defaultProject`). The `sourceRoot` of this project will be extracted | ||
from the `angular.json` file and will prefix the `input`, `output`, and `translationPath` properties. | ||
In addition, the transloco config file will be searched in the project's `sourceRoot` (unless the `config` option is passed): | ||
``` | ||
```bash | ||
transloco-keys-manager extract --project first-app | ||
@@ -352,12 +361,12 @@ ``` | ||
- `config`: The root search directory for the transloco config file: (default is `process.cwd()`) | ||
- `translationsPath`: The path for the root directory of the translation files (default is `${sourceRoot}/assets/i18n`) | ||
```bash | ||
transloco-keys-manager find --translations-path my/path | ||
transloco-keys-manager find -p my/path | ||
``` | ||
transloco-keys-manager extract --config src/my/path | ||
transloco-keys-manager extract -c src/my/path | ||
``` | ||
- `input`: The source directory for all files using the translation keys: (default is `['app']`) | ||
- `input`: The source directory for all files using the translation keys: (default is `[${sourceRoot}/app']`) | ||
``` | ||
```bash | ||
transloco-keys-manager extract --input src/my/path | ||
@@ -370,5 +379,5 @@ transloco-keys-manager extract --input src/my/path,project/another/path | ||
- `output`: The target directory for all generated translation files: (default is `assets/i18n`) | ||
- `output`: The target directory for all generated translation files: (default is `${sourceRoot}/assets/i18n`) | ||
``` | ||
```bash | ||
transloco-keys-manager extract --output my/path | ||
@@ -380,3 +389,3 @@ transloco-keys-manager extract -o my/path | ||
``` | ||
```bash | ||
transloco-keys-manager extract --file-format pot | ||
@@ -388,3 +397,3 @@ transloco-keys-manager extract -f pot | ||
``` | ||
```bash | ||
transloco-keys-manager extract --langs en es it | ||
@@ -396,3 +405,3 @@ transloco-keys-manager extract -l en es it | ||
``` | ||
```bash | ||
transloco-keys-manager extract --marker _ | ||
@@ -404,3 +413,3 @@ transloco-keys-manager extract -m _ | ||
``` | ||
```bash | ||
transloco-keys-manager extract --sort | ||
@@ -411,3 +420,3 @@ ``` | ||
``` | ||
```bash | ||
transloco-keys-manager extract --unflat | ||
@@ -423,3 +432,3 @@ transloco-keys-manager extract -u | ||
``` | ||
```bash | ||
transloco-keys-manager extract --default-value missingValue | ||
@@ -436,3 +445,3 @@ transloco-keys-manager extract -d "{{key}} translation is missing" | ||
``` | ||
```bash | ||
transloco-keys-manager extract --replace | ||
@@ -444,3 +453,3 @@ transloco-keys-manager extract -r | ||
``` | ||
```bash | ||
transloco-keys-manager extract --remove-extra-keys | ||
@@ -452,3 +461,3 @@ transloco-keys-manager extract -R | ||
``` | ||
```bash | ||
transloco-keys-manager find --add-missing-keys | ||
@@ -461,3 +470,3 @@ transloco-keys-manager find -a | ||
``` | ||
```bash | ||
transloco-keys-manager find --emit-error-on-extra-keys | ||
@@ -467,12 +476,5 @@ transloco-keys-manager find -e | ||
- `translationsPath`: The path for the root directory of the translation files (default is `assets/i18n`) | ||
``` | ||
transloco-keys-manager find --translations-path my/path | ||
transloco-keys-manager find -p my/path | ||
``` | ||
- `help`: | ||
``` | ||
```bash | ||
transloco-keys-manager --help | ||
@@ -479,0 +481,0 @@ transloco-keys-manager -h |
@@ -40,3 +40,13 @@ import path, { sep } from 'node:path'; | ||
export function resolveConfigPaths(config, sourceRoot) { | ||
const resolvePath = (configPath) => path.resolve(process.cwd(), sourceRoot, configPath || ''); | ||
const resolvePath = (configPath = '') => { | ||
const fragments = [process.cwd()]; | ||
if (!configPath.startsWith(sourceRoot)) { | ||
fragments.push(sourceRoot); | ||
} | ||
else { | ||
console.warn('Your path is automatically prefixed with the sourceRoot'); | ||
} | ||
fragments.push(configPath); | ||
return path.resolve(...fragments); | ||
}; | ||
config.input = config.input.map(resolvePath); | ||
@@ -43,0 +53,0 @@ config.output = resolvePath(config.output); |
@@ -25,3 +25,2 @@ import { getGlobalConfig, } from '@jsverse/transloco-utils'; | ||
resolveConfigPaths(mergedConfig, projectBasePath); | ||
validateDirectories(mergedConfig); | ||
devlog('paths', 'Configuration Paths', { | ||
@@ -32,2 +31,3 @@ Input: mergedConfig.input, | ||
}); | ||
validateDirectories(mergedConfig); | ||
updateScopesMap({ input: mergedConfig.input }); | ||
@@ -34,0 +34,0 @@ devlog('scopes', 'Scopes', { |
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
191179
2482
513