Skip to content

Conversation

@jrf0110
Copy link

@jrf0110 jrf0110 commented Apr 24, 2020

Summary

This makes it so migrations can export their migration functions using ES module syntax in TS-Node or after running through webpack.

import { MigrationFunction } from 'contentful-migration'

const migrate: MigrationFunction = (migration) => {
  const dog = migration.createContentType('dog');
  const name = dog.createField('name');
  name.type('Symbol').required(true);
}

export default migrate

Motivation and Context

I had been receiving this error:

TypeError: migrationCreator is not a function
    at node_modules/contentful-migration/src/lib/migration-steps/index.ts:335:12

Saw some others as well:

@dsbrianwebster
Copy link

@jrf0110 yes to this! Can we get a review from @Khaledgarbaya or someone at contentful?

@colinwirt
Copy link

Thanks @jrf0110 :)

@Khaledgarbaya @ruderngespra I'd love to see something like this supported to fit-in with fairly strict linting! Sometimes I find a project bans ignoring errors caused by this module syntax making it tough to work out how many levels of ignores are needed :/

It would be great to have this PR reviewed 🤓

@ItsDaveB
Copy link

This is still an issue, would be great to support this!

@angelodias-appno
Copy link

Any updates on this? I just ran into this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants