Skip to content

No error when "--emit-error-on-extra-keys" passed #217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
swierzbicki opened this issue Mar 19, 2025 · 9 comments
Open

No error when "--emit-error-on-extra-keys" passed #217

swierzbicki opened this issue Mar 19, 2025 · 9 comments

Comments

@swierzbicki
Copy link

swierzbicki commented Mar 19, 2025

Hi,

Maybe i do something wrong but i think it is not a rocker science.

I run the command:
transloco-keys-manager find --emit-error-on-extra-keys --project myProject

and it founds an extra keys but i did not see any error regarding this.

Image

end of the prompt:

Image

No error displayed.

Am i doing something wrong here?

Version: "@jsverse/transloco-keys-manager": "^4.0.0"

@shaharkazaz
Copy link
Collaborator

@swierzbicki Can you please try and upgrade to the latest which is 6.1.0?

@swierzbicki
Copy link
Author

swierzbicki commented Mar 21, 2025

@shaharkazaz after upgrading to 5.1.0 and to 6.1.0 i have an error for both cases.

command: transloco-keys-manager find --emit-error-on-extra-keys --project desktop

result:

Input path provided doesn't exist!
Translations path provided doesn't exist!

With version 4.0.0 it works but then i am not able to pass --emit-error-on-extra-keys parameter


According to this: https://jsverse.gitbook.io/transloco/tools/keys-manager-tkm/using-with-nx

This is my transloco.config.ts:

import { TranslocoGlobalConfig } from '@jsverse/transloco-utils';
import { supportedLanguages } from './libs/model/src';

const config: TranslocoGlobalConfig = {
  langs: [...supportedLanguages],
};

export default config;

So i do not have set the input and output etc. And i have workspace.json:

{
  "version": 2,
  "projects": {
    "desktop": "apps/desktop/src",
    "mobile": "apps/mobile/src",
    "dialogs": "libs/dialogs/src",
  },
  "$schema": "./node_modules/nx/schemas/workspace-schema.json"
}

@shaharkazaz
Copy link
Collaborator

shaharkazaz commented Mar 22, 2025

@swierzbicki, I wonder if this is related to some specific version and structure as I see you are not using standalone configuration, which has been going on for a while now, but it is still supposed to be supported.
Are your project.json files located at the specified locations? (e.g. apps/desktop/src/project.json), when given a string value in a project name TKM will search for a project.json within that folder to extract the sourceRoot and projectType.
Can you create a small reproduction for this issue?

There was a breaking change regarding the way paths are resolved on v5

@swierzbicki
Copy link
Author

  1. but it is still supposed to be supported

exactly :)


  1. Are your project.json files located at the specified locations? (e.g. apps/desktop/src/project.json), when given a string value in a project name TKM will search for a project.json within that folder to extract the sourceRoot and projectType.

Yes. I have project.json for all projects:

 "projects": {
    "desktop": "apps/desktop/src",
    "mobile": "apps/mobile/src",
    "dialogs": "libs/dialogs/src",
  },

  1. Can you create a small reproduction for this issue?

Yes. I will try but won't be easy. Because 5 min ago i created simple nx@17.00 workspace with 2 angular apps + 1 libray. Everything done according to documentation.

I wanted to add transloco according to this: https://jsverse.gitbook.io/transloco/getting-started/installation
and command nx g @jsverse/transloco:ng-add gave me an error.

But i suppose this is a different error for separate github issue 🤔


  1. There was a breaking change regarding the way paths are resolved on [v5]

Yes. I've seen this. That is why i pasted a transloco.config.ts file. But to be honest - docs don't describe it well imo.
I mean. There is no real example for quite common use case like:

  • more than 1 app
  • 1+ libraries

Anyway... i will try to create a reproduction repository.

@shaharkazaz
Copy link
Collaborator

@swierzbicki Tnx, out of curiosity, can you share the error you got trying to add Transloco?

@swierzbicki
Copy link
Author

swierzbicki commented Mar 24, 2025

@swierzbicki Tnx, out of curiosity, can you share the error you got trying to add Transloco?

jsverse/transloco#844

@swierzbicki
Copy link
Author

@shaharkazaz Back to the main topic related with this --emit-error-on-extra-keys issue.

I am not able to use the newest version of transloco-keys-manager as you asked- another error 🤷🏻‍♂️

Reproducable repository: https://github.com/swierzbicki/nx-with-transloco


  1. NX mono repo with transloco-keys-manager@5.1.0
    branch: main
    command: transloco-keys-manager find --project lib-with-transloco --emit-error-on-extra-keys

Result: Passing --emit-error-on-extra-keys still doesn't work. No error prompted.


  1. NX mono repo with the newest transloco-keys-manager@6.1.0

Result: Error

/some-example/node_modules/@jsverse/utils/visitors.js:1
import{ASTWithSource as s,Conditional as e,LiteralPrimitive as i,BindingPipe as t,LiteralMap as a,RecursiveAstVisitor as r,TmplAstRecursiveVisitor as n,tmplAstVisitAll as o}from"@angular/compiler";function p(e){return e instanceof s}function u(s){return s instanceof e}function l(s){return s instanceof i}function h(s){return s instanceof t}function c(s){return s instanceof a}class v extends r{config;_isSafeCall=!1;_isCall=!1;segments=[];constructor(s={}){super(),this.config=s}get isCall(){return this._isCall||this._isSafeCall}get path(){return this.segments.join(".")}visitBinary(s,e){return this.config.binaryNavigator?this.visit(this.config.binaryNavigator(s),e):super.visitBinary(s,e)}visitPropertyRead(s,e){return this.segments.unshift(s.name),super.visitPropertyRead(s,e)}visitSafePropertyRead(s,e){return this.segments.unshift(`${s.name}?`),super.visitSafePropertyRead(s,e)}visitCall(s,e){this._isCall=!0,this.visit(s.receiver,e)}visitSafeCall(s,e){this._isSafeCall=!0,this.visit(s.receiver,e)}}class d extends n{astTrees=new Set;pipeRegex;constructor(s){super(),this.pipeRegex=new RegExp(`\\|\\s*${s}`)}visitTemplate(s){o(this,s.templateAttrs),super.visitTemplate(s)}visitSwitchBlock(s){s.expression&&this.astTrees.add(s.expression),super.visitSwitchBlock(s)}visitIfBlockBranch(s){s.expression&&this.astTrees.add(s.expression),super.visitIfBlockBranch(s)}visitForLoopBlock(s){s.expression&&this.astTrees.add(s.expression),super.visitForLoopBlock(s)}visitBoundAttribute(s){this.handleBoundValue(s),super.visitBoundAttribute(s)}visitBoundText(s){this.handleBoundValue(s),super.visitBoundText(s)}visitLetDeclaration(s){this.astTrees.add(s.value),super.visitLetDeclaration(s)}handleBoundValue(s){const e=s.value;p(e)?this.pipeRegex.test(e.source)&&this.astTrees.add(e):this.astTrees.add(e)}}class f extends r{pipes=new Map;visitPipe(s,e){return this.pipes.has(s.name)||this.pipes.set(s.name,[]),this.pipes.get(s.name).push({node:s,context:e}),s.exp.visit(this),this.visitAll(s.args,e),null}}export{f as A,v as P,d as T,u as a,l as b,h as c,c as d,p as i};
                                                                                                                                                        ^^^^^^^^^^^^^^^
SyntaxError: The requested module '@angular/compiler' does not provide an export named 'tmplAstVisitAll'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:180:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:263:5)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:547:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5)

Node.js v22.13.0

According to docs transloco libs requires angular 16 or higher. So it should work with my example with Angular 17 :)


@shaharkazaz
Copy link
Collaborator

@swierzbicki Thanks for the reproduction, I'll take a look 👍

@swierzbicki
Copy link
Author

@shaharkazaz any news? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants