{"id":14990986,"url":"https://github.com/chigokawa/contentful-developer-examples","last_synced_at":"2025-04-12T03:25:08.058Z","repository":{"id":220132397,"uuid":"750835516","full_name":"chigoKawa/contentful-developer-examples","owner":"chigoKawa","description":"This repository serves as a practical guide on utilizing the Contentful CLI Tool for various common scenarios.","archived":false,"fork":false,"pushed_at":"2025-01-09T08:36:26.000Z","size":301,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T23:01:54.509Z","etag":null,"topics":["contentful","contentful-cli"],"latest_commit_sha":null,"homepage":"https://experiences-demo.colorfuldemo.com","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/chigoKawa.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-31T12:19:04.000Z","updated_at":"2025-03-20T09:29:41.000Z","dependencies_parsed_at":"2024-09-20T05:00:24.787Z","dependency_job_id":null,"html_url":"https://github.com/chigoKawa/contentful-developer-examples","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"8caab9bc176a55192ef255c1ae47dd1dee9d2564"},"previous_names":["chigokawa/contentful-developer-examples"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chigoKawa%2Fcontentful-developer-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chigoKawa%2Fcontentful-developer-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chigoKawa%2Fcontentful-developer-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chigoKawa%2Fcontentful-developer-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chigoKawa","download_url":"https://codeload.github.com/chigoKawa/contentful-developer-examples/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248511141,"owners_count":21116357,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["contentful","contentful-cli"],"created_at":"2024-09-24T14:21:15.430Z","updated_at":"2025-04-12T03:25:08.030Z","avatar_url":"https://github.com/chigoKawa.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n## Getting Started\nThis repository serves as a practical guide on utilizing the [Contentful CLI Tool] for various common scenarios. Makes more sense if you attend the [Contentful Learning Center] training class. \n\n##### Folder structure:\n\n- migrations \n    - Contains all the migration scripts used in the commands.\n- exports \n    - Holds exported files from migrations.\n- util \n    - Contains an example utility script that generates an `internal name` field.\n- mini-website \n    - A small Next.js example project that uses Contentful.\n    - Has it's own ReadMe file\n\n## Commands\n\n### To export all content and content types from a space\n```bash\ncontentful space export --space-id \"[your-space-id]\" --environment-id \"[your-space-environment]\" --content-file exports/all.json\n```\n\n\n### Export only the content model\n\n```bash\ncontentful space export --space-id \"[your-space-id]\" --environment-id \"[your-space-environment]\" --content-file exports/only-content-model.json --skip-content --skip-roles --skip-webhooks\n```\n# Export only the CONTENT\n```bash\ncontentful space export --space-id \"[your-space-id]\" --environment-id \"[your-space-environment]\" --content-file exports/just-content.json --content-only\n```\n\n# Import to another space\n```bash\ncontentful space import --space-id \"[your-other-space-id]\" --environment-id \"[your-space-environment]\" --content-file exports/all.json\n```\n# Export using filters\n\n```bash\ncontentful space export --space-id \"[your-space-id]\" --environment-id \"[your-space-environment]\" --content-file exports/filtered-content.json --query-entries 'sys.contentType.sys.id[in]=landingPage'\n```\n\n\n# Simulate an error \n```bash\ncontentful space export --space-id \"[your-space-id]123\" --environment-id \"[your-space-environment]\" --content-file exports/simulate-error.json --query-entries 'sys.contentType.sys.id[in]=landingPage'\n```\n\n# Run migration script to create `blogPost` content type\n```bash\ncontentful space migration --space-id \"[your-space-id]\" --environment-id \"[your-space-environment]\" migrations/1.create-blog-post.js\n```\n\n# Migrate content from another CMS (faked with jsonplaceholder)\n```bash\ncontentful space migration --space-id \"[your-space-id]\" --environment-id \"[your-space-environment]\" migrations/2.migrate-posts.js -y\n\n```\n\n# Transform the author name field\n\n```bash\ncontentful space migration --space-id \"[your-space-id]\" --environment-id \"[your-space-environment]\" migrations/3.split_author_name_field_into_two_fields.js\n\n```\n\n\n# Derive content entries for new `author` content type\n```bash\ncontentful space migration --space-id \"[your-space-id]\" --environment-id \"[your-space-environment]\" migrations/4.create-author-type.js\n\n```\n\n\n# Clean up\n\n```bash\ncontentful space migration --space-id \"[your-space-id]\" --environment-id \"[your-space-environment]\" migrations/99.cleanup.js\n\n```\n\n\n\n\n\n\n\n\n\n## License\n\nMIT\n\nReach out if you have any questions [Chigoriddim]\n\n[//]: # (These are reference links used in the body of this note and get stripped out when the markdown processor does its job. There is no need to format nicely because it shouldn't be seen. Thanks SO - http://stackoverflow.com/questions/4823468/store-comments-in-markdown-syntax)\n\n   [Chigoriddim]: \u003chttps://chigoriddim.com\u003e\n   [Contentful CLI Tool]: \u003chttps://github.com/contentful/contentful-cli\u003e\n   [Contentful Learning Center]: \u003chttps://training.contentful.com\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchigokawa%2Fcontentful-developer-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchigokawa%2Fcontentful-developer-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchigokawa%2Fcontentful-developer-examples/lists"}