Contentful CLI Migrations is an open-source CLI tool and library for automating Contentful space migrations. Version 1.0.0, released in 2025, provides a command-line interface to define, version, and apply migration scripts using a counter entry in Contentful to track progress. It relies on contentful-management and contentful-migration as peer dependencies, and requires Node.js >=22. Unlike the official Contentful Migration CLI, this tool enforces a specific file naming convention (e.g., 0001-migration.cjs) and integrates a counter entry pattern for tracking migration state. It is designed for CI/CD workflows and supports JavaScript/CommonJS migration scripts.
npm install contentful-cli-migrationsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to import and run the migration function with environment variables for authentication.
Upgrade Node.js to >=22.
Ensure migration files follow the convention: <digits>-<name>.cjs or .js.
Use 'import' syntax. If using CommonJS, you can use dynamic import() in an async function.
Create a Contentful entry with a field (e.g., integer) to track the last applied migration number.
Run 'npm install contentful-cli-migrations --save' (or yarn/bun equivalent).
Use 'import { runMigrations } from 'contentful-cli-migrations'' instead of default import.Ensure all migration files have unique numeric prefixes with consistent leading zeros.