{"id":20639710,"url":"https://github.com/xolvio/contentful-pipelines","last_synced_at":"2026-04-21T01:31:49.116Z","repository":{"id":42780981,"uuid":"273033028","full_name":"xolvio/contentful-pipelines","owner":"xolvio","description":"Provides connivence methods for running Contentful migrations.","archived":false,"fork":false,"pushed_at":"2023-01-07T04:47:15.000Z","size":787,"stargazers_count":2,"open_issues_count":12,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-15T00:55:52.462Z","etag":null,"topics":["cicd-pipeline","contentful"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xolvio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-17T17:03:22.000Z","updated_at":"2023-12-03T00:28:51.000Z","dependencies_parsed_at":"2023-02-06T12:16:49.397Z","dependency_job_id":null,"html_url":"https://github.com/xolvio/contentful-pipelines","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xolvio/contentful-pipelines","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xolvio%2Fcontentful-pipelines","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xolvio%2Fcontentful-pipelines/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xolvio%2Fcontentful-pipelines/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xolvio%2Fcontentful-pipelines/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xolvio","download_url":"https://codeload.github.com/xolvio/contentful-pipelines/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xolvio%2Fcontentful-pipelines/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32072953,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T21:26:33.338Z","status":"ssl_error","status_checked_at":"2026-04-20T21:26:22.081Z","response_time":94,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cicd-pipeline","contentful"],"created_at":"2024-11-16T15:25:53.537Z","updated_at":"2026-04-21T01:31:49.096Z","avatar_url":"https://github.com/xolvio.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Contentful Pipelines\n\n## How to Install\n\n```\nnpm -D install @xolvio/contentful-pipelines\n```\n\n## API\n\nThe `contentful pipelines` package exposes two commands which can be run either as a `package.json` script or executed in the code (runtime).\n\n#### Migrations\nGiven directory structure:\n\n```\nyour-project\n├── README.md\n├── src\n│   └── components\n│       ├── Title\n│       │    └── migrations\n│       │         └── title\n│       │               └── 1513695986378-create-title-type.js\n│       └── Sections\n│            └── migrations\n│                 └── sections\n│                       └── 1513695986378-create-title-type.js\n├── package.json\n\n```\n\nRunning as `package.json` command:\n\n```shell script\n\"migrations\": \"CONTENTFUL_MANAGEMENT_API=\u003ccontentful-management-api-key\u003e CONTENTFUL_SPACE_ID=\u003ccontentful-space-id\u003e CONTENTFUL_ENVIRONMENT_ID=\u003ccontentful-environment-id\u003e xolvio-contentful-migrations src/components/Title src/components/Sections\"\n```\n\nRunning from code:\n\n```typescript\nasync function runMigrations(migrationPaths, options);\n```\n\n| Parameter        | Type                                                                                                         | Default                                                                                                                                                                                     | Description                                                                                                                 |\n| :--------------- | :----------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------------- |\n| `migrationPaths` | `string[]`                                                                                                   | []                                                                                                                                                                                          | **Required**. List of paths to the components containing migration scripts. Paths should be relative to the project's root. |\n| `options`        | {\u003cbr\u003etargetEnvironment: `string`,\u003cbr\u003e\u003cbr\u003espaceId: `string`,\u003cbr\u003e\u003cbr\u003econtentfulManagementApiKey: `string`\u003cbr\u003e} | `targetEnvironment = process.env.CONTENTFUL_ENVIRONMENT_ID` \u003cbr\u003e\u003cbr\u003e`spaceId = process.env.CONTENTFUL_SPACE_ID`\u003cbr\u003e\u003cbr\u003e`contentfulManagementApiKey = process.env.CONTENTFUL_MANAGEMENT_API` | Optional. Overwrites the `process.env` variables                                                                            |\n\n```typescript\nconst { runMigrations } = require(\"@xolvio/contentful-pipelines\");\n\nawait runMigrations([\"src/components/Title\", \"src/components/Sections\"]);\n```\n\n#### Creating the contentful environment\nRunning as `package.json` command:\n\n```shell script\n\"createQaEnvironmentFromProd\": \"CONTENTFUL_MANAGEMENT_API=\u003ccontentful-management-api-key\u003e CONTENTFUL_SPACE_ID=\u003ccontentful-space-id\u003e CONTENTFUL_SOURCE_ENVIRONMENT=\u003ccontentful-prod-environment-id\u003e CONTENTFUL_ENVIRONMENT_ID=\u003ccontentful-environment-id\u003e xolvio-contentful-create-environment\"\n```\n\nRunning from code:\n\n```typescript\nasync function createEnvironmentFromSource(options);\n```\n\n| Parameter | Type                                                                                                                                             | Default                                                                                                                                                                                                                                                          | Description                                      |\n| :-------- | :----------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------- |\n| `options` | {\u003cbr\u003esourceEnvironment: `string`,\u003cbr\u003e\u003cbr\u003etargetEnvironment: `string`,\u003cbr\u003e\u003cbr\u003espaceId: `string`,\u003cbr\u003e\u003cbr\u003econtentfulManagementApiKey: `string`\u003cbr\u003e} | `sourceEnvironment=process.env.CONTENTFUL_SOURCE_ENVIRONMENT`\u003cbr\u003e\u003cbr\u003e`targetEnvironment = process.env.CONTENTFUL_ENVIRONMENT_ID` \u003cbr\u003e\u003cbr\u003e`spaceId = process.env.CONTENTFUL_SPACE_ID`\u003cbr\u003e\u003cbr\u003e`contentfulManagementApiKey = process.env.CONTENTFUL_MANAGEMENT_API` | Optional. Overwrites the `process.env` variables |\n\nExample:\n\n```typescript\nawait createEnvironmentFromSource();\n```\n\n## Writing migration scripts\nFor executing the migrations we're using [Contentful Migrate Tool](https://github.com/deluan/contentful-migrate) so the migrations are written using their syntax. Using their CLI tool you can quickly create the migration scripts based on the existing Contentful Content Types.\n\n#### Useful scripts\nFetch existing entry data (used for initial data migration scripts)\n\n```typescript\nmodule.exports.up = async (migration, { makeRequest }) =\u003e {\n  const existing = await makeRequest({\n    method: \"GET\",\n    url: `/entries/ENTRY_ID_TO_QUERY`,\n  }).catch(console.log);\n\n  console.log(\"existing: \", JSON.stringify(existing.fields));\n};\n```\n\nCreate contentful entry from within the contentful migration script:\n\n```typescript\nmodule.exports.up = async (migration, { makeRequest }) =\u003e {\n  await makeRequest({\n    method: \"PUT\",\n    url: `/entries/NEW_ENTRY_ID`,\n    data: EXISTING_FIELDS_FROM_SNIPPET_ABOVE,\n    headers: {\n      \"X-Contentful-Content-Type\": \"CONTENT_TYPE_ID\",\n    },\n  });\n};\n```\n## TODO\n- CLI for running migrations for all of the components listed in the package.json\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxolvio%2Fcontentful-pipelines","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxolvio%2Fcontentful-pipelines","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxolvio%2Fcontentful-pipelines/lists"}