Skip to content

Delete all entries and content types from a contentful space

License

Notifications You must be signed in to change notification settings

s5no5t/contentful-clean-space

Repository files navigation

contentful-clean-space

Delete all entries from a contentful space.

Contentful CLI doesn't have a command to delete all entries from a space without deleting the space itself. However, this can be very useful, e.g. for user contract testing.

Installation

Using npm:

npm install -g contentful-clean-space

Usage

contentful-clean-space
Options:
      --help           Show help                                       [boolean]
      --space-id       Contentful space id                   [string] [required]
      --env            Contentful environment                [string] [required]
      --accesstoken    Contentful access token               [string] [required]
      --batch-size     Number of parallel contentful requests
                                                           [number] [default: 5]
      --content-types  Delete content types as well   [boolean] [default: false]
      --assets         Delete assets as well          [boolean] [default: false]
  -y, --yes            Auto-confirm delete prompt     [boolean] [default: false]
  -v, --verbose                                       [boolean] [default: false]

All parameters can be provided from environment variables, too. To do that, just set an environment variable using UPPER_CASE casing.

Example Usage

To delete all entries, content types, as well as assets in the "master" environment, and without the safety prompt, use contentful-clean-space --space-id [space id] --accesstoken [personal access token] --content-types=true --assets=true --env master --yes=true