CLI to generate types based on your Strapi API content types
npm install strapi-generate-types[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![License][license-src]][license-href]
> CLI to generate types based on your Strapi API content types.
- Generate Typescript's types based on your content types
- Ease-of-use thanks a beautiful prompt
``bash`
yarn add strapi-generate-types
or
`bash`
npm install --save strapi-generate-types
In order to use this generator you must have installed the GraphQL plugin on your Strapi API.
`bash`
yarn strapi install graphql
For more informations see the GraphQL plugin
`bash`
yarn strapi-generate-types generate
OR
`bash`
npx strapi-generate-types generate
The prompt will ask you 3 things:
1. First, the host of your Strapi API with which you want to generate your types (default: http://localhost:1337)../models/
2. Then, where you want to generate it (default: ).types.ts
3. Finally, the name of the file which will be generated (default: )
Enjoy 🎉
_If you don't want to use the prompt everytime you run the generator, you can use the quickgen:_
`bash``
yarn|npx strapi quickgen
[npm-version-src]: https://img.shields.io/npm/v/strapi-generate-types/latest.svg?style=flat-square
[npm-version-href]: https://npmjs.com/package/strapi-generate-types
[npm-downloads-src]: https://img.shields.io/npm/dt/strapi-generate-types.svg?style=flat-square
[npm-downloads-href]: https://npmjs.com/package/strapi-generate-types
[license-src]: https://img.shields.io/npm/l/strapi-generate-types.svg?style=flat-square
[license-href]: ./LICENSE