JSPM

strapi-generate-types

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 722
  • Score
    100M100P100Q102290F
  • License MIT

CLI to generate types based on your Strapi API content types

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (strapi-generate-types) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    strapi-generate-types

    strapi-generate-types

    npm version npm downloads License

    CLI to generate types based on your Strapi API content types.

    Features

    • Generate Typescript's types based on your content types
    • Ease-of-use thanks a beautiful prompt

    Getting started

    ⏳ Installation

    yarn add strapi-generate-types

    or

    npm install --save strapi-generate-types

    🖐 Requirements

    In order to use this generator you must have installed the GraphQL plugin on your Strapi API.

    yarn strapi install graphql

    For more informations see the GraphQL plugin

    🕹 Usage

    yarn strapi-generate-types generate

    OR

    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).
    2. Then, where you want to generate it (default: ./models/).
    3. Finally, the name of the file which will be generated (default: types.ts)

    Enjoy 🎉

    If you don't want to use the prompt everytime you run the generator, you can use the quickgen:

    yarn|npx strapi quickgen <url> [-p, --path <location>, default: "./models/"] [-n, --file-name <filename>, default: "types.ts"]

    License

    MIT License