DieProduktMacher / contentful-tooling

Collection of useful packages for easier and standardised integration of Contentful based web applications

Home Page:https://www.dieproduktmacher.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Logo DPM

DPM Contentful Tooling

About The Project

This repository is used as a collection for useful contentful tools. The first tool added, is a migration tool to support schema creation in CI/CD.

Getting Started

Prerequisites

  • Make sure Node.js (>= v18) and NPM NPM is installed
  • Set up / Access to a Contentful space with read / write permissions

Setup

  1. Clone this repository

  2. Run npm install on root level (it's a monorepo using npm workspaces)

  3. Create a new .env file based on the .env.sample file from the root folder of this repo and add your contentful credentials:

      CONTENTFUL_SPACE = **SPACE_ID**
      CONTENTFUL_MANAGEMENT_TOKEN = **PERSONAL_ACCESS_TOKEN**
    

Troubleshooting

Usage

Migration Tool (Contentful Schema CI/CD)

Run the migration tool via npm run migration-tool <args...> with the following argument options:

deployProd

deploy new version of production environment by running all new migrations

deployStage

run new migrations on the current staging environment

ciTestMigrations

test new migrations by running them against a new temporary ci environment

resetStage

delete the contents of the stage environment and reset it to the state of the current master environment

createMigration <name>

create a new migration file

diffContentTypes <environment1> <environment2>

compares the content types of environment1 with environment2 based on a JSON file comparison

generateTypeDefinitions <environment>

generates typescript types from all content types in the given environment. Types based on contentful.js library types.

listEnvironments

list all available environments
How to test if everything is set up correctly?

To test the the migration tool is setup correctly and is connected to the contentful space, you can run npm run migration-tool listEnvironments and you should see a table with all created environments on your contentful space.

Roadmap

Order of the following list does not necessarily represent prioritization

Migrations

  • Publish as installable / executable NPM package
  • Make it backwards compatibility with Contentful CLI < 10
  • Add example migrations based on commonly used content types, e.g. Page Metadata, CTA, Accordeon, Tabs, MediaWrapper
  • Create a documentation page
  • Generalise deploy{Env} / reset{Env} scripts

Other packages

  • Add CSV (Excel, Numbers) to JSON Converter for content imports

Contact

DieProduktmacher GmbH Hofmannstraße 7a 81379 Munich

E-Mail: code[at]produktmacher.com Website: www.dieproduktmacher.com

About

Collection of useful packages for easier and standardised integration of Contentful based web applications

https://www.dieproduktmacher.com/

License:MIT License


Languages

Language:TypeScript 99.6%Language:JavaScript 0.4%