0.1.13 • Published 4 years ago

@mmintel/datocms-tools v0.1.13

Weekly downloads
32
License
-
Repository
github
Last release
4 years ago

datocms-tools Build Status Greenkeeper badge David

Provides tools to import, export or reset DatoCMS projects. Will also make sure to update existing models. datocms-tools Read more at this Medium article

Important Note

This script is not battle proven yet! You may risk to loose data so use with care!!

Installation

npm i -S @mmintel/datocms-tools

or globally

npm i -G @mmintel/datocms-tools

Usage

In Javascript

Either import the whole object:

import DatoCMSTools from '@mmintel/datocms-tools';

or single methods like so:

import { importModels, exportModels, importMenu, exportMenu } from '@mmintel/datocms-tools';

To transfer data from one project to another use it like this:

import { importModels, exportModels, importMenu, exportMenu } from '@mmintel/datocms-tools';

export default async function() {
  const apiKey = 'xxx';
  const models = await exportModels({ apiKey });
  const menuItems = await exportMenu({ apiKey });

  await importModels({
    apiKey,
    models,
  })

  await importMenu({
    apiKey,
    models,
    menuItems,
  })
}

Methods

MethodArgumentsDescription
importModels{ apiKey, data }Imports given data to the project available with the apiKey. Data must contain itemTypes and fields.
exportModels{ apiKey }Exports itemTypes and fields from the project available with the given apiKey
extractModels{ apiKeys, models }Extracts itemTypes and fields from given models. Expects apiKeys to search for, can be String or Array.
importMenu{ apiKey, menuItems, models }Imports menu items to the project with given apiKey. Will also delete all menuItems that do not exist in the given data.
exportMenu{ apiKey }Will export menuItems from the project with given apiKey
clearRelations{ models }Removes related fields, e.g. from modular content fields
removeModels{ apiKeys, models }Removes one or more models including all their relations.
exportContent{ apiKey }Exports all items of your project.
importContent{ apiKey, content, models? }Imports items into a project. Models are required if you want to move content from one project to another.

Via CLI

DatoCMS tools provides CLI commands matching the method names.

  • import-models
  • export-models
  • extract-models
  • import-menu
  • export-menu
  • clear-relations
  • remove-models
  • export-content
  • import-content
0.1.13

4 years ago

0.1.12

4 years ago

0.1.10

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.16

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago