This script generates a comprehensive report of all content types in a Contentful space, including detailed field information and validation rules.
- Clone this repository.
- Install dependencies:
npm install
- Create a
.envfile in the project root (see.env.samplefor required variables):CONTENTFUL_SPACE_ID=your_space_id_here CONTENTFUL_MANAGEMENT_TOKEN=your_management_token_here CONTENTFUL_ENVIRONMENT_ID=master OUTPUT_DIR=reports
Run the script with Node.js:
node contentful-content-types-script.js--output <file>: Specify output filename (optional)--help, -h: Show help message
node contentful-content-types-script.js --output=all-types.mdThe report will be saved in the directory specified by OUTPUT_DIR (default: reports).
To create a PDF from the Markdown report, use Pandoc:
pandoc reports/all-types.md -o reports/all-types.pdf --pdf-engine=xelatex -V geometry:margin=1in -V mainfont="Arial"This will generate all-types.pdf in the reports directory.
Pandoc is required to generate PDF reports. See the official installation guide for Mac, Windows, and Linux:
CONTENTFUL_SPACE_ID: Your Contentful space ID (required)CONTENTFUL_MANAGEMENT_TOKEN: Your Contentful management API token (required)CONTENTFUL_ENVIRONMENT_ID: Environment ID (default:master)OUTPUT_DIR: Output directory (default:reports)
ISC