orval
orval copied to clipboard
Angular Builder to run the generation
Usually, in Angular development, we are using the Angular CLI that is specifying a way to run/configure/test/etc... the project.
For example, you can have multiple applications and you can start them by using:
yarn start myApp
yarn start myOtherApp
The start
is considered as a target of your application. We can create our custom target by creating a builder.
So it would be useful to have an orval builder that could be used in the angular.json
:
{
"myApp": {
...
"architect": {
"orval": {
"builder": "orval:generate",
"options": {
"config": "./apps/my-app/orval.config.js",
... // all configuration could be set here but starting with the link to the orval config is already good
},
},
...
For Nx Users, this approach could be used too:
"targets": {
...
"orval": {
"executor": "@nrwl/workspace:run-commands",
"outputs": ["libs/my-app/core/api/src/lib/*/generated"],
"options": {
"commands": ["npx orval --config libs/my-app/core/api/orval.config.js"]
}
}
},
And add orval script in your package.json
:
...
"orval": "nx orval",
...
And run the target like this:
yarn orval my-app-core-api
But this is just an alternative of a real builder
@jogelin there has been no other requests or upvotes on this issue so I am going to mark it as workaround provided and close it. I can reopen if a PR is provided.