{"id":47303,"library":"contentful-migrate-bse","title":"Contentful Migrate","description":"A command-line tool and library for managing Contentful content model migrations using incremental scripted changes (CMS as Code). Current stable version 0.1.0 (Node >=8). Based on the Contentful Migration tool syntax, it tracks migration state per content type in a dedicated 'Migration' content type. Differs from contentful-migration by providing state management, bootstrapping from existing spaces, and per-content-type folder organization.","status":"active","version":"0.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/bemaxima/contentful-migrate","tags":["javascript","migrate","migrations","contentful","cms-as-code"],"install":[{"cmd":"npm install contentful-migrate-bse","lang":"bash","label":"npm"},{"cmd":"yarn add contentful-migrate-bse","lang":"bash","label":"yarn"},{"cmd":"pnpm add contentful-migrate-bse","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"core dependency for executing migration scripts","package":"contentful-migration","optional":false}],"imports":[{"note":"CommonJS module format with exports.up / exports.down required; ES module syntax not supported.","wrong":"export function up(migration) { ... }","symbol":"default","correct":"module.exports.up = migration => { ... }"},{"note":"Recommended to use npx to avoid global install; requires CONTENTFUL_MANAGEMENT_ACCESS_TOKEN env var.","wrong":"ctf-migrate init (without npx or global install)","symbol":"ctf-migrate (CLI)","correct":"npx ctf-migrate init"},{"note":"Scripts must export description, up, and down as CommonJS module properties.","wrong":"export const description = \"Create Post\"; export function up(migration) { ... }","symbol":"migration scripts","correct":"module.exports.description = \"Create Post\"; module.exports.up = migration => { ... }; module.exports.down = migration => { ... };"}],"quickstart":{"code":"const { execSync } = require('child_process');\n\n// Set environment variables (or use --access-token etc.)\nprocess.env.CONTENTFUL_MANAGEMENT_ACCESS_TOKEN = process.env.CTF_CMA_TOKEN ?? '';\nprocess.env.CONTENTFUL_SPACE_ID = process.env.CTF_SPACE_ID ?? '';\nprocess.env.CONTENTFUL_ENV_ID = process.env.CTF_ENV_ID ?? 'master';\n\n// 1. Initialize the space (creates Migration content type)\ntry {\n  execSync('npx ctf-migrate init', { stdio: 'inherit' });\n} catch (e) {\n  console.error('Init failed. Ensure credentials are set.');\n  process.exit(1);\n}\n\n// 2. Bootstrap existing content types into migration scripts\ntry {\n  execSync('npx ctf-migrate bootstrap --content-types post,banner', { stdio: 'inherit' });\n} catch (e) {\n  console.error('Bootstrap failed.');\n  process.exit(1);\n}\n\nconsole.log('Migration scripts generated in ./migrations/');","lang":"javascript","description":"Shows initialization and bootstrapping of Contentful space using ctf-migrate CLI."},"warnings":[{"fix":"If already initialized, you may skip init or delete the Migration content type via the Contentful web app before re-running.","message":"The `init` command will fail if the 'Migration' content type already exists.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use with caution; version-control your migrations directory to recover history if needed.","message":"`bootstrap` deletes existing migration scripts. It consolidates all current content type state into a single script, losing history.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Use nvm or similar to switch to a current Node version. Note that contentful-migrate may not be actively maintained for newer Node versions.","message":"The package requires Node >=8, which is end-of-life. Consider upgrading to Node 18+.","severity":"deprecated","affected_versions":">=0.1.0"},{"fix":"Verify credentials and space/environment IDs. Use --access-token, --space-id, --environment-id options as fallback.","message":"Environment variables CONTENTFUL_MANAGEMENT_ACCESS_TOKEN, CONTENTFUL_SPACE_ID, and CONTENTFUL_ENV_ID must be set correctly; otherwise CLI commands fail with cryptic errors.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Ensure scripts are placed in the correct subfolder matching the content type ID (e.g., `migrations/post/1513695986378-create-post.js`).","message":"Migration scripts must follow a specific folder structure: `migrations/<content-type-id>/timestamp-description.js`. Incorrect structure causes `bootstrap` to fail.","severity":"breaking","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'0.1.0':26 '8':28 'base':29 'bootstrap':58 'chang':19 'cms':20,74 'cms-as-cod':73 'code':22,76 'command':5 'command-lin':4 'content':1,12,13,32,41,47,52,65,72 'contentful-migr':51 'current':23 'dedic':45 'differ':49 'exist':60 'folder':67 'increment':17 'javascript':69 'librari':9 'line':6 'manag':11,57 'migrat':2,15,33,38,46,53,70,71 'model':14 'node':27 'organ':68 'per':40,64 'per-content-typ':63 'provid':55 'script':18 'space':61 'stabl':24 'state':39,56 'syntax':35 'tool':7,34 'track':37 'type':42,48,66 'use':16 'version':25","created_at":"2026-06-07T16:50:49.579452+00:00","updated_at":"2026-06-07T16:50:49.579452+00:00","problems":[{"fix":"If you want to reinitialize, delete the 'Migration' content type via the Contentful web app or skip init if already present.","cause":"`ctf-migrate init` run on a space that already has a 'Migration' content type.","error":"Content type with id \"migration\" already exists."},{"fix":"Install the peer dependency: `npm install contentful-migration`","cause":"Missing peer dependency `contentful-migration` when using the package programmatically.","error":"Error: Cannot find module 'contentful-migration'"},{"fix":"Run the command in a project directory where you have write access, or use `sudo` (not recommended) on Unix systems.","cause":"Running `ctf-migrate` in a directory without write permissions.","error":"Error: EACCES: permission denied, mkdir 'migrations'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/bemaxima/contentful-migrate#readme","github":"https://github.com/bemaxima/contentful-migrate","docs":null,"changelog":null,"pypi":null,"npm":"contentful-migrate-bse","openapi_spec":null,"status_page":null,"smithery":null,"categories":["cms","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}