0.0.13 • Published 2 years ago

@heights/contentful-migrator v0.0.13

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Usage

You can get this tool up and running in a few easy steps:

1. Install the Contentful Migrator CLI.

npm install -D @heights/contentful-migrator

or

yarn add -D @heights/contentful-migrator

2. Create your migration file(s).

First, create a migration file according to https://github.com/contentful/contentful-migration#writing-migrations-in-typescript

You should end up with something like this:

// 01-dog-content-type.ts
import { MigrationFunction } from "contentful-migration"

// typecast to 'MigrationFunction' to ensure you get type hints in your editor
export = function (migration, { makeRequest, spaceId, accessToken }) {
  const dog = migration.createContentType("dog", {
    name: "Dog",
  })

  const name = dog.createField("name")
  name.name("Name").type("Symbol").required(true)
} as MigrationFunction

Important note Files need to be named sequentially, otherwise they will be ignored.

.
+-- src
    +-- migrations
        +-- 01-dog-content-type.ts
        +-- 02-cat-content-type.ts
        +-- 03-add-breed-field.ts

3. Running migrations

The tool expects a path to your migration directory to be provided:

contentful-migrator <path>

eg.

contentful-migrator src/migrations

For each successful migration, this will be logged in a migration-log.json file in the root directory.

0.0.12

2 years ago

0.0.13

2 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.1

3 years ago