jsverse / transloco-keys-manager

🦄 The Key to a Better Translation Experience

Home Page:https://github.com/jsverse/transloco/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: Input and Translations path not found

maxbeba opened this issue · comments

Is there an existing issue for this?

  • I have searched the existing issues

Is this a regression?

Yes

Current behavior

I am running "transloco-keys-manager extract" in an nx workspace using the nx:run-commands executor.
My project.json is located in apps/mobile, so the cwd for the command is set to that path.

My understanding is, that the input path should be relative to the cwd, correct?

It results only in the error message "Input path provided doesn't exist!"
You can see the paths in config and log below.

"extract-i18n": {
      "executor": "nx:run-commands",
      "options": {
        "command": "DEBUG=* transloco-keys-manager extract",
        "cwd": "apps/mobile"
      }
    },

As this is a quite special setup of an ionic app in nx workspace there is a project.json and an angular.json in apps/mobile because of some stupid issue in ionic cli. The source root in both is the same. But my logic tells me that these files should not matter as the transloco.config.js defines relative paths to cwd.

project.json

{
  "name": "mobile",
  "$schema": "../../node_modules/nx/schemas/project-schema.json",
  "projectType": "application",
  "prefix": "mobile",
  "sourceRoot": "apps/mobile/src",
  "tags": [],

angular.json

{
  "$schema": "../../node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "projects": {
    "mobile": {
      "projectType": "application",
      "schematics": {
        "@schematics/angular:component": {
          "style": "scss"
        },
        "@ionic/angular-toolkit:page": {
          "styleext": "scss",
          "standalone": true
        }
      },
      "root": "apps/mobile",
      "sourceRoot": "apps/mobile/src",
      "prefix": "mobile",

Expected behavior

It should find the paths...

Please provide a link to a minimal reproduction of the bug

Transloco Config

module.exports = {
  keysManager: {
    input: 'src/app',
    translationsPath: 'src/assets/i18n',
  }
}

Debug Logs

🐞 DEBUG - Config:
2023-04-28T18:54:07.497Z  Default: {
  input: [ 'app' ],
  output: 'assets/i18n',
  langs: [ 'en' ],
  marker: 't',
  sort: false,
  defaultValue: undefined,
  replace: false,
  removeExtraKeys: false,
  addMissingKeys: false,
  emitErrorOnExtraKeys: false,
  translationsPath: 'assets/i18n',
  fileFormat: 'json'
}
2023-04-28T18:54:07.497Z  Transloco file: { input: [ 'src/app' ], translationsPath: 'src/assets/i18n' }
2023-04-28T18:54:07.497Z  Inline: { command: 'extract' }
2023-04-28T18:54:07.497Z  Merged: {
  input: [ 'src/app' ],
  output: 'assets/i18n',
  langs: [ 'en' ],
  marker: 't',
  sort: false,
  defaultValue: undefined,
  replace: false,
  removeExtraKeys: false,
  addMissingKeys: false,
  emitErrorOnExtraKeys: false,
  translationsPath: 'src/assets/i18n',
  fileFormat: 'json',
  command: 'extract'
}
Input path provided doesn't exist!


### Please provide the environment you discovered this bug in

```markdown
Transloco: ^4.2.6
Transloco Keys Manager: ^3.7.0
Angular: ~15.2.0
Node: v16.18.0
Package Manager: npm
OS: MacOS

Additional context

No response

I would like to make a pull request for this bug

No