This is mostly a wrapper around the contentful rest api.

Update content type into Contentful

When you are updating a field inside a content type in Contentful you will need to re-generate the contentfulTypes.d.ts file and commit it with your changes with the following command:
yarn nx run api:contentful-types
We keep this file in the repository because in case contentful is down, the whole pipeline would fail and we won’t be able to build By keeping it in the repo, we ensure we can still build and we don't have to rely on an external service.
The CONTENTFUL_ENVIRONMENT environment variable is used to determine which Contentful environment is used to generate types.

Generate models for a new content type

When creating a new content type in contentful, you can run a script that will generate models based on the content type's JSON from contentful.
yarn nx run api:contentType --id contentTypeId
The script take 3 arguments:
  • --id
    required, string
    The "contentTypeId" that you want to create types/models of
  • --sys
    optional, string
    values: id, createdAt, updatedAt
    A string of fields that you want to be added to the root model (separated by a comma)
  • --overwrite
    optional, boolean
    default: false
    If you want to overwrite the existing models while generating content type types/models
You will need a CONTENTFUL_MANAGEMENT_ACCESS_TOKEN to run the script locally. Don't run the api at the same time, wait until the script is done to restart the api yarn start api.

Code owners and maintainers