1.6.0 • Published 5 months ago

@etchteam/contentful v1.6.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

@etchteam/contentful

Helpers we use at Etch for working with Contentful.

Install

npm install @etchteam/contentful

CLI

Setup

The CLI depends on the following environment variables being present

Usage

Use --help to display help for a command.

Install migrations

npx etch-contentful-cli migration:install

Creates a directory at /integrations/contentful/migrations containing a 0-init migration.

When migrations are run, this will set the migration content type on your configured contentful space.

New migration

npx etch-contentful-cli migration:new "MIGRATION_NAME"

Creates a new migration file at /integrations/contentful/migrations with the "MIGRATION_NAME" provided.

Run migrations

npx etch-contentful-cli migration:run

Runs all migrations that haven't already been run.

The migration:run command accepts an optional spaces argument --spaces <spaceOne,spaceTwo>.

This will filter out any migrations that don't export a matching space name as part of its module.exports.spaces array:

module.exports.spaces = ['spaceOne', 'spaceTwo'];

If no spaces argument is provided, all migrations will run.

Generate types

npx etch-contentful-cli typegen

Generate GraphQL API compatible types based on your content in Contentful

The typegen command accepts an optional filename argument --filename <filename>. If omitted the filename will default to contentful.d.ts.

Validators

Some basic validators are available to use with content types, they can be imported:

import { validator } from '@etchteam/contentful';

Then used with their corresponding Contentful input type:

newEntity
  .createField('summary')
  .type('RichText')
  .name('Summary')
  .validations(validator.richText.boldAndItalicOnly);
1.6.0

5 months ago

1.5.1

6 months ago

1.5.0

6 months ago

1.4.0

7 months ago

1.3.1

7 months ago

1.3.0

7 months ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago