
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@greenberry/datocms-migration-utils
Advanced tools
A collection of utils to help with the development of DatoCMS migration files
@greenberry/datocms-migration-utilsA collection of utils to help with the development of DatoCMS migration files.
yarn add @greenberry/datocms-migration-utils -D
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);
createBoolean| Key | Type | Required |
|---|---|---|
label | String | β |
apiKey | String | β |
hint | String | β |
localized | Boolean | β |
required | Boolean | β |
createColor| Key | Type | Required |
|---|---|---|
label | String | β |
apiKey | String | β |
hint | String | β |
localized | Boolean | β |
required | Boolean | β |
presetColors | [#000] | β |
enableAlpha | Boolean | β |
createCTA| Key | Type | Required |
|---|---|---|
label | String | β |
apiKey | String | β |
hint | String | β |
localized | Boolean | β |
required | Boolean | β |
createDate| Key | Type | Required |
|---|---|---|
label | String | β |
apiKey | String | β |
hint | String | β |
localized | Boolean | β |
required | Boolean | β |
dateRange | {min: 'ISO-8601', max: 'ISO-8601'} | β |
createDateTime| Key | Type | Required |
|---|---|---|
label | String | β |
apiKey | String | β |
hint | String | β |
localized | Boolean | β |
required | Boolean | β |
dateRange | {min: 'ISO-8601', max: 'ISO-8601'} | β |
createEnum| Key | Type | Required |
|---|---|---|
label | String | β |
apiKey | String | β |
options | [String] | β |
defaultValue | String | β |
hint | String | β |
localized | Boolean | β |
required | Boolean | β |
createImage| Key | Type | Required |
|---|---|---|
label | String | β |
apiKey | String | β |
hint | String | β |
localized | Boolean | β |
required | Boolean | β |
createLink| Key | Type | Required |
|---|---|---|
label | String | β |
apiKey | String | β |
items | [ItemType ID] | β |
hint | String | β |
localized | Boolean | β |
required | Boolean | β |
unique | Boolean | β |
createLinks| Key | Type | Required |
|---|---|---|
label | String | β |
apiKey | String | β |
items | [ItemType ID] | β |
size | { min: Number, max: Number } | β |
hint | String | β |
localized | Boolean | β |
required | Boolean | β |
createModularContent| Key | Type | Required |
|---|---|---|
label | String | β |
apiKey | String | β |
blockIds | [ItemType ID] | β |
hint | String | β |
localized | Boolean | β |
required | Boolean | β |
createNumber| Key | Type | Required |
|---|---|---|
label | String | β |
apiKey | String | β |
hint | String | β |
localized | Boolean | β |
required | Boolean | β |
createSEO| Key | Type | Required |
|---|---|---|
label | String | β |
apiKey | String | β |
hint | String | β |
localized | Boolean | β |
createSingleLine| Key | Type | Required |
|---|---|---|
label | String | β |
apiKey | String | β |
hint | String | β |
localized | Boolean | β |
required | Boolean | β |
heading | Boolean | β |
createSlug| Key | Type | Required |
|---|---|---|
label | String | β |
apiKey | String | β |
titleField | Field | β |
prefix | String | β |
hint | String | β |
localized | Boolean | β |
required | Boolean | β |
createTextArea| Key | Type | Required |
|---|---|---|
label | String | β |
apiKey | String | β |
hint | String | β |
localized | Boolean | β |
required | Boolean | β |
createWysiwyg| Key | Type | Required |
|---|---|---|
label | String | β |
apiKey | String | β |
hint | String | β |
localized | Boolean | β |
required | Boolean | β |
toolbar | Array | β |
updateModularContent| Key | Type | Required |
|---|---|---|
label | String | β |
apiKey | String | β |
localized | Boolean | β |
hint | String | β |
blockIds | [ItemType ID] | β |
uploadFile| Key | Type | Required |
|---|---|---|
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
A collection of utils to help with the development of DatoCMS migration files
We found that @greenberry/datocms-migration-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.Β It has 7 open source maintainers collaborating on the project.
Did you know?

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.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.