πŸš€ DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more β†’
Socket
Book a DemoInstallSign in
Socket

@greenberry/datocms-migration-utils

Package Overview
Dependencies
Maintainers
7
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@greenberry/datocms-migration-utils

A collection of utils to help with the development of DatoCMS migration files

latest
Source
npmnpm
Version
1.0.17
Version published
Maintainers
7
Created
Source

@greenberry/datocms-migration-utils

A collection of utils to help with the development of DatoCMS migration files.

Installation

yarn add @greenberry/datocms-migration-utils -D

API

Each field creator method need 3 arguments a working DatoCMS SiteClient, field options and the modelId you want to attach the field to.

await createFieldMethod(client, options, modelId);

Field Options

createBoolean

KeyTypeRequired
labelStringβœ…
apiKeyStringβœ…
hintString❌
localizedBoolean❌
requiredBoolean❌

createColor

KeyTypeRequired
labelStringβœ…
apiKeyStringβœ…
hintString❌
localizedBoolean❌
requiredBoolean❌
presetColors[#000]❌
enableAlphaBoolean❌

createCTA

KeyTypeRequired
labelStringβœ…
apiKeyStringβœ…
hintString❌
localizedBoolean❌
requiredBoolean❌

createDate

KeyTypeRequired
labelStringβœ…
apiKeyStringβœ…
hintString❌
localizedBoolean❌
requiredBoolean❌
dateRange{min: 'ISO-8601', max: 'ISO-8601'}❌

createDateTime

KeyTypeRequired
labelStringβœ…
apiKeyStringβœ…
hintString❌
localizedBoolean❌
requiredBoolean❌
dateRange{min: 'ISO-8601', max: 'ISO-8601'}❌

createEnum

KeyTypeRequired
labelStringβœ…
apiKeyStringβœ…
options[String]βœ…
defaultValueString❌
hintString❌
localizedBoolean❌
requiredBoolean❌

createImage

KeyTypeRequired
labelStringβœ…
apiKeyStringβœ…
hintString❌
localizedBoolean❌
requiredBoolean❌
KeyTypeRequired
labelStringβœ…
apiKeyStringβœ…
items[ItemType ID]βœ…
hintString❌
localizedBoolean❌
requiredBoolean❌
uniqueBoolean❌
KeyTypeRequired
labelStringβœ…
apiKeyStringβœ…
items[ItemType ID]βœ…
size{ min: Number, max: Number }❌
hintString❌
localizedBoolean❌
requiredBoolean❌

createModularContent

KeyTypeRequired
labelStringβœ…
apiKeyStringβœ…
blockIds[ItemType ID]βœ…
hintString❌
localizedBoolean❌
requiredBoolean❌

createNumber

KeyTypeRequired
labelStringβœ…
apiKeyStringβœ…
hintString❌
localizedBoolean❌
requiredBoolean❌

createSEO

KeyTypeRequired
labelStringβœ…
apiKeyStringβœ…
hintString❌
localizedBoolean❌

createSingleLine

KeyTypeRequired
labelStringβœ…
apiKeyStringβœ…
hintString❌
localizedBoolean❌
requiredBoolean❌
headingBoolean❌

createSlug

KeyTypeRequired
labelStringβœ…
apiKeyStringβœ…
titleFieldFieldβœ…
prefixString❌
hintString❌
localizedBoolean❌
requiredBoolean❌

createTextArea

KeyTypeRequired
labelStringβœ…
apiKeyStringβœ…
hintString❌
localizedBoolean❌
requiredBoolean❌

createWysiwyg

KeyTypeRequired
labelStringβœ…
apiKeyStringβœ…
hintString❌
localizedBoolean❌
requiredBoolean❌
toolbarArray❌

updateModularContent

KeyTypeRequired
labelStringβœ…
apiKeyStringβœ…
localizedBoolean❌
hintString❌
blockIds[ItemType ID]βœ…

uploadFile

KeyTypeRequired

Color formatting

DatoCMS only accepts a specific format when filling colors. That is why we added a util to format hex values in a shape acceptable by DatoCMS.

const color = formatColor('#000000');
console.log(color);
// {
//   red: 0,
//   blue: 0,
//   green: 0,
//   alpha: 255,
// }

formatColor also accepts a second argument to specify the alpha of the color, this works in the same way as CSS opacity.

const color = formatColor('#000000', 0.8);
console.log(color);
// {
//   red: 0,
//   blue: 0,
//   green: 0,
//   alpha: 204,
// }

FAQs

Package last updated on 10 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts