Proper way to use transoloco-keys-manager with nx workspace

391 Views Asked by At

One month ago I generated a new NX workspace. I am developing only angular apps. I chose to use NX CLI instead of the angular one. We use transoloco for handling translations in our app.

There's another plugin developed by transloco team, called. transloco-keys-manager. We use it to manage keys and make sure no one is missing. Since I am using NX Cli I am not able to use schematics because it raises an error (An unhandled exception occurred: Cannot find module '@schematics/angular/utility/config'). I installed it directly via "npm i @ngneat/transloco-keys-manager". Then after trying to run it manually with "npm run i18n:find" I got an error "Cannot find angular.json, project.json or workspace.json". In my root folder I have none of these, project.jsons lies in each of the apps/libs folder.

The workaround that I found was adding workspace.json manually and insert list of projects inside like following:

{
  "version": 2,
  "projects": {
    "app1": "apps/app1/",
    "lib1": "libs/lib1/
  },
  "$schema": "./node_modules/nx/schemas/workspace-schema.json"
}

But with this approach it finds only the keys from first listed app. What is the correct approach to use transloco-keys-manager with Nx?

0

There are 0 best solutions below