swagger-typescript-api
swagger-typescript-api copied to clipboard
use .prettierrc when it exist (instead of default prettier config with tabWidth: 2)
@js2me https://prettier.io/docs/en/configuration.html
Hi, I simply updated the scripts
in my project package.json as follows:
"scripts": {
...
"generate-api": "ts-node build-scripts/generate-api && eslint --fix \"src/models/swagger-gen/*.ts?(x)\"",
"build": "yarn generate-api && react-scripts build",
...
},
generate-api
- it starts the swagger-typescript-api
(customized via build-scripts/generate-api/index.ts file) and then starts the ESlint which also runs the prettier
. The files .eslintrc
and .prettierrc
are used from the project.
build
- first generates the API files and then builds my React app in standard way
I think you can easily use this approach regardless of the framework (React, Angular, Vue, ...) or package manager (yarn, npm, ...) you use.