Closed stockbal closed 2 months ago
Hi Ludwig,
thanks for pointing this out. I have some good news, then some bad news, then some more good news:
cds-typer can be fully configured using cds.env
. More specifically, you can place any of the relevant options under cds.env.typer
just as you would pass them in as parameters. Those should then be picked up by cds-typer, regardless of whether you run it from the IDE or as part of your build process. But as I have recently found out, camelCased environment options can not be used in all constellations for technical reasons. I am therefore currently in the process of allowing any option to be passed in both camelcase and snake_case. It's a bit more involved than I had originally anticipated, but once that is done, you'll be able to use cds: { typer: { use_entities_proxy: true } }
as part of your package.json, or in any other way you can use to modify cds.env
.
Best, Daniel
Hi Ludwig,
I have now merged the configuration via snake case, so it is available in main
now if you would like to confirm this works.
Best, Daniel
Hi @daogrady,
I checked it and it works. I configured it via cds
in my package.json.
...
"cds": {
"typer": {
"useEntitiesProxy": "true",
"outputDirectory": "@cds-models"
}
}
...
but as you can see, I also have to configure the outputDirectory
in the env, otherwise the cds-typer build-plugin fails, as the output directory is ignored:
/cds-plugins.js
/lib/compile.js
Hi Ludwig,
thanks for pointing this out! I will revisit the build-plugin, which was not built with configuration via cds.env
in mind.
Best, Daniel
Hi Ludwig,
I have attached a PR to prioritise configuration passed through cds.env
. If you would like to check it before I merge, just let me know.
Best, Daniel
Hi Daniel,
i left you a comment on the PR.
Regards, Ludwig
Is there an existing issue for this?
Nature of Your Project
TypeScript
Current Behavior
I added the new cli option
--useEntitiesProxy true
to my VS Code settings (i.e."cds.typeGenerator.command"
) and during development the types are getting generated correctly.However, during the build, cds-typer is using the function
compileFromFile
directly and only passes the output directory as option. This results in not having the proxy exports in the final cds build output.Expected Behavior
Some central way to specify cds-typer parameters that are used during development and during build, so the generated types output between dev and build does not differ.
Steps To Reproduce
No response
Environment
Repository Containing a Minimal Reproducible Example
No response
Anything else?
No response