Feature: Provide a way to override sourceRoot
penleychan opened this issue ยท 5 comments
Is there an existing issue for this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe
Currently the default source root src
if no workspace/angular.json is found.
Project was generated with nx with Integrated Repos workspace, and default source root is apps
.
Describe the solution you'd like
Provide a configuration to override sourceRoot via options on transloco.config.js.
{
....
sourceRoot: 'apps',
....
}
Describe alternatives you've considered
No response
Describe alternatives you've considered
N/A
Describe alternatives you've considered
N/A
Additional context
No response
I would like to make a pull request for this feature
No
This could also provide workaround for the bug #149 since when we call transloco-keys-manager extract --sourceRoot /libs/my-library
it won't need to find a angular.json
to figure out the sourceRoot. If they would also allow sourceRoot
to be set from cli
No idea when this feature ever going to be implement or if ever, I've quickly created a patch for my own use case.
@JelleBruisten, no idea if this will work for you or not don't have time to invest in it. Published on npmjs:
https://www.npmjs.com/package/@penleychan/transloco-keys-manager
yarn add @penleychan/transloco-keys-manager
Provide sourceRoot
on transloco.config.js
:
keysManager: {
...
sourceRoot: 'apps'
},
Or via cli
transloco-keys-manager extract --project PROJECTNAME --sourceRoot apps
Basically all I did was commented out that error message, it will still default to src
then on resolveConfig.ts
If there's sourceRoot
detected from cli or config.js it will override the projectBasePath
.
If nothing is found it will display Input path provided doesn't exists!
I've added support for workspaces without root configurations, please note that you must pass the project name in order for the commands to work since it can't resolve the default project without a root config.
Pleas try v3.6 and LMK.
Thanks for adding this.
1 Issue:
- Extract seems to only look within the
apps/[projectname]/src/app
directory, anything outside of that directory does not get scanned ex.apps/[projectname]/src/components
. But this can be resolved by providinginput
value to./
Regards
@penleychan As you said, it's not an issue since it's configurable ๐
Closing this as the main issue is resolved.