GithubHelp home page GithubHelp logo

contentstack-import's Introduction

Contentstack import utility

Contentstack is a headless CMS with an API-first approach that puts content at the centre. It is designed to simplify the process of publication by separating code from content.

This tool helps you to import content which is exported using contentstack-export utility into another stack.

Installation

Download this project and install all the modules using following command.

$ npm install

Configuration

Update configuration details at config/index.js

{
 master_locale: {
  name: '', // Stack's master locale. ex: 'English - United States'
  code: ''  // Stack master locale's code. ex: 'en-us'
 },
 email: '', // Your registered email id
 password: '', // Account password
 target_stack: '', // Stack api_key. This is the stack, where the data will be imported
 management_token: '' //Stack management_token
 data: '' // The data that's to be exported. This is generally the one exported via the contentstack-export utility. ex: '../contentstack-export/contents'. Kindly provide the relative path to the directory

For switching to EU region update the hosts at config/default.js

{
  host:'https://eu-api.contentstack.com/v3',
 ...
}

Usage

Once all things are configured, you can run following commands

  1. Import all modules [ assets, locales, environments, extensions, webhooks, global_fields, content_types, entries, labels ]
$ npm run import
  1. Import a specific module
$ npm run import-locales
$ npm run import-env
$ npm run import-extensions
$ npm run import-webhooks
$ npm run import-globalfields
$ npm run import-assets
$ npm run import-contenttypes
$ npm run import-entries
$ npm run import-labels

Note: Before importing entries you must have to import locales, assets and content types.

Note: If you keep the value of preserveStackVersion to true, then you will have to provide the email and password mandatorily in the config file, the management token will not work in that case

Known Limitations and Issues

  • It will migrate only latest published version of entry.
  • Does not support the following
    • Roles
    • Users
    • Releases
    • Workflow
  • If 2 different versions of the same asset have the same file name, only the 1st version will be imported

License

This project is licensed under MIT license

contentstack-import's People

Contributors

abhinav-from-contentstack avatar aravindbuilt avatar contentstack-admin avatar iyerrama25 avatar iyerrama29 avatar nandeesh-gajula avatar ninadhatkar avatar rohitmishra209 avatar shafeeqd959 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

contentstack-import's Issues

Unable to publish when environments are not in the scope of export-import

Hey guys,
My goal was to migrate one stack to the other. I've excluded environments and webhooks from export/import (as these differ from stack to stack in my case).

When I launched the import script everything has been migrated but none of the entries were published (./config/defaults.js - flag "entriesPublish" set to true).

The reason for that seems to be lib/import/entries.js:789:33 as I'm getting dozens of following errors:

Unhandled rejection TypeError: Cannot read property 'hasOwnProperty' of undefined at /Users/jamarszal/src/contentstack/contentstack-import/lib/import/entries.js:789:33 at arrayEach (/Users/jamarszal/src/contentstack/contentstack-import/node_modules/lodash/lodash.js:516:11) at Function.forEach (/Users/jamarszal/src/contentstack/contentstack-import/node_modules/lodash/lodash.js:9342:14) at /Users/jamarszal/src/contentstack/contentstack-import/lib/import/entries.js:788:11 at Promise._execute (/Users/jamarszal/src/contentstack/contentstack-import/node_modules/bluebird/js/release/debuggability.js:303:9) at Promise._resolveFromExecutor (/Users/jamarszal/src/contentstack/contentstack-import/node_modules/bluebird/js/release/promise.js:483:18) at new Promise (/Users/jamarszal/src/contentstack/contentstack-import/node_modules/bluebird/js/release/promise.js:79:10) at importEntries.publish (/Users/jamarszal/src/contentstack/contentstack-import/lib/import/entries.js:787:16) at /Users/jamarszal/src/contentstack/contentstack-import/lib/import/entries.js:461:42 at tryCatcher (/Users/jamarszal/src/contentstack/contentstack-import/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/Users/jamarszal/src/contentstack/contentstack-import/node_modules/bluebird/js/release/promise.js:512:31) at Promise._settlePromise (/Users/jamarszal/src/contentstack/contentstack-import/node_modules/bluebird/js/release/promise.js:569:18) at Promise._settlePromise0 (/Users/jamarszal/src/contentstack/contentstack-import/node_modules/bluebird/js/release/promise.js:614:10) at Promise._settlePromises (/Users/jamarszal/src/contentstack/contentstack-import/node_modules/bluebird/js/release/promise.js:693:18) at Async._drainQueue (/Users/jamarszal/src/contentstack/contentstack-import/node_modules/bluebird/js/release/async.js:133:16) at Async._drainQueues (/Users/jamarszal/src/contentstack/contentstack-import/node_modules/bluebird/js/release/async.js:143:10)

Unable to import ( extension_uid )

Hi. I am trying to import stack using this tool ( npm run import command ) and I'm getting this issue:
image
any ideas what I'm doing wrong ?

Import fails with useless error message

$ node --version
v14.4.0

$ npm run import

> [email protected] import /Users/emerson/Code/contentstack-import
> node app.js

Logging into Contentstack
Contentstack account authenticated successfully!
info: Languages have been imported successfully!
info: Environments have been imported successfully!
info: No Extensions Found
info: No Webhooks Found
info: No globalfields Found
info: No folders were found at: /Users/emerson/Code/contentstack-import/_backup_131/assets/folders.json
info: Asset import completed successfully!
error: Import utility failed while executing
error: {}

Here's what I find in logs/error.log

{"level":"error","message":"Import utility failed while executing","timestamp":"2020-08-12T19:43:59.923Z"}
{"level":"error","message":"{}","timestamp":"2020-08-12T19:43:59.923Z"}

I used this utility roughly one month ago and it worked. It's unclear to me what changed since then. And I'm having trouble finding any useful output to debug.

How to import data with references

How can I insert entries with references?

Let's say I have Content type Home and I have one field which is logo which is
Image asset and other one is reference from other content type.

I am able to export the entries but when I am trying to import I could only
Import textual data, not the image asset as well as the reference.

Can someone please help?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.