Giter Club home page Giter Club logo

contentful-cli's Introduction

Contentful CLI

Contentful's command line interface tool. Use Contentful features straight from your CLI.

npm Contentful

Contentful provides a content infrastructure for digital teams to power content in websites, apps, and devices. Unlike a CMS, Contentful was built to integrate with the modern software stack. It offers a central hub for structured content, powerful management and delivery APIs, and a customizable web app that enable developers and content creators to ship digital products faster.

πŸš€ Features

  • Get started with Contentful with the init command.
  • Manage spaces - list, create, delete,...
  • Export your space to a JSON file.
  • Import your space from a JSON file.
  • Execute migration scripts written in the Contentful Migration DSL
  • Generate migration scripts for the Contentful Migration DSL from existing spaces.
  • Seed your space with example data.
  • Manage installation of extensions in a space.
  • Securely login and logout with our OAuth service.
  • Find all available commands in the docs section.

☁️ Installation

Make sure you have Node LTS installed

Then using npm or yarn:

npm install -g contentful-cli
# Or
yarn global add contentful-cli

Please note that for the non standalone versions you need Node LTS to use the CLI.

βœ‹ Usage

Use the --help parameter to display the help section for CLI tool or combined with a specific command to get the help section for that command.

contentful --help
# Or
contentful space --help

πŸ“š Documentation

More detailed documentation for every command can be found in the docs section.

Using the CLI tool with a proxy

You can save the proxy configuration in your .contentfulrc.json via:

contentful config add --proxy user:auth@host:port

We also respect the http(s)_proxy environment variables:

https_proxy=user:auth@host:port contentful

When multiple proxy configurations exists, precedence is taken in this form:

  1. http_proxy takes precedence over .contentfulrc.json
  2. https_proxy takes precedence over .contentfulrc.json
  3. https_proxy takes precedence over http_proxy

Configuring the CLI for EU usage

You can override the host configuration in your .contentfulrc.json via:

contentful config add --host api.eu.contentful.com

Then any subsequent command will use the EU host. E.g. contentful login will log you in to your EU Contentful instance.

⛑️ Troubleshooting

  • Unable to connect to Contentful through your Proxy? Try settings rawProxy: true in your .contentfulrc.json via:
contentful config add --raw-proxy

πŸ› οΈ Development

  1. Install dependencies
    npm i
  2. To avoid development version colliding with your already installed Contentful CLI, change the command name in package.json
      "bin": {
    -     "contentful": "bin/contentful.js"
    +     "ctfl": "bin/contentful.js"
      }
  3. Link your local version, and happy hacking πŸŽ‰
    npm link

πŸ€– Testing

Integration tests

To run integration tests locally, you'll need the following:

  1. Set environment variables in .jest/env.js (can be found in 1Password)
    process.env.CONTENTFUL_INTEGRATION_TEST_CMA_TOKEN = '<cma_auth_token>'
    process.env.CLI_E2E_ORG_ID = '<organization_id>'
  2. Run talkback proxy to record and playback http requests
    npm run talkback-proxy
  3. In another terminal shell run your preferred tests
    ## Run all integration tests
    npm run test:jest
    ## Or run specific tests
    npx jest test/integration/cmds/space/* --watch

Unit tests

Simply run:

# Run all unit tests
npm run test:unit:watch
# Or run specific tests
npx jest test/unit/cmds/* --watch

See jest documentation for more details about running tests and optional flags.

Updating Snapshots

You might need to update snapshots and it's challenging with the recordings.

Tip: run tests without recordings to update the snapshots.

npx jest test/integration/cmds/<path to the affected test file> --updateSnapshot

❓ Support

If you have a problem with this tool, please file an issue here on Github.

If you have other problems with Contentful not related to this library, you can contact Customer Support.

✍️ Contributing

See CONTRIBUTING.md

πŸ“œ License

MIT

contentful-cli's People

Contributors

andipaetzold avatar andreascful avatar anho avatar axe312ger avatar cachrisman avatar crissto avatar damienxy avatar dborsatto avatar dependabot-preview[bot] avatar dependabot[bot] avatar dlitvakb avatar floelhoeffel avatar jjolton-contentful avatar khaledgarbaya avatar lynnagara avatar m3kh avatar makinwab avatar marcolink avatar massao avatar matthew-contentful avatar mayakarabula avatar mgoudy91 avatar mshaaban0 avatar phoebeschmidt avatar realityking avatar ruderngespra avatar stefanjudis avatar suevalov avatar t-col avatar vinz93 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

contentful-cli's Issues

Await Environment Creation

Summary

When you call contentful space environment create --name 'Staging' the cli creates the environment but it does not wait for it to be ready and this not CI friendly.

Solution

Adding a flag like --await-final-creation to the environment create cmd that defaults to false, when it's true the process won't finish until the environment is created

No multiple configs in .contentfulrc.json

Expected Behavior

shouldn’t it be possible to add multiple configs in the .contentfulrc.json?

Actual Behavior

When i use contentful config add it overrides my last config.
contentful config list therefore only shows one config.

Environment

Node Version: v10.9.0
Npm Version: 6.2.0
Package Version: [email protected]

403 error on import

Expected Behavior

Enter contentful login and use the OAuth token to authenticate.
In terminal, enter contentful space import --config config.json and import a Content Type into my environment.

config.json:

{
  "spaceId": "[SPACE ID]",
  "environmentId": "[ENVIRONMENT ID]",
  "managementToken": "[MANAGEMENT TOKEN]",
  "contentFile": "path/to/content-type.json",
  "contentModelOnly": true
}

Actual Behavior

The following 1 errors and 0 warnings occurred:

16:59:07 - AccessDenied: Status: 403 - Forbidden - Message: Forbidden - Request ID: ###

Stored the detailed error log file at:path/to/error-log.json
🚨  Error: Errors occured
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ ContentfulMultiError: Errors occured                                                                                                                                                  β”‚
β”‚      at then (/usr/local/lib/node_modules/contentful-cli/node_modules/contentful-import/dist/index.js:202:28)                                                                         β”‚
β”‚      at tryCatcher (/usr/local/lib/node_modules/contentful-cli/node_modules/bluebird/js/release/util.js:16:23)                                                                        β”‚
β”‚      at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/contentful-cli/node_modules/bluebird/js/release/promise.js:517:31)                                             β”‚
β”‚      at Promise._settlePromise (/usr/local/lib/node_modules/contentful-cli/node_modules/bluebird/js/release/promise.js:574:18)                                                        β”‚
β”‚      at Promise._settlePromise0 (/usr/local/lib/node_modules/contentful-cli/node_modules/bluebird/js/release/promise.js:619:10)                                                       β”‚
β”‚      at Promise._settlePromises (/usr/local/lib/node_modules/contentful-cli/node_modules/bluebird/js/release/promise.js:699:18)                                                       β”‚
β”‚      at _drainQueueStep (/usr/local/lib/node_modules/contentful-cli/node_modules/bluebird/js/release/async.js:138:12)                                                                 β”‚
β”‚      at _drainQueue (/usr/local/lib/node_modules/contentful-cli/node_modules/bluebird/js/release/async.js:131:9)                                                                      β”‚
β”‚      at Async._drainQueues (/usr/local/lib/node_modules/contentful-cli/node_modules/bluebird/js/release/async.js:147:5)                                                               β”‚
β”‚      at Immediate.Async.drainQueues (/usr/local/lib/node_modules/contentful-cli/node_modules/bluebird/js/release/async.js:17:14)                                                      β”‚
β”‚      at runCallback (timers.js:810:20)                                                                                                                                                β”‚
β”‚      at tryOnImmediate (timers.js:768:5)                                                                                                                                              β”‚
β”‚      at processImmediate [as _immediateCallback] (timers.js:745:5)

Possible Solution

contentful login OAuth would give me permissions for importing data

Steps to Reproduce

  1. npm install -g contentful-cli
  2. contentful login (OAuth via browser token)
  3. create a contentful-config.json file
  4. contentful space import --config contentful-config.json

Environment

Node Version: v8.16.0
Npm Version: 6.9.1
Operating System: Darwin [username] 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64
Package Version: contentful-cli 0.33.2

  • Language Version: en-us
  • Package Manager Version:
  • Browser Version:
  • Operating System: OSX 10.14.5
  • Package Version:

Is it possible to use this library programmatically?

We're currently using https://github.com/contentful/contentful-extension-cli to deploy our extension, but it's deprecated. I'd like to be able to deploy an extension to a specific environment, but it looks like contentful-extension-cli doesn't support it, so I'd need to migrate. Is it possible to use this library programmatically?

EDIT: I updated our extension to use the cli for instead of our custom script for deployments.

Rich text editor returning contentful app prefix on URLs / INLINES.HYPERLINK

Expected Behavior

  • API value returned from rich text editor should return links with no prefix

Actual Behavior

  • Links are being returned as:
    'https://app.contentful.com/&quot;[link value]/&quot;'

So the full return value is:

{
  data:  {
    uri: 'https://app.contentful.com/&quot;[LINK]/&quot;' },
    content: [ 
      { 
        data: {},
        marks: [],
        value: [LINK TEXT],
        nodeType: 'text' 
      } 
    ]
}}

Possible Solution

Remove 'https://app.contentful.com/&quot;/"'

Steps to Reproduce

  1. Use the new beta rich text field to create text containing links
  2. retrieve the value from CDN API

Environment

contentful-cli version 0.16.1

Error when trying to create a space.

Running this failed.

contentful space create --name '[Test] The example app migration'

Your user account is a member of multiple organizations. Please select the organization you would like to add your Space to.

? Please select an organization: [Production] Contentful (7BLDDu2FYCNoN4QIWys1BR)
🚨 Error: The resource you sent in the body is invalid.
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ { β”‚
β”‚ "status": 422, β”‚
β”‚ "statusText": "Unprocessable Entity", β”‚
β”‚ "message": "The resource you sent in the body is invalid.", β”‚
β”‚ "details": { β”‚
β”‚ "errors": [ β”‚
β”‚ { β”‚
β”‚ "name": "length", β”‚
β”‚ "path": "name", β”‚
β”‚ "value": "[Test] The example app migration" β”‚
β”‚ } β”‚
β”‚ ] β”‚
β”‚ }, β”‚
β”‚ "request": { β”‚
β”‚ "url": "https://api.contentful.com:443/spaces/", β”‚
β”‚ "headers": { β”‚
β”‚ "Accept": "application/json, text/plain, /", β”‚
β”‚ "Content-Type": "application/vnd.contentful.management.v1+json", β”‚
β”‚ "X-Contentful-User-Agent": "app contentful.cli/0.6.0; sdk contentful-management.js/3.12.0; platform node.js/7.4.0; os macOS/16.7.0;", β”‚
β”‚ "Authorization": "Bearer XXX", β”‚
β”‚ "user-agent": "node.js/v7.4.0", β”‚
β”‚ "Accept-Encoding": "gzip", β”‚
β”‚ "X-Contentful-Organization": "7BLDDu2FYCNoN4QIWys1BR", β”‚
β”‚ "Content-Length": 43 β”‚
β”‚ }, β”‚
β”‚ "method": "post", β”‚
β”‚ "payloadData": "{"name":"[Test] The example app migration"}" β”‚
β”‚ }, β”‚
β”‚ "requestId": "1d01509e65a5e7b98ae423297c358f30" β”‚
β”‚ } β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Add convenience method for content model export space export command

Actual Behavior

Currently to export a content model only you have to use the command

$ contentful space export --skip-content --skip-roles --skip-webhooks

This is not really intuitive and people willing to export only the content model might miss one of the options. (I missed the webhooks several times myself already)

Possible Solution

We have several flags including --content-only. I think It would make sense to implement a conveniences flag --content-model-only to achieve the same result as described with three flags.


Discussed in the community slack.

contenful space environment use is not used by export

I can select a default space using contentful space use, and a default environment using contentful space environment use.
If I perform a contentful space export command after that, without supplying space-id or environment-id, the previously stored space is used, but for environment it will use "master".

Expected Behavior

contentful space export without any supplied environment-id should use the environment previously stored with contentful space environment use

Actual Behavior

If no environment-id is supplied to contentful space export it will use "master".

Steps to Reproduce

  1. Create a second environment in you space. Make sure it contains different data than "master".
  2. contentful space use <your space-id>
  3. contentful space environment use <your envirnoment-id>
  4. contentful space export

NOTE: The order of the use commands is important. If you set the space after you have set the environment, environment gets reset to "master". This is by design and as documented.

If you check the exported data, it will come from master, when it should have come from "your environment-id".

Context

This is not a big problem, I have just started to explicitly supply environment-id. However, it really puzzled me in the beginning, since "master" and my target environment were very similar.

Environment

  • Node Version: v10.6.0
  • Npm Version: 6.1.0
  • Operating System: Windows 10 64-bit
  • contentful-cli version: 0.18.0

Can't use contentful login

Expected Behavior

contentful login
Open a browser window now? Yes
Paste your token here:

Pasting token should validate login (first time using the lib, don't know what's the exact step).

Actual Behavior

contentful login
Open a browser window now? Yes
Paste your token here:
Hitting enter after pasting key just clears the input, no matter how many times operation is repeated.

Possible Solution

Steps to Reproduce

  1. contentful login
  2. Open a browser window now? Yes
  3. Paste your token here:

Context

Got a couple of warnings after installing the package:

npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated [email protected]: This module has moved and is now available at @hapi/topo. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated [email protected]: This module has moved and is now available at @hapi/hoek. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated [email protected]: This module has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version of hapi to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).

Tried downgrading contentful-cli to 0.16.1, without any differences.

Environment

  • Language Version: node v11.9.0
  • Package Manager Version: npm 6.8.0
  • Browser Version: chrome 74.0.3729.131
  • Operating System: osx 10.14.4
  • Package Version: 0.26.4

Import option to completely overwrite everything within a space

Expected Behavior

When importing into Contentful, it would be great to have an option to overwrite everything within a space. All existing content types, entries and assets would be discarded and replaced by the imported file.

Actual Behavior

Currently, import is additive only - that this, any existing content types, entries and assets remain in the database.

Possible Solution

This could be an option specified when running the import, eg. "overwrite".

Context

We have a number of different spaces for our environments, such as PROD, TEST and DEV. Frequently we want to take a copy of what is in PROD and import into the other environments, such as TEST or DEV. When we do this, we have to run a script that goes through and deletes each entry, content type and asset separately. This is very time-consuming and inefficient.

Alternatively, if there was a quick way to just delete everything in a space, this would be a step that we could run before the import.

Environment id is not supported for getting a content type

Expected Behavior

When requesting a content type and specifying the space and the content_type should be retrieved from that space and content type, e.g:

contentful --space-id foospace --environment-id barvironment content-type get --id bazcontenttype

Actual Behavior

The environment id is ignored and the master id is selected

Possible Solution

Allow specifying the --environment argument here:

.option('space-id', { type: 'string', describe: 'Space id' })

  • Package Version: Contentful CLI 0.14.2

Import does not publish the content

I am trying to import content (some of it should be published and some should be in draft mode). When I import the data into contentful, they are by default in draft mode. Should I be sending some additional info in the JSON for me to force publish? Should I be using some of the publish* fields?

Here is the sample input data:
{
"entries": [
{
"sys": {
"space": {
"sys": {
"type": "Link",
"linkType": "Space",
"id": "fadfjadlkfad"
}
},
"type": "Entry",
"contentType": {
"sys": {
"type": "Link",
"linkType": "ContentType",
"id": "category"
}
}
},
"fields": {
"title": {
"en-US": "Hello World Category"
},
"slug": {
"en-US": "hello-world-category"
}
}
}
]
}

Allow config and running from local project folder

Expected Behavior

Having the option to install your config locally within a project root folder (~/path/to/project/.contentfulrc.json) rather than the OS user home folder (~/.contenfulrc.json).

This also means being able to run contentful commands, for example, through NPM and have the nearest config referenced, e.g. ~/path/to/project/.contentfulrc.json.

Actual Behavior

Config is installed in OS user home folder (~/.contenfulrc.json), making different configs for different projects a bit of a messy affair.

Space export missing assets downloaded

Expected Behavior

The following command will have an assets folder saved to my computer:

contentful space export --space-id [scrubbed id] --download-assets

Actual Behavior

Can find the json file, but no assets folder. Here is the output:

βœ” Initialize client (1s)
 βœ” Fetching data from space
   βœ” Connecting to space (2s)
   βœ” Fetching content types data (1s)
   βœ” Fetching editor interfaces data (1s)
   βœ” Fetching content entries data (1s)
   βœ” Fetching assets data (1s)
   βœ” Fetching locales data (1s)
   βœ” Fetching webhooks data (1s)
   βœ” Fetching roles data (1s)
 βœ” Download assets (5s)
 βœ” Write export log file
   βœ” Lookup directory to store the logs
   βœ” Create log directory
   βœ” Writing data to file
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Exported entities      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€
β”‚ Content Types     β”‚ 2  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€
β”‚ Editor Interfaces β”‚ 2  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€
β”‚ Entries           β”‚ 16 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€
β”‚ Assets            β”‚ 33 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€
β”‚ Locales           β”‚ 1  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€
β”‚ Webhooks          β”‚ 0  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€
β”‚ Roles             β”‚ 0  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Asset file download results β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Successful       β”‚ 33       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Warnings         β”‚ 0        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Errors           β”‚ 0        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
The export took a few seconds (8s)

Stored space data to json file at: /Users/jamesrauhut/contentful-export-[scrubbed]-master-2018-11-02T11-09-35.json
No errors or warnings occurred
The export was successful.
✨ Done

Environment

Node Version: v8.11.3
Npm Version: 5.6.0
Operating System: 18.0.0 Darwin Kernel Version 18.0.0: Wed Aug 22 20:13:40 PDT 2018; root:xnu-4903.201.2~1/RELEASE_X86_64 x86_64
Package Version: 0.16.1

Command "space migration" ignores active environment from .contentfulrc.json

Expected Behavior

When doing:

$ contentful space environment use -e "some-env"
$ contentful space migration some-script.js

I would expect migration to be run against "some-env" environment.

Actual Behavior

The confirmation dialog shows active environment is ignored:

The following migration has been planned

Environment: master

Create Content Type testContent
  - name: "Test content"
  - description: ""

Possible Solution

Consistently support space and environment set in .contentfulrc.json to act as default space and environment parameters.

Environment

  • Node Version: v8.11.3
  • Npm Version: 6.1.0
  • Package Version: 0.16.0

"space use" does not work for export

Expected Behavior

after selecting my space with contentful space use, I should be able to do an export with
contentful space export.

Actual Behavior

β–Ά contentful space use test-watermarkresources

? Please select a space: test-watermarkresources (343qxys30lid)
Now using Space test-watermarkresources (343qxys30lid) when the --space-id option is missing.

β–Ά contentful space export
contentful space export

Options:
...

Copyright 2018 Contentful, this is a BETA release

Missing required argument: space-id

Possible Solution

Ensure that the configured space gets passed to 'contentful-export' library when the --space-id param is missing.

BTW, it works with the --space-id param:

contentful space export --space-id 343qxys30lid
 βœ” Initialize clients
 βœ” Fetching data from space
 ...

Environment

β–Ά contentful --version && npm -v && node -v
0.8.3
5.6.0
v8.4.0

TypeError: createManagementClient(...).getSpace is not a function

REPO:

  • Install Contentful CLI
  • Log in from command line with personal access token
  • Attempt to generate migration script with contentful space generate migration -s [space-id] -e master

Expected Behavior

Script generated

Actual Behavior

Error: createManagementClient(...).getSpace is not a function

Possible Solution

None found

Steps to Reproduce

See above

Context

Environment

  • Language Version:
  • Package Manager Version:
  • Browser Version:
  • Operating System:
  • Package Version:

Calling `contentful completion` Instead Renders the Show Help Text.

Expected Behavior

I'm expecting a bash script as output, yes?

Actual Behavior

Usage: contentful <cmd> [args]

Commands:
  completion    generate bash completion script
  boilerplate   Download a boilerplate
  config        Manage and list your configs
  content-type  Manage and list your space content types           [aliases: ct]
  extension     Manage and list your extensions
  guide         A guide introducing basic concepts of working with Contentful
  login         Login to Contentful
  logout        Logout from Contentful
  space         Manage and list your spaces

Options:
  -h, --help     Show help                                             [boolean]
  -v, --version  Show current version                                  [boolean]

Copyright 2018 Contentful, this is a BETA release

Please specify a command.

Possible Solution

Add completion as a match-able input.

Steps to Reproduce

  1. contentful completion

Context

Just ran the following commands before hand...

  1. sudo npm install -g contentful-cli
  2. contentful login
  3. npm install

Environment

node: v6.11.4
npm: 3.5.2
contentful-cli: 0.8.3
Operating System: Ubuntu 17.10

Add Environment status to environment ls command

Actual Behavior

When calling contentful space environment ls we only get a list of the environments. It would be helpful to add some status information next to each environment.

Possible Solution

When listing the environments get the status from the environment.sys.status.sys.id and add it next to the environment name

`Import` a space throws `Rate limit error`

Import a space is not working

Actual Behavior

When I run

contentful space import --space-id <id>   --content-file contentful-export.json  --content-model-only --skip-locales --skip-content-publishing

I always get the same error

13:20:73 - Rate limit error occurred. Waiting for 1568 ms before retrying...

Steps to Reproduce

  1. export a space into a file
  2. import the exported space into a newly created space

Environment

  • Node: v8.10.0
  • npm 5.6.0
  • OS: macOS 10.13.4

Screenshot

Image of Yaktocat

Selecting no in `contentful guide` causes error 'sys' of undefined

When running contenful guide if you select Yes for "Create your new Space now?" then No for "Do you want to confirm the space creation?" you get the following error

Space creation aborted.
🚨  Error: Cannot read property 'sys' of undefined
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ TypeError: Cannot read property 'sys' of undefined                                                                               β”‚
β”‚      at createSpaceStep (/usr/local/lib/node_modules/contentful-cli/dist/guide/step-create-space.js:53:32)                       β”‚
β”‚      at process._tickCallback (internal/process/next_tick.js:68:7)                                                               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Expected Behavior

Expect contentful-cli to abort gracefully

Actual Behavior

Internal error is propogated to the user

Possible Solution

Have not looked into a solution

Steps to Reproduce

On contentful --version 0.29.0

  1. Run contentful guide
  2. Select Y to "Create your new Space now?"
  3. Select n to "Do you want to confirm the space creation?"
  4. See error

Context

I wasn't sure if I wanted to incur a possible extra cost for creating a space, so I selected No after it warned me.

Environment

node v10.15.3
npm 6.9.0
[email protected]
Darwin Monicas-MacBook-Pro.local 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64

contentful login still hangs

Refs #138

The problem still exists in 0.27.0. Running contentful login doesn't do anything when pasting the token and cannot be killed with ^C.

`contentful space create` can be executed without a name

Expected Behavior

I accidentally executed contentful space create --name without specifying a name and expected that this wouldn't work.

Actual Behavior

contentful space create --name creates a space with the name 1 (boolean parsing?)

Possible Solution

Maybe we could check for string length when parsing arguments?

Environment

contentful -v                                                                                                                                                                            
0.14.2

Unable to run migrations without logging into the CLI tool.

Expected Behavior

When running contentful space migration you should be able to use the CLI tool without logging in if you provide an access-token with the --access-token argument.

Actual Behavior

When running contentful space migration you are required to log in to the CLI tool even if you provide an access-token with the --access-token argument.

Steps to Reproduce

  1. Log out of the CLI tool or spin it up on a new machine.
  2. Run any migration_file using contentful space migration --access-token $MANGEMENT_API_KEY --space-id $SPACE_ID --environment-id master migration_file.js

Context

I'm trying to use contentful space migration on circleci for a continuous integration example. Currently using the older migration tool https://github.com/contentful-labs/continous-delivery-environments-example/blob/master/.circleci/config.yml#L49

Typings or values incorrect for validations when running space generate migration command

Expected Behavior

According to the typings of the assetImageDimensions field on IValidation the values for width.min, width.max, height.min and height.max are either are number or undefined.

Actual Behavior

When running the contentful space generate migration command, the generated values for the assetImageDimensions fields are can be null when you have not configured them in the UI:

screenshot 2018-11-13 10 35 58

Generated validations function:

.validations([
      {
        assetImageDimensions: {
          width: {
            min: 200,
            max: null
          },

          height: {
            min: null,
            max: null
          }
        }
      }
    ])

Possible Solution

Either adjust the typings if the behaviour of the command is correct, or adjust the functionality to not have null values but leave them out (undefined).

Adjust typings


export interface IValidation {
 ...
  /** Validates that an image asset is of a certain image dimension. */
  assetImageDimensions?: { width: { min?: number | null , max?: number | null }, height: { min?: number | null , max?: number | null } }
...
}

Or make sure the output is:

.validations([
      {
        assetImageDimensions: {
          width: {
            min: 200,
          },
        }
      }
    ])

Steps to Reproduce

  1. Create a contentType in the Contentful UI
  2. Add a field of type Media
  3. Add validation for Accept only specified image dimensions, only set a rule for width of atleast 200px
  4. Save content type
  5. Run command yarn run ts-node node_modules/.bin/contentful space generate migration -s XXX -e XXX -c XXX

Result:

module.exports = function(migration) {
  const test = migration
    .createContentType("test")
    .name("test")
    .description("");

  test
    .createField("test")
    .name("test")
    .type("Link")
    .localized(false)
    .required(false)
    .validations([
      {
        assetImageDimensions: {
          width: {
            min: 200,
            max: null
          },

          height: {
            min: null,
            max: null
          }
        }
      }
    ])
    .disabled(false)
    .omitted(false)
    .linkType("Asset");

  test.changeEditorInterface("test", "assetLinkEditor", {});
};

Cannot find module 'contentful-management' on all contentful CLI commands

Expected Behavior

  • contentful to function when commands in the terminal are run

Actual Behavior

  • All commands that are used with contentful result in the following error.
  • When I follow the path (...nvm/versions/node/v9.11.1/lib/node_modules/contentful-cli/dist/utils/contentful-clients.js) I am able to read the contentful-clients.js file, where I can see the script requiring the contentful-management file.
<MACHINE>:<FOLDER> <USER>$ contentful --help
internal/modules/cjs/loader.js:550
    throw err;
    ^

Error: Cannot find module 'contentful-management'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:548:15)
    at Function.Module._load (internal/modules/cjs/loader.js:475:25)
    at Module.require (internal/modules/cjs/loader.js:598:17)
    at require (internal/modules/cjs/helpers.js:11:18)
    at Object.<anonymous> (<USER>.nvm/versions/node/v9.11.1/lib/node_modules/contentful-cli/dist/utils/contentful-clients.js:11:29)
    at Module._compile (internal/modules/cjs/loader.js:654:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)

Steps to Reproduce

  1. Download nvm and use version 9.11.1 of node.
  2. Use brew to install yarn.
  3. Run yarn install with this as config for contentful:
    contentful@^6.1.0: version "6.1.1" resolved "https://registry.yarnpkg.com/contentful/-/contentful-6.1.1.tgz#75fd951257728d9de1b9a2d04b9d268a6d8d1a0d" dependencies: "@contentful/axios" "^0.18.0" contentful-resolve-response "^1.1.4" contentful-sdk-core "^6.0.0-beta0" json-stringify-safe "^5.0.1" lodash "^4.17.5"
  4. Try to run any contentful command and run into error above

Environment

Node Version: v9.11.1
Npm Version: 5.6.0
Nvm Version: 0.33.11
Operating System: Darwin Kernel Version 17.6.0
Package Version: [email protected]

  • Package Manager Version: 5.6.0
  • Browser Version: 67.0.3396.99
  • Operating System: Mac 10.13.5
  • Package Version: [email protected]

Make error message "You cannot edit field "" on content type "" because it does not exist." more clear

Expected Behavior

I would expect the Error message to be more clear about the fact that the content type does not exist.

Actual Behavior

You cannot edit field "components" on content type "page" because it does not exist.

Possible Solution

For example:
You cannot edit field "components" on content type "page" because the content type does not exist

Steps to Reproduce

  1. Run a migration on a non-existing content type: migration.editContentType('DOES NOET EXIST')
  2. Try and edit a field page.editField('fieldName')

Context

I was stuck because i was trying to figure out why the field 'components' could not be found. The actual error was that the content type did not exist.

Environment

Not relevant

Fetching content entries data fails

Expected Behavior

Entries data should be fetched

Actual Behavior

Getting error BadRequest: Status: 400 - Bad Request - Message: Response size too big, was: 9294576b. Maximum allowed response size: 7340032b.

Possible Solution

If there's a hard limit for the response, the response should be split to several requests.

Steps to Reproduce

  1. Run contentful space export for a space which has lots of content

contentful space environment list complains about missing accesToken (though management token is provided)

contentful space environment list still looks for a token although one is provided

Expected Behavior

contentful space environment list --management-Token my-secret-token --space-id my-space-id should list all environments in space with ID my-space-id.

Actual Behavior

Here is the error that I am getting:

🚨 Error: Expected parameter accessToken
TypeError: Expected parameter accessToken

 at createClient (/usr/local/lib/node_modules/contentful-cli/node_modules/contentful-management/dist/contentful-management.node.js:6964:11)
 at createManagementClient (/usr/local/lib/node_modules/contentful-cli/dist/utils/contentful-clients.js:33:49)
 at <anonymous>

Import flushes fields, which are not in the json file

If i skip fields in my json file, the corresponding fields will be empty in Contentful, after import.

Example import file:
{ "entries": [ { "sys": { "contentType": { "sys": { "type": "Link", "linkType": "ContentType", "id": "activities" } }, "id": "123xyz" }, "fields": { "activityId": { "de-DE": 138022 } } } ] }

My content model "activities" of course has more fields, like "title" etc.
All the fields are empty after importing my file. Is it possible to skip fields? I don't want to flush them every time, i only want to update some fields.

Import from JSON with missing field results in CLI tool hanging

Expected Behavior

I normally get a 422 when there's some sort of mismatch or invalid content between my JSON file and the content model in contentful.

Actual Behavior

When I include a JSON file that has a field that is NOT in the contentful model, I end up in an infinite loop during the "Importing Content" phase, which results in various API rate limit errors, but NO 422 describing the problem.

Possible Solution

Just handle the error case where I import data that has fields that don't exist in contentful by throwing a 422 and making sure that gets back to the CLI tool.

Steps to Reproduce

Create a content model, create a JSON file to import into it, and run the import with --skip-model. As long as your JSON file has an EXTRA field not found on your content model, you will notice it hang and fail to report back errors.

Environment

node version 10.15.0
npm version 6.8.0
contentful CLI version 0.20.0

Unable to Modify Content Type Validations on Entry Array

I have a field of type "References, many" (an array of entries) with some validations. In Contentful's UI, I've selected some content types that I want to restrict the field to, and this seems to work. However, I am trying to modify the validations with Contentful CLI and it seems we are not able to modify this validation for arrays, even though it clearly is valid. This is the code snippet in my migration:

const linkGroup = migration.editContentType('linkGroup')
linkGroup.editField('links')
    .validations([
      { 'linkContentType': ['page', 'internalLink', 'externalLink', 'resource'] }
    ])

The error I receive says Array fields do not support "linkContentType" validations

When I use the Content Management API to retrieve this content type, I get this:

{
    "id": "links",
    "name": "Links",
    "type": "Array",
    "localized": false,
    "required": false,
    "validations": [],
    "disabled": false,
    "omitted": false,
    "items": {
        "type": "Link",
        "validations": [
            {
                "linkContentType": [
                    "externalLink",
                    "internalLink",
                    "page"
                ]
            }
        ],
        "linkType": "Entry"
    }
},

This seems to be a discrepancy between what the CLI allows and what is actually valid.

Management Token for Extension Commands

Expected Behavior

If the user does not perform contentful login, extension commands can be used by passing a --management-Token option, ex.

contentful extension list --space-id $CONTENTFUL_SPACE --management-token $CONTENTFUL_CMA_TOKEN

Actual Behavior

Command actually throws because the management token for extension_cmds commands is not parsed and applied the same way that is for space_cmds

contentful extension list --space-id $CONTENTFUL_SPACE --management-token $CONTENTFUL_CMA_TOKEN

🚨  Error: Expected parameter accessToken
β”‚ TypeError: Expected parameter accessToken                                                                                           β”‚
β”‚      at createClient                                                                                                                β”‚
β”‚ (/.config/yarn/global/node_modules/contentful-management/dist/contentful-management.node.js:6894:11)             β”‚
β”‚      at createManagementClient                                                                                                      β”‚
β”‚ (/.config/yarn/global/node_modules/contentful-cli/dist/utils/contentful-clients.js:26:49)                        β”‚
β”‚      at <anonymous> 

Possible Solution

Add the argv.token parsing / argument to where createManagementClient is called in the extensions commands. I would also be happy to put forth a PR for this

ex.

  const client = await createManagementClient({
    accessToken: argv.managementToken || cmaToken,
    feature: 'extension-list'
  })

Steps to Reproduce

  1. Do NOT run contentful login
  2. Generate a CMA personal token
  3. Add it to your environment export CONTENTFUL_CMA_TOKEN=<your_token>
  4. Run an extension command contentful extension list --space-id $CONTENTFUL_SPACE --management-token $CONTENTFUL_CMA_TOKEN

Context

Deploy extension in CI with encrypted CMA token

Environment

Can you create entries with this CLI tool?

I did not see anything related to creating entries in the README. Is this possible? I mainly want this so I can migrate certain content from another system to Contentful.

Feature request: list organizations

Expected Behavior

Enable contentful organization list so that we don't have to leave the command line in order to create a space with contentful space create --org $ORG_ID

Actual Behavior

Currently, there is no way to list organizations which means that if you want to just create an empty space, which requires and organization id, that you have to go to the web app to grab said org id.

Edit: I just realized I can create a space with contentful space create -n 'MyName' and then I can interactively choose an org, but this was a bit unclear. Maybe another possible solution is to simply enable contentful space create without arguments and prompt the user to name it before/after choosing an org.

Unify token and space id parameter management and make it available everywhere

As discussed here it would be great to haven token and space parameters available in every command.

Looking at context.js this doesn't seem to be handled in one single place but rather in all the sub commands.

For easier automation and convenience reasons access-token and space-id should be available everywhere.

Expected Behavior

Token and space Id being available as parameter in every command-

Actual Behavior

I can not create extensions using the CLI without logging in.

Possible Solution

Make context.js aware of these two parameters.

How to do Contentful Login with no local web browser

Expected Behavior

It seems not possible to set up contentful-cli access without a local web browser.

vm:~/development/Contentful] $ contentful login

A browser window will open where you will log in (or sign up if you don’t have an account), authorize this CLI tool and paste your CMA token here:

? Open a browser window now? No
Log in aborted by the user.

vm:~/development/Contentful] $ contentful login

A browser window will open where you will log in (or sign up if you don’t have an account), authorize this CLI tool and paste your CMA token here:

? Open a browser window now? Yes
? Paste your token here:

It says to paste in the CMA token but pasting in my CMA token doesn't have any effect -- I think its not really wanting the CMA token but rather some sort of oauth refresh token

Don't want to have to install X-windows and a browser just to run migrations.

When ever I try running the cli tool I keep getting SyntaxError: Unexpected token function

Expected Behavior

any command with contentful to just run...

Actual Behavior

When I run contentful (any command even --help) I get the following error:

`
$ contentful space --help
/usr/local/lib/node_modules/contentful-cli/dist/cmds/boilerplate.js:63
async function getBoilerplates() {
^^^^^^^^

SyntaxError: Unexpected token function
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at Object.require (internal/module.js:20:19)
at /usr/local/lib/node_modules/contentful-cli/node_modules/require-directory/index.js:76:17`

Possible Solution

Steps to Reproduce

  1. installed contentful with npm install -g contentful-cli
    2.ran: contentful space --help

Context

Environment

  • Language Version: v.6.12.2
  • Package Manager Version: 5.10.0
  • Browser Version: safari 11.1.1 (13605.2.8)
  • Operating System: OS X 10.13.5 (17F77)
  • Package Version: 0.14.2

List spaces by organization

Expected Behavior

I would expect to have the posibility to list spaces belonging to a specific organization.

Actual Behavior

contentful space list command does not accept any argument.

Possible Solution

Add a --organization_id argument to contentful space list command to list only spaces belonging to the organization with specific ID.

Environment

  • Language Version: v12.1.0
  • Package Manager Version: 6.9.0
  • Browser Version: Does not apply
  • Operating System: Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64
  • Package Version: [email protected]

import --no-update option doesn't work

contentful space import --no-update --content-file output.json
Usage: contentful space import --content-file <file>

Options:
  -h, --help                 Show help                                 [boolean]
  --space-id                 ID of the destination space                [string]
  --environment-id           ID the environment in the destination space
                                                    [string] [default: "master"]
  --content-file             JSON file that contains data to be import to your
                             space                           [string] [required]
  --content-model-only       Import only content types[boolean] [default: false]
  --skip-content-model       Skip importing content types and locales
                                                      [boolean] [default: false]
  --skip-locales             Skip importing locales   [boolean] [default: false]
  --skip-content-publishing  Skips content publishing. Creates content but does
                             not publish it           [boolean] [default: false]
  --no-update                Skips updating entries if they already exist
                                                      [boolean] [default: false]
  --error-log-file           Full path to the error log file            [string]
  --management-host          Management API host
                                        [string] [default: "api.contentful.com"]
  --proxy                    Proxy configuration in HTTP auth format:
                             [http|https]://host:port or
                             [http|https]://user:password@host:port     [string]
  --config                   An optional configuration JSON file containing all
                             the options for a single run

Copyright 2018 Contentful, this is a BETA release

Unknown argument: update

Version 0.14.1 on Mac

Migration doesn't appear to support prohibitRegexp

Expected Behavior

I should be able to modify content models from the tool even if they contain regex validations.

Actual Behavior

Error message displayed during content migration if a regex is enabled:
"Error: A field can't have "prohibitRegexp" as a validation."

Possible Solution

Steps to Reproduce

  1. Create the following in the UI:
    image

  2. Create a content type migration and attempt to run it.
    e.g.

function addTranslations (contentType) {
        const ct =  migration.editContentType(contentType);
        ct.createField('translations')
            .name('Translations')
            .type('Text')
            .localized(false)
            .required(false);
   

        ct.changeEditorInterface('translations', 'multipleLine',
        {helpText: 'Add json for all necessary translations'}
    );
    }
  1. Fail due to error shown above.
The following migration has been planned

Environment: ci

Update Content Type contentTag

  Create field translations
    - name: "Translations"
    - type: "Text"
    - localized: false
    - required: false


Error: A field can't have "prohibitRegexp" as a validation.

Context

standard content model migration tasks.

Workaround

Manually uncheck prohibit regex and run migration.
I haven't tested any other of the checkboxes, so other errors might be lurking.

Environment

node -v v12.1.0
npm -v 6.9.0
Darwin 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64

CLI import issues with cloned fieldIds / names

Expected Behavior

When importing a json file using the CLI with the --skip-content flag, net-new field types / contentTypes will still import (even when not resolving/matching up against "old" content model.

Actual Behavior

When importing a json file using the CLI with the --skip-content flag, net-new field types cause the following error:

BadRequest: Status: 400 - Bad Request - Message: You need to omit a field before deleting it

Causing the import to error out and roll back (non-completed).

Possible Solution

Put a sanity check around the field ID existing during import; if not, create it as a net-new field.

Workaround (as of writing)

  1. Check the error log
  2. Locate the erroneous contentType ids
  3. Disable the response for all fields contained within this contentType
  4. Run import again
  5. Repeat until import succeeds as necessary

Steps to Reproduce

  1. Create contentType Parent
  2. Create field Child as fieldType input in contenType Parent with an id "childOne"
  3. Clone field Child and change its id to "childTwo"
  4. Save
  5. Export space & env using --skip-content flag
  6. Import space & env using --content-model-only flag

Context

Made content model changes to environement development and wanted to mirror them to master without affecting the content itself (just the content model).

Environment

Node Version: v10.9.0
Npm Version: 6.7.0
Operating System: Darwin iliakarasin-mbp.local 18.2.0 Darwin Kernel Version 18.2.0: Thu Dec 20 20:46:53 PST 2018; root:xnu-4903.241.1~1/RELEASE_X86_64 x86_64

  • Language Version: en_US
  • Package Manager Version: NVM 0.33.11
  • Browser Version: Google Chrome Version 72.0.3626.109 (Official Build) (64-bit)

zlib failed to install

Hello,

I'm trying to install contentful-cli via npm with:

npm install -g contentful-cli

and I'm getting an error when npm tries to install zlib.

Actual Behavior

sh: node-waf: command not found
sh: node-waf: command not found
npm ERR! [email protected] preinstall: `node-waf clean || true; node-waf configure build`

Environment

Node Version: v10.11.0
Npm Version: 3.10.9
Operating System: Darwin apina-mac 14.5.0 Darwin Kernel Version 14.5.0: Sun Jun 4 21:40:08 PDT 2017; root:xnu-2782.70.3~1/RELEASE_X86_64 x86_64

Importing content into the Rich Text field

This may be more of a support request, as I'm not able to find much documentation on how to achieve this, so I'm firstly looking to validate I'm using the correct MDAST format.

Expected Behavior

  • Importing content to the rich text field using the return from remark-parse (as documented here) should create formatted text in the admin UI field

Actual Behavior

  • content is imported (it can be viewed via a manual call to the API) however it does not appear in the admin UI rich text field

Possible Solution

Is the format returned via remark-parse correct? When manually creating a post using the UI only & viewing the field value via the API the structured text format is different to remark-parse, i.e.:

Contentful API

 {
    data: {},
    content: [{ data: {}, content: [Array], nodeType: 'paragraph'}],
    nodeType: "document"
}

Remark-parse

{ 
  type: 'root',
  children:
   [ { type: 'paragraph', children: [Array], position: [Position] }],
  position:
   { start: { line: 1, column: 1, offset: 0 },
     end: { line: 26, column: 28, offset: 2335 } } 
}

Contentful is storing & returning the 'remark-parse' value above when querying via the API despite not showing it in the UI field.

Steps to Reproduce

  1. Create API request using
var unified = require('unified')
var markdown = require('remark-parse')
var processor = unified()
  .use(markdown, {commonmark: true})

{
  "sys": {
    // deliberately left out
  },
  "fields": {
    "body": {
      "en-US": processor.parse(// markdown text)
    }
  }
};
  1. Import content via contentful space import --environment-id 'develop'

Context

Explained above

Environment

Node Version: v9.8.0
Npm Version: 5.10.0
Package Version: [email protected]

Error message "you need to omit a field before deleting it" not descriptive enough

Expected Behavior

I would expect the error message to tell me what field it is talking about.

"You need to omit a field before deleting it"

Actual Behavior

When you have an error about omitting a field before deleting it says:

"You need to omit a field before deleting it"

All you get is this with an empty details property:

"data": {
        "status": 400,
        "statusText": "Bad Request",
        "message": "You need to omit a field before deleting it",
        "details": {
        },
        "request": {
          "url": "https://api.contentful.com:443/spaces/knovuecdl43j/environments/master/content_types/learningPathModuleTutorialContent",
          "headers": {
            "Accept": "application/json, text/plain, */*",
            "Content-Type": "application/vnd.contentful.management.v1+json",
            "X-Contentful-User-Agent": "app contentful.cli/0.16.1; feature space-import; sdk contentful-management.js/5.2.1; platform node.js/v8.11.3; os macOS/17.7.0;",
            "Authorization": "Bearer ...8f825",
            "user-agent": "node.js/v8.11.3",
            "Accept-Encoding": "gzip",
            "X-Contentful-Version": 42,
            "Content-Length": 2783
          },
          "method": "put",
          "payloadData": "{\"displayField\":\"title\",\"name\":\"Learning Path Module Tutorial Content\",\"description\":\"Tutorial text based content for a learning path module\",\"fields\":[{\"id\":\"title\",\"name\":\"Title\",\"type\":\"Symbol\",\"localized\":false,\"required\":true,\"validations\":[],\"disabled\":false,\"omitted\":false},{\"id\":\"slug\",\"name\":\"Slug\",\"type\":\"Symbol\",\"localized\":false,\"required\":false,\"validations\":[{\"unique\":true},{\"regexp\":{\"pattern\":\"^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$\",\"flags\":null},\"message\":\"Slug must be one or more sequences of alphanumeric characters separated by a single -\"}],\"disabled\":false,\"omitted\":false},{\"id\":\"description\",\"name\":\"Description\",\"type\":\"Text\",\"localized\":false,\"required\":true,\"validations\":[{\"size\":{\"max\":600},\"message\":\"The description must be 600 or less characters\"}],\"disabled\":false,\"omitted\":false},{\"id\":\"minutesToComplete\",\"name\":\"Minutes to Complete\",\"type\":\"Integer\",\"localized\":false,\"required\":true,\"validations\":[],\"disabled\":false,\"omitted\":false},{\"id\":\"content\",\"name\":\"Content\",\"type\":\"Text\",\"localized\":false,\"required\":true,\"validations\":[],\"disabled\":false,\"omitted\":false},{\"id\":\"thumbnail\",\"name\":\"Thumbnail (955x395)\",\"type\":\"Link\",\"localized\":false,\"required\":false,\"validations\":[{\"assetImageDimensions\":{\"width\":{\"min\":955,\"max\":null},\"height\":{\"min\":395,\"max\":null}}}],\"disabled\":false,\"omitted\":false,\"linkType\":\"Asset\"},{\"id\":\"level\",\"name\":\"Level\",\"type\":\"Symbol\",\"localized\":false,\"required\":true,\"validations\":[{\"in\":[\"Beginner\",\"Intermediate\",\"Advanced\"]}],\"disabled\":false,\"omitted\":false},{\"id\":\"difficultyLevel\",\"name\":\"Difficulty Level\",\"type\":\"Link\",\"localized\":false,\"required\":false,\"validations\":[{\"linkContentType\":[\"contentLevel\"]}],\"disabled\":false,\"omitted\":false,\"linkType\":\"Entry\"},{\"id\":\"topics\",\"name\":\"Topics\",\"type\":\"Array\",\"localized\":false,\"required\":false,\"validations\":[],\"disabled\":false,\"omitted\":false,\"items\":{\"type\":\"Link\",\"validations\":[{\"linkContentType\":[\"learningPathTopic\"]}],\"linkType\":\"Entry\"}},{\"id\":\"publishToSites\",\"name\":\"Publish To Sites\",\"type\":\"Array\",\"localized\":false,\"required\":false,\"validations\":[],\"disabled\":false,\"omitted\":false,\"items\":{\"type\":\"Link\",\"validations\":[{\"linkContentType\":[\"siteId\"]}],\"linkType\":\"Entry\"}},{\"id\":\"summary\",\"name\":\"Summary\",\"type\":\"Text\",\"localized\":false,\"required\":false,\"validations\":[],\"disabled\":false,\"omitted\":false},{\"id\":\"repositoryUrl\",\"name\":\"Repository Url\",\"type\":\"Symbol\",\"localized\":false,\"required\":false,\"validations\":[],\"disabled\":false,\"omitted\":false},{\"id\":\"metaTitle\",\"name\":\"Meta Title\",\"type\":\"Symbol\",\"localized\":true,\"required\":false,\"validations\":[],\"disabled\":false,\"omitted\":false},{\"id\":\"metaDescription\",\"name\":\"Meta Description\",\"type\":\"Symbol\",\"localized\":true,\"required\":false,\"validations\":[],\"disabled\":false,\"omitted\":false}]}"
        },
        "requestId": "e57580e1d99c5d089811784e2feb186d"
      }

Possible Solution

Could it not say something like:

"You need to omit the field '{fieldName}' before deleting it"

Steps to Reproduce

  1. Create a content type with some fields
  2. Export and import it into another space
  3. Delete a field
  4. Export and import it again
  5. View error logs

Context

I'm trying to sync my content type development from a Development space into a Production space with ease.

Environment

  • Node:

8.11.3

  • NPM:

6.3.0

  • Operating System:

Darwin DESKTOP-AVV4EFJ 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64

  • CLI Version:

0.16.1

Can't Install contentful-cli

npm install -g contentful-cli

Expected Behavior

contentful-cli installs

Actual Behavior

npm ERR! code E404
npm ERR! 404 Not Found: @contentful/axios@^0.18.0

Possible Solution

Steps to Reproduce

  1. open terminal
  2. type npm install -g contentful-cli
  3. hit Enter

Context

Environment

node 10.10.0
npm 6.4.1
OS MacOS 10.14
Package Version empty

  • Language Version:
  • Package Manager Version:
  • Browser Version:
  • Operating System:
  • Package Version:

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.